Upgrading MoinMoin

I started using MoinMoin, a great little wiki, back around version 1.5. It’s up to version 1.9.9 now. I managed to keep it upgraded until 1.8.3, but it languished there for a long time. This is a little instruction manual on how to upgrade MoinMoin.

It may not suit all variations – in particular I just run one little wiki on WSGI, and also I use Ubuntu, so your mileage may vary. But most of the trickiness is in preserving all the old data.

Two web pages you should definitely visit first are the basic installation instructions:

https://moinmo.in/HowTo/UbuntuQuick

and Paul Vanderveer’s upgrade notes:

https://moinmo.in/RickVanderveer/UpgradingFromMoin18ToMoin19

Both pages were massively helpful, and Paul has a bunch of other upgrade notes between various versions. However, Paul’s notes are about upgrading in place. They boil down to installing the new version on top of the old version and making some adjustments.

My instructions are the opposite – how to install the new version, then get your data into it. This is especially useful if, like me, you are moving your wiki to a new platform. It means that you do not need to first port the old one (possibly with old versions of Python and what have-you), but can just begin with a clean fresh install and go from there.

Remember to adjust any commands given here to take account of your particular circumstances – different paths and so on.

Step 1: Gather the ingredients

You will need:

  • a logo graphic if you are replacing the default MoinMoin logo
  • a MoinMoin tarball to install the new version from
  • administrative access to the new platform
  • a tar file of your existing MoinMoin data directory (just the data)
    • for example, if your current install is in /usr/local/share/moin, do this:
      tar cfvz /usr/local/share/moin/data /path/to/moindata.tar.gz

Step 2: Get a working install of MoinMoin 1.9.9

You can pretty much follow the bouncing ball in the first link above. I did some very basic customisation – changed the logo graphic and set a super-user, plus I did the language install step. These are covered in the install notes.

Step 3: Take a copy of the fresh MoinMoin installation

You don’t need the Python install tree, just the MoinMoin directory. If you take a copy, you can easily re-copy it if something goes wrong. You also need a couple of things out of it later.

I installed in the default location, /usr/local/share, so these commands did the trick for me:

cd /usr/local/share
sudo mv moin moin_clean
sudo cp -a moin_clean moin_me
sudo ln -s moin_me moin

From this point on, you are working with /usr/local/share/moin. If you screw things up, do this to get a new clean copy to work on:

cd /usr/local/share
sudo rm -fr moin_me
sudo cp -a moin_clean moin_me

Step 4: Replace the data with yours

cd /usr/local/share/moin
sudo rm -fr data
sudo tar xfvz /path/to/moindata.tar.gz

Step 5: Recover the wikiconfig and dict directories

cd /usr/local/share
sudo cp -a moin_clean/data/dict moin/data
sudo cp -a moin_clean/data/cache/wikiconfig moin/data/cache

Step 6: Clear out all caches

This is a modified version of a command supplied by Paul Vanderveer. Be careful with the paths, particularly if you are using a different Python version or your Python is installed somewhere else:

sudo python /usr/local/lib/python2.7/dist-packages/MoinMoin/script/moin.py --config-dir=/usr/local/share/moin --wiki-url=localhost maint cleancache

Step 7: Set all permissions

On my system, the web user and group are both www-data. If yours are different, substitute yours into these commands:

cd /usr/local/share
sudo chown -R www-data:www-data moin
sudo chmod -R ug+rwx moin
sudo chmod -R o-rwx moin

Step 8: Make final adjustments to wikiconfig.py

At this point, finish any adjustments you still need to make in wikiconfig.py.

Step 9: Restart the web server

I am using Apache2, so I did this:

sudo service restart apache2

Step 10: Enjoy your upgraded wiki!

After restarting the web server, you should be able to see all your old pages, all the revision histories, all the attachments and so on.

Provided everything is in order, you can now tidy up:

cd /usr/local/share
sudo rm moin
sudo rm -fr moin_clean
sudo mv moin_me moin
sudo service apache2 restart
rm /path/to/moindata.tar.gz

 

Leave a Reply

Your email address will not be published. Required fields are marked *