MoinMoin under FC1

2005 January 22
by darkness

I want to install a Wiki under FC1. I tried PhpWiki but I couldn’t get the 1.2.x version running on FC1. Turns out, I think my problem is register_globals = Off in /etc/php.ini per something I found on the PhpWiki Wiki. Then I tried to use 1.3.10 but it apparently has some file_passwd bug which is supposedly fixed in 1.3.11… which isn’t released. I went to go get CVS HEAD, but SourceForge’s CVS servers (only for projects beginning with, like, seven letters, which I’m guessing means that’s how they divide up projects amongst servers and one of their servers pooped out) were down.

So I found MoinMoin instead. MoinMoin runs in Python (cool). MoinMoin doesn’t need and can’t use an RDBMS (not cool, but not exactly uncool either; as long as performance doesn’t suffer, I don’t care).

Of course I want to run it under mod_python. Reading the directions, sounds like mod_python < 3.1.3 had problems. I go the hard route, and decide to install mod_python 3.1.3a (or something like that) from FC2. Kids, don’t make a mistake like I did and get excited when the mod_python RPM from FC2 installs on FC1 without a hitch: it puts files in /usr/lib/python2.3, and FC1’s Python 2.2 obviously doesn’t look there. So, there are a number of routes I could have taken for installing mod_python from FC2 on an FC1 box, at this point:

  • I could have futzed with getting that mod_python binary to run under FC1’s python some more. I tried doing something like PythonPath "[ c.replace("2.3", "2.2") for c in sys.path ] + ['/usr/lib/python2.3/site-packages']“ in /etc/httpd/conf.d/python.conf but that didn’t fix a damn thing.
  • I could get FC2’s Python RPMs and install them. Turns out this would update a number of things like libdb, glibc, and an installation of libselinux. I fear what might happen to something linked against libselinux when it finds it’s a 2.4 kernel with no SELinux. So for now we skip this option in favor of…
  • Rebuilding the FC2 mod_python SRPM in FC1. This turned out to be the easiest: rpmbuild --rebuild the SRPM, install, and you’re off and running.

I followed the MoinMoin installation documentation which I had to search around to find. I used something like python setup.py install --home=/srv/www/my.wiki.com --record=install.log to install MoinMoin in my virtual host’s directory. That’s just how I organize things. Checking out install.log it looks like it was nice and didn’t install anything outside of that --home directory. Note: you will need python-devel installed to run setup.py.

I followed the “UNIX as root” instructions on how to make a Wiki instance minus anything that contained the string cgi. You don’t need any of that stuff if you’re using mod_python. I did make /srv/www/my.wiki.com/etc and plunked share/moin/cgi- bin/moin_config.py in it. Edit moin_config.cgi and fill in sitename, data_dir, and url_prefix. In the Apache configuration you will need the Alias directive but not the ScriptAlias directive.

Make sure moin_config.py and pretty much everything else is readable by apache:apache. Especially, check out share/moin/data/text/*, which I think I got bitching about in /var/log/httpd/error_log about at first.

After setting up the instance, I went to the “mod_python Setup using Apache” section. I skipped down to the “Deploying with a fixed mod_python” subsection and followed those instructions. This is my .htaccess which lives in my DocumentRoot:

<Files wiki>
    # Use mod_python as handler
    SetHandler python-program

    # set the path to the MoinMoin package and to the moin_config.py
    PythonPath "['/usr/lib/python2.3/site-packages', '/srv/www/my.wiki.com/lib/python','/srv/www/my.wiki.com/etc']+sys.path"

    # choose the ModPy Request class as handler
    PythonHandler MoinMoin.request::RequestModPy.run
</Files>

Another mistake I made was that I left url_prefix = '/wiki'. This is a problem because in the .htaccess above you’ve said /wiki should go to the mod_python handler, but then you’ve aliased it elsewhere. So I changed my Alias to point at /wikidata and changed url_prefix accordingly. After doing this, one weird problem I had was that links for images that should appear next to InterWiki links weren’t appearing; I was getting their alt text next to the link instead. It looked like they were using the old url_prefix (or logo_string, at least; see moin_config.py to see how logo_string is constructed). I think this had something to do with the byte compiled lib/python/MoinMoin/config.py. I changed config.py a bit to try and debug the problem, reloaded a few things, changed config.py back, and magically everything started working. Since changing config.py meant it was going to get recompiled, I suspect this recompiling fixed the problem I was having.

No Comments

Leave A Comment

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS