The following instructions are for installing Moin Moin 1.2.3 on a website hosted by DreamHost. I created the instructions from notes I took during a somewhat bumpy install using the standard MoinMoin instructions for installing when you are not the root user. The standard MoinMoin instructions assume a fairly different website directory structure than your typical setup at DreamHost, so I recommend you benefit from my pain by using my instructions instead.

Important Note: As of now, these notes are a collection of what I learned as I installed MoinMoin. If you notice an error or missing info in these instructions, I would appreciate it if you would email me at robert AT wombatnation DOT com.

Any text in bold should be replaced with your specific website domain name, username, etc.

Also, these notes assume you are using an ssh or telnet client to get shell access to your DreamHost server. That means your DreamHost user account must have been granted shell access, not just the default level of FTP access. If you need to make this change, it will take about 15 minutes to take effect, so do it now! While you can install MoinMoin with just an FTP client, I think it is a lot more work. Learn to love the shell.

Install Python

As of July 2004, Python versions 2.1.3 and 2.2.2 are installed on DreamHost servers. You need 2.2.2 or newer for MoinMoin 1.2.3. To use the 2.2.2 version, you need to make sure that you are referencing python2.2 in CGI files, rather than just python. The DreamHost knowledegbase has clear instructions for making sure you are using the pre-installed 2.2.2 version. You can also use these DreamHost instructions if you want to compile, install, and use and even newer version of Python..

Download MoinMoin Installation File to Website

There are a lot of ways to do this. Here's a somewhat slow way, but it's simple to explain:

  1. Download the newest version of MoinMoin from SourceForge to a local computer.
  2. FTP moin-1.2.3.tgz (or a newer version) in binary mode from local computer to the domainname.com directory on your DreamHost server

You could have transferred the files directly to your DreamHost server with wget. If you don't know what that means, forget I ever mentioned it. Or run man wget from the shell to find out more.

Unpack MoinMoin Install File

You can do some of the following on your local computer before uploading to your DreamHost server, but I think it is much easier to do this work on the server. While you can use Telnet instead of ssh to connect to your server, ssh is secure and just as easy to use. On Windows, I use PuTTY. On Mac OS X, I use Fugu. On Linux, I use ssh on the command line, as Linus intended.

  1. Connect to domainname.com using ssh and cd into the domainname.com directory
  2. tar xvzf moin-1.2.3.tgz

You should now have a new directory called moin-1.2.3.

Run Install Script

  1. cd moin-1.2.3
  2. python setup.py --quiet install --home=$HOME --record=install.log

With MoinMoin 1.2.3, I got lots of syntax warnings and one syntax error. I didn't get any warnings or errors with MoinMoin 1.1. So far, I haven't run into any problems when actually using MoinMoin 1.2.3, though.

You will see the following warning after setup.py finishes. We'll take care of this in a later step.

warning: install: modules installed to '/home/atacama/lib/python/', which is not
 in Python's module search path (sys.path) -- you'll have to change the search p
 ath yourself

Set Up a Wiki Instance

The wiki has a public directory and a private directory. The public directory contains the CSS files, applets, and image files that we want the web server to serve up as static files. The private directory contains the raw data files and the configuration file.

These directions assume you want to create a wiki instance in the domainname.com/wiki directory. FYI, be sure to include the . at the end of the cp commands below. The "." is shorthand for "the current directory". Also, ~ is shorthand for /home/username/.

Prepare Private Directory

The data directory should not be part of your public website, and is therefore kept up above the domainname.com directory.

I use emacs as my editor. Use whichever editor you know well. I added simplified emacs instructions in case you haven't used it before.

  1. mkdir ~/wiki
  2. cd ~/wiki
  3. cp -r ~/share/moin/data .
  4. chmod -R o+rwX data
  5. cp ~/share/moin/cgi-bin/moin_config.py .
  6. emacs moin_config.py
  7. Make the following changes in moin_config.py:
    • sitename = 'Descriptive name for your new wiki instance'
    • data_dir = '/home/username/wiki/data/'
    • url_prefix = '/wiki'
  8. Press ctrl-x then press ctrl-s then press ctrl-x then press ctrl-c to save and exit emacs

Prepare Public Directory and moin.cgi

These directions assume that you want to put the MoinMoin CGI script(s) into a directory called "cgi-bin" in the root directory of your website. I initially tried to put it into the wiki directory, but for some unknown reason I couldn't get that to work.

  1. cd ~/domainname.com
  2. mkdir cgi-bin [You can skip this step if you already have this directory. You'll get a harmless warning if you try to create it and it already exists.]
  3. cp -r ~/share/moin/htdocs wiki
  4. cp ~/share/moin/cgi-bin/*.cgi wiki [Temporarily store it/them in the wiki dir while changing permissions]
  5. chmod a+rx wiki/*.cgi
  6. emacs wiki/moin.cgi
  7. This is where we fix the problem that caused the earlier warning about Python's Module Search Path by making the following changes in moin.cgi. First, update the initial shebang line so it points to the Python executable on a DreamHost web server.
    • #!/usr/bin/python
    You now need to remove the leading # for the next lines and update or add them as indicated below. The standard install docs suggest passing a list of the two needed paths to sys.path.append. I got errors when I tried that, so I just made two separate calls to sys.path.append.
    • import sys
    • sys.path.append('/home/username/wiki')
    • sys.path.append('/home/username/lib/python')
  8. mv wiki/*.cgi cgi-bin [Now put them in the cgi-bin dir]

Test Wiki Instance Install

  1. Load http://www.domainname.com/cgi-bin/moin.cgi?test in a web browser

You should then see a long page of text that begins with:

MoinMoin CGI Diagnosis
======================

Package "MoinMoin" successfully imported.

Release 1.2.3

You should then see info about the MoinMoin version, Python version, Python path, and the results of a bunch of self tests. You might see a warning about edit.log not being writable. I haven't yet determined if that is something I need to fix. You might also see a warning that "PyXML" is not installed. So far, this hasn't caused me any problems.

Next, check to see if the home page for your new Wiki instance is displayed properly.

  1. Load http://www.domainname.com/cgi-bin/moin.cgi in a web browser

You should see a generic MoinMoin Wiki front page.

You may also want to edit the refresh tag and the link in index.html file in the wiki directory to point to /cgi-bin/moin.cgi instead of to moin.cgi.

Clean Up Access URL

Although we can't modify the httpd.conf file on a virtual server on DreamHost, we can use the Apache URL rewriting capability to create a simpler URL for accessing the wiki. The following change will allow you to access your wiki via http://www.domainname.com/wiki. There may be a simpler way to accomplish this, but I know that the following works. One downside of this approach is that "cgi-bin/moin.cgi" will appear in the URL after the initial URL rewrite. Another downside is that user preferences seem to be ignored when pages are rewritten this way. I'm hoping to figure out how to fix it so that you see "wiki" in the URLs instead, plus you always get your user preferences. Please email me at robert AT wombatnation DOT com with suggestions.

  1. cd ~/domainname.com/wiki
  2. emacs .htaccess
  3. Enter the following lines exactly as written:
    RewriteEngine   on
    RewriteRule     ^$      ../cgi-bin/moin.cgi [T=application/x-httpd-cgi]
    
  4. Press ctrl-x then press ctrl-s then press ctrl-x then press ctrl-c to save and exit emacs
  5. Load http://www.domainname.com/wiki in a web browser

Troubleshooting

I managed to get some help from the appropriate section on the main MoinMoin site. Most of the useful info is in the "Installation into your home directory" section.

If you get an error about the text directory being missing when accessing http://www.domainname.com/cgi-bin/moin.cgi?test, make sure you included the line sys.path.append('/home/username/wiki') in moin.cgi.