How to install your own MoinMoin Wiki

This page describes the installation procedure applying to MoinMoin version 0.11 and up. In the next section, there is a list of real-world Installation Scenarios that help you to understand how to apply the instructions in different environments.

Basic Installation explains the “setup.py” step of the installation in more detail. This applies equally to all scenarios, and you should read it before trying a live installation.

Trouble-shooting helps with fixing any general problems you might encounter, which apply to any installation platform.

After a successful installation, you might want to read more about configuration and other options that you, as the wiki administrator, can set up. HelpOnAdministration contains links to pages that cover these topics. Especially, the HelpOnConfiguration and HelpOnUpdating pages provide additional information regarding wiki setup and maintenance. MoinMoinWinCvs and MoinMoinUnixCvs describe how to run your wiki using the current development version from the SourceForge CVS repository.

 

Sample Installation Scenarios

The following links lead you to concrete examples of installation sessions, showing the commands used and explaining what they do. It is highly recommended that you first read the general information on installing (especially the next section of this page) before choosing an installation scenario that best fits your intended use of MoinMoin.

UNIX:

  • UNIX Installation

Windows:

  • Windows Installation using Apache
  • Windows Installation using IIS

 

 

Basic Installation

Before you can integrate MoinMoin into your web environment, you have to do the basic installation using the standard Python distutils mechanism. We’ll explain the usual steps you need to take to do this. For more details on the distutils installation process, consult the Installing Python Modules document of your Python manual.

/!\ NOTE: You will need the Python Development package installed on UNIX systems for distutils to work correctly.

The first step is to unpack the distribution archive, which you have done already when you loaded this instructions from your disk. If you read this on the web, the distribution comes in a versioned ZIP or TAR archive, which you can unpack in the usual ways, into a temporary directory (/tmp on UNIX, C:\TEMP on Windows). The distribution archive will always unpack into a directory named moin-<version>, for example moin-0.11.

After unpacking, to install into a specific directory (C:\moin in our example), call setup.py after changing your current directory to the distribution directory. The following commands can be used to complete theses steps:

    unzip moin-0.11.zip 
    cd moin-0.11 
    python setup.py --quiet install --prefix=C:\moin 

This creates the following directories in “C:\moin” (note that on a UNIX system, the directory layout will be slightly different):

    MoinMoin 
    MoinMoin/action 
    MoinMoin/formatter 
    MoinMoin/i18n 
    MoinMoin/macro 
    MoinMoin/parser 
    MoinMoin/py15 
    MoinMoin/scripts 
    MoinMoin/support 
    MoinMoin/twisted 
    MoinMoin/webapi 
    Scripts 
    share 
    share/moin 
    share/moin/cgi-bin 
    share/moin/data 
    share/moin/data/backup 
    share/moin/data/cache 
    share/moin/data/pages 
    share/moin/data/plugin 
    share/moin/data/plugin/action 
    share/moin/data/plugin/macro 
    share/moin/data/text 
    share/moin/data/user 
    share/moin/htdocs 
    share/moin/htdocs/css 
    share/moin/htdocs/img 

You will likely see the following warning:

warning: install: modules installed to ‘C:\moin\’, which is not in Python’s module search path (sys.path) — you’ll have to change the search path yourself

This means exactly what it says, you need to add your install directory to the search path of Python. There are several ways to do this:

Environment variable
Change PYTHONPATH in a way that is persistent (/etc/profile.d on UNIX, AUTOEXEC.BAT on W9x, the Properties item in the context menu of My Computer on NT4 and W2K)
Apache “httpd.conf”
Use the SetEnv directive to set PYTHONPATH to a suitable value, for example:

    SetEnv PYTHONPATH "C:\moin" 
“moin.cgi”
Directly add your installation directory to the CGI driver script, like this:

    import sys 
    sys.path.append('C:/moin') 

If you use the following default installation command, MoinMoin will be installed to the Python directory:

    python setup.py --quiet install 

You won’t need to change your PYTHONPATH then, but depending on your system environment you might not be able to use that command, especially when you are not the root user on a UNIX system. If you don’t know where your Python directory is, this command will tell you:

    python -c "import sys; print sys.prefix" 

The directory structure we showed above will then be created in that directory. If you’re interested in the exact list of files that are installed, use the --record option of distutils.

[goto HelpOnInstalling/BasicInstallation]


 


Trouble-shooting

 

Built-in test

There’s a built-in diagnostic mode that’s useful when doing an install; just append “?test” to the URL of your wiki:

lynx --dump http://`hostname`/mywiki?test 

If you see an import error here, but “python -c "import MoinMoin"” works, it’s likely a result of missing file permissions or a wrong PYTHONPATH setting within the web server environment.


 


UNIX Installation

Index

  1. Installation when you are root or the webmaster
    1. Installing MoinMoin
    2. Creating a wiki instance
    3. Troubleshooting
      1. Dueling Pythons
      2. Distutils does not work
      3. Missing file permissions
  2. Installation into your home directory
    1. Making sure /~username URLs work
    2. Getting the distribution archive and doing the basic installation
    3. Setting up a wiki instance
    4. Setting up public_html and testing the installation

 

Installation when you are root or the webmaster

When you are root or the webmaster on the host you want to install MoinMoin on, you can place the software in a “standard” location, and also better integrate MoinMoin into your webserver. Especially, you can use a “nice” base URL that does not include “cgi-bin” or “moin.cgi” at all.

Most GNU/Linux distributions come with Apache pre-installed. In the following description, we assume the file system layout of a SuSE 7.0 system, that is:

  • /etc/httpd/httpd.conf – the main httpd configuration file
  • /var/log/httpd/error_log – log containing error messages

 

Installing MoinMoin

Before creating a wiki instance, you have to download and install the basic MoinMoin software. We assume you already have downloaded the distribution archive to “/tmp1.

Open a shell and enter the following commands:

cd /tmp 
tar xfz moin-0.11.tgz 
cd moin-0.11 
python setup.py install --record=install.log 

This will install all necessary files into the sys.prefix directory of your Python interpreter (usually either “/usr” or “/usr/local“), and create a “install.log” file listing all the files that are created there. The command “python -c 'import sys; print sys.prefix'” will tell you where your Python interpreter is installed, we assume “/usr/local” here.

____
   1 If you want to install the current development version from CVS, replace “/tmp” with your “moin” working directory.

 

Creating a wiki instance

You could run your wiki directly using the sample wiki created in “/usr/local/share/moin“, but this is not recommended for two reasons:

  1. updating your wiki is more complicated and more dangerous.
  2. creating a second wiki instance, even if you currently don’t plan for one, is much easier.

We need to know what user and group your Apache server runs on, so issue this command:

jh@localhost:~ > egrep "^User|^Group" /etc/httpd/httpd.conf
User wwwrun
Group nogroup

This shows a typical result “wwwrun.nogroup“, which we will use later on.

To create an instance named “mywiki“, enter these commands on a root shell prompt:

cd /usr/local/share/moin 
mkdir mywiki 
cp -r data mywiki 
cp cgi-bin/* mywiki 
chown -R wwwrun.nogroup mywiki 
chmod a+rx mywiki/*.cgi 

mywiki” is the name of your wiki instance, you might want to chose a different name best fitting the intended use of this instance; just don’t name it simply “wiki“, because that would result in problems later on.

Then, append these lines to “/etc/httpd/httpd.conf“:

Alias /wiki/ "/usr/local/share/moin/htdocs/" 
ScriptAlias /mywiki "/usr/local/share/moin/mywiki/moin.cgi" 

The first line you only need once; the second line is needed once for each wiki instance (of course, each one with another wiki name and path).

That is all, restart your Apache server (“/etc/rc.d/apache restart” on SuSE) and try to access your new-born wiki with the URL “http://127.0.0.1/mywiki/“. You should see the FrontPage, try to edit and save it, and if that works, see if your edit is reflected on the RecentChanges page.

Finally, edit “moin_config.py” and at least change “sitename” and “logo_url” to some personal values:

sitename = 'My Wiki' 
logo_url = '/images/mywiki-logo.gif' 

For a personal or intranet installation, you’ll normally also add the line

allowed_actions = ['DeletePage', 'AttachFile'] 

 

Troubleshooting

The first thing to do when your wiki does not work as expected is to issue the command “tail /var/log/httpd/error_log” to display the most recent errors. Usually, you will get a hint on what went wrong, like missing file system permissions. Also, always consult the HelpOnInstalling/TroubleShooting page for further hints on your problem.

 

Dueling Pythons

The most common problem you might encounter is when you have Python 1.5.2 installed into “/usr“, and a newer Python distribution into “/usr/local“; this is typical for GNU/Linux distributions that still come bundled with version 1.5.2 of Python.

In that case, if you enter “python” on your prompt, you will usually get the more recent Python interpreter, because “/usr/local/bin” is in your PATH. The situation is different in your webserver environment, and thus you might have to change the bang path of “moin.cgi“, like this:

    1 #! /usr/local/bin/python
    2 
    3 """
    4     MoinMoin - CGI Driver Script
    5 ...
    6 """

 

Distutils does not work

If you have problems with the distutils install step, note that you need to have the Python development package installed on some Unix distributions. On Mandrake, you need to “rpm -i python-devel-2.1.1-3mdk.i586.rpm“.

 

Missing file permissions

If you are root, the installed files may be readable only by root, but they must also be readable by the web server before the wiki will work. This includes both the Python modules and the site itself. For the data directory, the web server also needs write access. To fix this, first find out where the Python module directory is; look in install.log, or run the command:

python -c "import sys; print '%s/lib/python%s/site-packages' % ( sys.prefix, sys.version[:3] )" 

For the example below, we’ll assume that the Python module directory is /usr/local/lib/python2.1/site-packages. Make the files world-readable using the following commands:

cd /usr/local 
chmod -R a+rX lib/python2.1/site-packages/MoinMoin share/moin 

/!\ Note that by making everything under /usr/local/share/moin world-readable, local users can read the files containing your wiki. You don’t really need to do that, since the mywiki directory is owned by the webserver. If you don’t want that, you do a “chmod -R o-rwx share/moin/mywiki” after the above commands.

 

Installation into your home directory

Installation into your shell account’s home directory is typically used on a host shared by many users and where you are not the root user. This usually implies that you cannot change the httpd.conf file, and also you cannot copy files into the machine’s cgi-bin and htdocs directories. For this situation, Apache includes the UserDir directive, which maps all URLs that start with “/~username” to a directory in your home directory, where you have write permissions and thus can install MoinMoin.

 

Making sure /~username URLs work

This kind of setup can only work if your webmaster has configured the host’s Apache server so that the UserDir mechanism works. Here’s how to check for this:

jh@localhost:~ > ls -ld public_html
drwxr-xr-x   2 jh       users          35 Jan 31 00:29 public_html

If this does not show a listing like above, then you might need to create the public_htmldirectory. Note that this directory must be readable (r-x) by the web server.

jh@localhost:~ > lynx -error_file=/dev/stderr -dump http://localhost/~jh/ >/dev/null
   URL=http://localhost/~jh/ (GET)
STATUS=HTTP/1.1 200 OK

You see here that we get a “200 OK” status response, which means that you can access your public_html area. If it does not work, you will probably get a “403 Forbidden” or a “404 Not Found” response. The first one normally indicates that you need to fix the permissions of your home directory (~) or your ~/public_html. But we also need to be able to execute CGI scripts, so we test that, too.

jh@localhost:~ > cat >~/public_html/test.cgi
#!/bin/sh
echo Content-Type: text/plain
echo
echo IT WORKS
<CTRL-D>
jh@localhost:~ > chmod a+rx ~/public_html/test.cgi
jh@localhost:~ > lynx -dump http://localhost/~jh/test.cgi
IT WORKS

If you see anything else than “IT WORKS“, then you are not allowed to execute CGI scripts. How you get that to work is not in the scope of this description, ask your webmaster!

A working Python installation, and a working diff command is also assumed.

jh@localhost:~ > python -V
Python 2.1
jh@localhost:~ > diff --version
diff - GNU diffutils version 2.7

(!) The command line examples show your input in bold typewriter, and the sample output in plain typewriter. The examples use “jh” as the user’s name, which means you have to replace your own one whereever “jh” appears. The same is true for version numbers (0.11) and download URLs.

 

Getting the distribution archive and doing the basic installation

The following commands will fetch and install the nightly CVS tarball, i.e. the current development version. To get the official distribution version, use an appropriate URL.

mkdir ~/tmp 
cd ~/tmp 
wget http://moin.sf.net/files/moin-0.11.tar.gz 
tar xfz moin-0.11.tar.gz 
cd moin-0.11 
python setup.py --quiet install --home=$HOME --record=install.log 

This will install the MoinMoin software into the directories “~/lib/python/MoinMoin“, “~/bin“, and “~/share/moin“. You’ll find a detailed file list in “install.log“.

 

Setting up a wiki instance

The next step is to create a copy of the wiki data and the config file.

mkdir ~/wiki 
cd ~/wiki 
cp ~/share/moin/cgi-bin/moin_config.py . 
cp -r ~/share/moin/data . 
chmod -R o+rwX data 
vi moin_config.py 

The last command starts the editor, you need to at least change the “data_dir” and “url_prefix” config values, as you can see in the following diff:

@@ -28,4 +28,4 @@ 
 interwikiname = None 
-data_dir = './data/' 
-url_prefix = '/wiki' 
+data_dir = '/home/jh/wiki/data/' 
+url_prefix = '/~jh/wiki' 
 logo_url = url_prefix + '/img/moinmoin.gif' 

 

Setting up public_html and testing the installation

Now we create the public part of the wiki, which is directly accessible by the web browser.

cd ~/public_html 
cp -r ~/share/moin/htdocs wiki 
cp ~/share/moin/cgi-bin/*.cgi . 
chmod a+rx *.cgi 

To be able to execute the CGI script in your home directory, you need to extend Python’s path within that script, and possibly adapt the bang path (that is the first line of the script). So, change “moin.cgi” similarly to this diff:

@@ -1,2 +1,2 @@ 
-#! /usr/bin/env python 
+#! /usr/local/bin/python2.1 
 
@@ -11,4 +11,4 @@ 
 
-#import sys 
-#sys.path.append('/usr/local/home/USERNAME/lib/python') 
+import sys 
+sys.path.extend(['/home/jh/wiki', '/home/jh/lib/python']) 
 

Finally, you can test your wiki installation by running the MoinMoin CGI Diagnosis:

lynx -dump http://localhost/~jh/moin.cgi?test 

And now, your wiki should work and is available at the URL “http://localhost/~jh/moin.cgi“. Conclude your tests by editing and saving the FrontPage and checking out RecentChanges, which should reflect that edit.


 


Windows Installation using Apache

Index

  1. Requirements
  2. Preparation
    1. Installing Apache
    2. Installing Python
    3. Installing MoinMoin
  3. Creating a Wiki Instance

 

Requirements

Before you install MoinMoin, make sure you have the necessary infra-structure in place, namely the Apache for Microsoft Windows webserver, and a Python installation (version 2.0 or higher is recommended, don’t run 1.5.2 without a compelling reason).

In the following description, we assume that you have installed or will install things to these locations:

  • C:\Apache – the webserver
  • C:\Python – the Python interpreter
  • C:\Moin – MoinMoin itself

Quite often, you might want to install things elsewhere, which is no problem at all; you just have to adapt any paths that appear in a command or config file to the locations you have chosen.

This installation procedure was tested with Apache 1.3.23 for Windows running on Windows/NT4SP6a, and using Python 2.0.

 

Preparation

 

Installing Apache

You currently need an external webserver to run MoinMoin, the recommended option is to use Apache if you haven’t installed one on your machine already. To install Apache, consult the Using Apache With Microsoft Windows document. Make sure that your webserver runs without problems before you start to install MoinMoin; problems with your webserver installation are not in the scope of this document.

 

Installing Python

Download Python 2.1.2 and install it. Python installation is done via a standard Windows installer program, which you should be familiar with.

 

Installing MoinMoin

Before creating a wiki instance, you have to download and install the basic MoinMoin software. We assume you already have downloaded the distribution archive to the “C:\TEMP” directory1.

Open a console window and enter the following commands:

C: 
cd \temp 
unzip moin-0.11.zip 
cd moin-0.11 
python setup.py install --prefix=C:\Moin --record=install.log 

This will install all necessary files to the “C:\Moin” directory, and create a “install.log” file listing all the files that are created there.

____
   1 If you want to install the current development version from CVS, replace “C:\TEMP” with your “moin” working directory.

 

Creating a Wiki Instance

You could run your wiki directly using the sample wiki created in “C:\Moin“, but this is not recommended for two reasons:

  1. updating your wiki is more complicated and more dangerous.
  2. creating a second wiki instance, even if you currently don’t plan for one, is much easier.

So, enter these commands in a console window:

cd \Moin 
md mywiki 
md mywiki\data 
xcopy share\moin\data mywiki\data /E 
copy share\moin\cgi-bin mywiki 

mywiki” is the name of your wiki instance, you might want to chose a different name best fitting the intended use of this instance; just don’t name it simply “wiki“, because that would result in problems later on.

Next, start your editor and create the file “C:\Moin\mywiki\moin.bat” with the following content (remember to change any paths that are different with your setup):

@echo off 
set PYTHONPATH=C:\Moin 
C: 
cd \Moin\mywiki 
C:\Python\python.exe moin.cgi 

/!\ Python 2.2: Python 2.2 changed the installation layout to better fit the UNIX scheme. Because of this, you have to change the command setting the PYTHONPATH to “set PYTHONPATH=C:\Moin\Lib\site-packages“.

Then, append these lines to “C:\Apache\conf\httpd.conf“:

Alias /wiki/ "C:/Moin/share/moin/htdocs/" 
ScriptAlias /mywiki "C:/Moin/mywiki/moin.bat" 

The first line you only need once; the second line is needed once for each wiki instance (of course, each one with another wiki name and path).

That is all, restart your Apache server and try to access your new-born wiki with the URL “http://127.0.0.1/mywiki/“. You should see the FrontPage, try to edit and save it, and if that works, see if your edit is reflected on the RecentChanges page.

Finally, edit “moin_config.py” and at least change “sitename” and “logo_url” to some personal values:

sitename = 'My Wiki' 
logo_url = '/images/mywiki-logo.gif' 

For a personal or intranet installation, you’ll normally also add the line

allowed_actions = ['DeletePage', 'AttachFile'] 

 


Windows Installation using IIS

Index

  1. Requirements
  2. Preparation
    1. Installing IIS
    2. Installing Python
    3. Installing MoinMoin
  3. Creating a Wiki Instance
    1. Troubleshooting

 

Requirements

Before you install MoinMoin, make sure you have the necessary infra-structure in place, namely the Internet Information Services webserver (any version should be OK), and a Python installation (version 2.0 or higher is recommended, don’t run 1.5.2 without a compelling reason).

In the following description, we assume that you have installed or will install things to these locations:

  • IIS to its default location
  • C:\Python – the Python interpreter
  • C:\Moin – MoinMoin itself

Quite often, you might want to install things elsewhere, which is no problem at all; you just have to adapt any paths that appear in a command or config file to the locations you have chosen.

This installation procedure was tested with IIS 5 for Windows running on Windows 2000sp2, and using Python 2.2.

 

Preparation

 

Installing IIS

You currently need an external webserver to run MoinMoin.

From Microsoft: (http://www.microsoft.com/windows2000/en/server/iis/)

To install IIS, add components, or remove components:

Click Start, point to Settings, click Control Panel and start the Add/Remove Programs application. Select Configure Windows, click the Components button, and then follow the on-screen instructions to install, remove, or add components to IIS.

Make sure that your webserver runs without problems before you start to install MoinMoin; problems with your webserver installation are not in the scope of this document.

 

Installing Python

Download Python 2.1.2 and install it. Python installation is done via a standard Windows installer program.

 

Installing MoinMoin

Before creating a wiki instance, you have to download and install the basic MoinMoin software. We assume you already have downloaded the distribution archive to the “C:\TEMP” directory1.

Open a console window and enter the following commands:

C: 
cd \temp 
unzip moin-0.11.zip 
cd moin-0.11 
python setup.py install --prefix=C:\Moin --record=install.log 

This will install all necessary files to the “C:\Moin” directory, and create a “install.log” file listing all the files that are created there.

____
   1 If you want to install the current development version from CVS, replace “C:\TEMP” with your “moin” working directory.

 

Creating a Wiki Instance

You could run your wiki directly using the sample wiki created in “C:\Moin“, but this is not recommended for two reasons:

  1. updating your wiki is more complicated and more dangerous.
  2. creating a second wiki instance, even if you currently don’t plan for one, is much easier.

So, enter these commands in a console window:

cd \Moin 
md mywiki 
md mywiki\data 
xcopy share\moin\data mywiki\data /E 
copy share\moin\cgi-bin mywiki 
copy share\moin\htdocs\index.html mywiki\default.htm 

mywiki” is the name of your wiki instance, you might want to chose a different name best fitting the intended use of this instance; just don’t name it simply “wiki“, because that would result in problems later on.

We have to make sure that moin.cgi can find the MoinMoin directory, so that “import MoinMoin” will work. You can either setup a PYTHONPATH environment variable which includes the installation path, but sometimes it can be tricky to make sure the variable will be set in the CGI environment. The easiest way to make sure MoinMoin can be imported is to append to sys.path within moin.cgi.

You can change the first two lines of code in moin.cgi to something like this:

    1 import sys
    2 sys.path.append(r'C:\Moin')

Notice that we’re pointing to the directory which contains the MoinMoin directory, not the directory itself.

/!\ Python 2.2: Python 2.2 changed the installation layout. Because of this, you have to change the line of code given above to “sys.path.append(r'C:\Moin\Lib\site-packages')“.

Next, you’ll need to create two virtual directories in IIS. One for the shared data, and one for this specific wiki instance.

Go to Control Panel => Administrative Tools => Internet Information Service. Open up the tree to Default Web Site.

Right click on Default Web Site and choose New => Virtual directory. This will bring up a wizard with the manditory useless first screen, hit next. Enter “wiki” for the alias name and hit next. Browse to “C:\Moin\share\moin\htdocs” and hit next. Leave the Access permissions at their defaults and hit next. And now you’re done, hit finish!

Now follow the same steps, but set the alias to “mywiki” and the path to “C:\Moin\mywiki“.

Now you need to setup the ‘mywiki’ alias so that it will run Python to interpret .cgi files. Right click on your new ‘mywiki’ alias and choose Properties. On the first tab (Virtual Directory), click the Configuration button. The first tab is the App Mappings tab, which defines which programs to use for each file exetension. Click Add. Browse to your python.exe (probably something like c:\pythonXX\python.exe). Then add -u %s %s after the Python executable path. The Executable line will look something like this: C:\Python22\python.exe -u %s %s. In the Extension box enter .cgi with the begining period. Confirm that the Check that file exists option is not checked (if it is, MoinMoin won’t be able to display sub pages). Ok, you’re done with the alias configuration, click OK several times to get back out of all the dialog boxes.

If you add another wiki instance, you’ll only need to setup the reference to its folder, they can safely share the “wiki” alias which points to static files only.

That is all, try to access your new-born wiki with the URL “http://127.0.0.1/mywiki/“. You should see the FrontPage, try to edit and save it, and if that works, see if your edit is reflected on the RecentChanges page.

Finally, edit “moin_config.py” and at least change “sitename” and “logo_url” to some personal values:

sitename = 'My Wiki' 
logo_url = '/images/mywiki-logo.gif' 

For a personal or intranet installation, you’ll normally also add the line

allowed_actions = ['DeletePage', 'AttachFile'] 

 

Troubleshooting

If you see an error like “ImportError: No module named MoinMoin“, it means that python cannot find MoinMoin. See above for how to set your PYTHONPATH or add to sys.path.