Installing MoinMoin Wiki on a Ubuntu VServer with Plesk

I just spent a day getting MoinMoin Wiki to run my vserver. Since I had rather spent this time otherwise and I assume the same holds for you too, I give you a step-by-step tutorial about how to get it running quickly. If you have root access to a vserver running plesk and want to install the wiki for one or more domains hosted on that server, these instructions are right for you!

The problem here is that Plesk makes various assumptions about default directories, permissions and apache configuration. Let us assume you want to set up a wiki for the domain FOO.COM, the home of which is located at /var/www/vhosts/FOO.COM on your vserver. The ftp user for FOO.COM is called RICKY. Run the following commands as root (please adjust directories and version numbers):
wget http://static.moinmo.in/files/moin-1.6.3.tar.gz
tar -xvzf moin-1.6.3.tar.gz
cd moin-1.6.3
python setup.py install --prefix='/usr/local' --record=install.log

These are the instructions for Basic MoinMoin Installation. Note that there is a MoinMoin package for Dapper, but the latest version is 1.5.9. The installation has been succesful if entering “import MoinMoin” in python gives no error message. We will now create a “wiki instance”, which is a single wiki for a particular domain.

Typically, the documents delivered by the webserver are located at /var/www/vhosts/FOO.COM/httpdocs. We don’t want to install the instance here since anybody would be able to download all wiki data. Instead, we put the data directly to /var/www/vhosts/WIKINAME (please select any WIKINAME). Go to the domain root and open and create the file createInstance.sh with an editor of your choice (I prefer emacs):

cd /var/www/vhosts/FOO.COM/
emacs createInstance.sh

Paste in the script shown here and replace the following entries:

SHARE=/usr/local/share/moin
USER=RICKY
GROUP=psacln

By the way, psacln is the default group used for ftp users by Plesk. Create the instance by hitting

chmod +x createInstance.sh
./createInstance.sh WIKINAME

We will now adjust the wiki configuration files for use with our local directory structure and wiki name. First, open the file /var/www/vhosts/FOO.COM/WIKINAME/wikiconfig.py and replace the line data_dir = './data/' with data_dir = '/var/www/vhosts/FOO.COM/WIKINAME/data/' and replace data_underlay_dir = './underlay/' with data_underlay_dir = '/var/www/vhosts/FOO.COM/WIKINAME/underlay/'. Please take care that the indentation of these lines stays like it is and no TAB is inserted.

Now go to the directory /var/www/vhosts/FOO.COM/cgi-bin, which Plesk created by default. Enter

cp /usr/local/share/moin/server/moin.cgi .
chmod 751 moin.cgi
emacs moin.cgi

In your editor, replace the line sys.path.insert(0, '/path/to/wikiconfig') with sys.path.insert(0, '/var/www/vhosts/FOO.COM/WIKINAME').

The only thing which is left to do, is to tell the webserver where it can find the static files for the wiki. WIth plask, you may never alter http.conf or http.include files, as these changes are overwritten next time you change anything using the plesk webinterface. Instead, you will have to edit the file /var/www/vhosts/FOO.COM/vhost.conf! Paste the following into that file (maybe change 163 to your version number)


alias /moin_static163 "/usr/local/share/moin/htdocs"
<Directory /usr/local/share/moin/htdocs>
Order allow,deny
allow from all
</Directory>

Restart the webserver with

/etc/init.d/apache2 restart

If you have done everything right, you should now be able to access your wiki under the domain FOO.COM/cgi-bin/moin.cgi. Voilá! Further configuration is needed, but your wiki is up and running right now. If your wiki is too slow, you might want to consider switching to mod_python which i will explain in the sometime. You can create a nicer alias such as FOO.COM/WIKI for the wiki by adding following line to vhosts.conf

ScriptAlias /WIKI "/var/www/vhosts/FOO.COM/cgi-bin/moin.cgi".

One Response to “Installing MoinMoin Wiki on a Ubuntu VServer with Plesk”

  1. Hey awesome blog! Know anyone who would be interested in part time admin’ing a Linux box? Hit me up!

Leave a Reply