Deploying MoinMoin on Ubuntu using Apache mod_wsgi

I just went through a somewhat lengthy setup process to deploy a moinmoin wiki on Ubuntu. There’s a lot of documentation on it which actually makes it take a bit longer than I’m used to for getting something running on Ubuntu.  I thought I’d share my streamlined notes for this common deployment scenario.

The first step is configuration.  Greater detail on all of this can be found here.

tar -xzvf moin-1.8.3.tar.gz
cd moin-1.8.3

python install --prefix='/usr/local' --record=install.log

#Setup the variables.
export PREFIX=/usr/local
export SHARE=$PREFIX/share/moin
export WIKILOCATION=/path/to/wikis
export INSTANCE=your_wiki_name
export GROUP=www-data
export USER=www-data

# Now it copies the default data
mkdir -P $INSTANCE                   # make a directory for this instance
cp -R $SHARE/data $INSTANCE       # copy template data directory
cp -R $SHARE/underlay $INSTANCE   # copy underlay data directory
cp $SHARE/config/ $INSTANCE   # copy wiki configuration sample file

# Set the permissions
chown -R $USER.$GROUP $INSTANCE   # check that USER and GROUP are correct
chmod -R ug+rwX $INSTANCE         # USER.GROUP may read and write
chmod -R o-rwx $INSTANCE          # everybody else is rejected

# Copy over the server config files
cp/usr/local/share/moin/server/*.wsgi $INSTANCE
cp/usr/local/share/moin/server/*.cgi $INSTANCE

# If you want everyone (not just admins) to be able to edit it you need to run this command
# chmod -R a+rwX $INSTANCE

Now, if you haven’t already install apache and mod_wsgi

sudo apt-get install apache2 libapache2-mod-wsgi

Next edit your apache httpd.conf file ( /etc/apache2/httpd.conf ) and add the following to the end. More help on this step can be found here.

LoadModule wsgi_module modules/  # Loads mod_wsgi
<VirtualHost *>
Alias /moin_static183/ "/usr/local/share/moin/htdocs/"
#ScriptAlias /developers "/path/to/wikis/your_wiki_name/moin.cgi"
WSGIScriptAlias    / /path/to/wikis/your_wiki_name/moin.wsgi
WSGIDaemonProcess developerwiki user=www-data group=www-data home=/root process=5 threads=10 maximum-requests=1000 umask=0007
WSGIProcessGroup developerwiki

And finally you need to add your wiki directory to the python path.

echo "/path/to/wikis/your_wiki_name/" > /usr/lib/python2.5/site-packages/wikis.pth

Restart Apache and you should be set up.

1 comment
  1. Thanks for this guide, about the only one considering a subdomain for moinmoin.

    Anyways, two things: the code is cut off in awkward positions, and; process= should be processes=.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s