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.

wget http://static.moinmo.in/files/moin-1.8.3.tar.gz
tar -xzvf moin-1.8.3.tar.gz
cd moin-1.8.3

python setup.py 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
cd $WIKILOCATION
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/wikiconfig.py $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/mod_wsgi.so  # Loads mod_wsgi
<VirtualHost *>
ServerAdmin youremail@example.com
ServerName wiki.example.com
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
</VirtualHost>

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.

Advertisements
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=.

    Cheers!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s