This site best when viewed with a modern standards-compliant browser. We recommend Firefox Get Firefox!.

Linux-HA project logo
Providing Open Source High-Availability Software for Linux and other OSes since 1999.

USA Flag UK Flag

Japanese Flag

Homepage

About Us

Contact Us

Legal Info

How To Contribute

Security Issues

This web page is no longer maintained. Information presented here exists only to avoid breaking historical links.
The Project stays maintained, and lives on: see the Linux-HA Reference Documentation.
To get rid of this notice, you may want to browse the old wiki instead.

1 February 2010 Hearbeat 3.0.2 released see the Release Notes

18 January 2009 Pacemaker 1.0.7 released see the Release Notes

16 November 2009 LINBIT new Heartbeat Steward see the Announcement

Last site update:
2017-12-13 05:49:22

这个HTML页面包含基本的安装文档,其英文文档保留在http://moinmaster.wikiwikiweb.de/MoinMoin/InstallDocs。它包含有WIKI的安装、运行的所有必要的信息,甚至不必在线就可看到。假如你永久的连接到Internet,那么你可以在安装页面的帮助目录看到这些最新的文档。

遵照这个页面的安装步骤执行之后,你的WIKI就能正常运行并且能浏览在线文档的其他部分。

怎样来安装你自己的 MoinMoin wiki

这个页面描述了MoinMoin的安装步骤。在下一节,将有具体环境中的安装简介,那会帮助你理解怎样把这些指令应用到各个不同的环境中去。假如你已经有了一个正在运行的Wiki想升级,请看 HelpOnUpdating。 一个MoinMoin的安装过程可以分为以下几个基本的步骤:

  • 基本安装详细解释了安装过程中的"'setup.py'"步骤。它被用来把MoinMoin代码和Wiki的模板安装到你的系统中。这可以应用到所有的情况下,因此在你尝试安装之前应该阅读它。

  • Wiki 实例的创建解释了你怎么来创建一个Wiki实例(数据和配置文件),这对所有的情况都是适用的。

  • 当你打开Wiki页面时,让你的WEB服务器执行moin代码。在以CGI, FastCGI, mod_python or Twisted or the built-in stand alone server 等方式运行时需要去做。---根据你运行的WEB服务器的不同而稍微有些区别-请看下面。
  • 在成功安装之后,作为一个Wiki管理员,你可能想了解更多的配置和其它的选项。HelpOnAdministration包含有指向这些主题的链接。特别的是MoinMaster:HelpOnAdministration 页面提供关于Wiki设置和维护的附加的信息。

  • Trouble-shooting帮助你解决一些常见的问题,可能在一些安装平台上遇到的。

Installation steps specific for some web servers and operating systems

The following links will show you concrete examples of installation sessions, showing the commands used and explaining what they do. You must first read the general information on installing above before doing the installation steps described on the pages linked from below:

Linux:

Long-Running-Process Setup:

Mac OS X:

Windows:

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.


After you have downloaded and installed MoinMoin, you will want to "have a wiki". As explained at the bottom of ../BasicInstallation, you have to copy several directories and files. This way, you can have as many wikis as you want, and you can easily upgrade MoinMoin: only the original files will be overwritten, not your copies.

Every time you copy those files (and modify the configuration of your server accordingly), you create what is called a wiki instance. Each wiki instance is independant from the others, with a different configuration, different pages, different users, etc.

Some of the steps you need to take depend on which web server and which operating system you use. They are described on dedicated pages, which you should read (at least the beginning) before reading this one. Some other steps are common to every webserver and operating system (copying files around, setting permissions), and this is what is described here.

Read this first

Security warnings

/!\ Warning: make sure that your data directory and your configuration files are not accessible through your web server. Do not put your wiki directory in public_html, Sites or any other directory your web server can access. The web server only needs to access the file in the htdocs directory and the moin.cgi script! (Or whatever script your server uses to start MoinMoin.)

/!\ Warning: make sure that the data directory and its subdirectories are not readable and not writeable by users other than the web server user. If you need to give worldwide read-write permissions to get it working, be aware that you are doing a very unsecure setup, that can be compromised by any other user or program on your computer.

Note to Windows users

All the commands below are Linux commands. The text descriptions that introduce them should be enough to help you understand what you need to do. Use the Windows Explorer, or the appropriate text-mode commands.

Choose a wiki name

Choose a unique name for the new wiki instance you want to create. It should be a short word, something that reflects what you intend to use the wiki for, like the name of your organization, of your team, of the project you are working on, etc.

  • <!> Do not use the name "wiki" - it is reserved for internal use. You would need a special setup to use this with CGI, and you can't use it at all with standalone or twisted server.

The name "mywiki" is used as an example in the various commands below.

Choose a location

Choose a directory on your disk, it will contain all the files needed for your wiki instance. At the beginning, your wiki instance will use approximately 10 MB of disk space. Then of course, it will grow depending on the way your wiki is used. A personal wiki, even with many pages, might only use 30 MB or 40 MB of disk space. A popular wiki, or a wiki with many files attached to the pages, might use much more, of course.

If you are the administrator (or root) of the server, you can use anything you like or that makes sense to you, for example /usr/local/var/moin, /mnt/wikis, etc.

If you are a simple user, you will probably only be allowed to write in your personal, "home" directory. Choose a subdirectory that makes sense to you, for example the share/moin subdirectory.

Collect some important information

This is where the instructions differ according to the web server and operating system you use, and whether you are the administrator or a simple user. See the appropriate pages for your web server and operating system combination.

On Linux, the export command will be used to remember the collected information. Windows users should write it down carefully (maybe cutting-and-pasting in a Notepad window), or store it in environment variables if they use the command prompt.

  • PREFIX is the prefix you used during the ../BasicInstallation

  • SHARE is the name of the share directory, as discussed at the bottom of ../BasicInstallation

  • WIKILOCATION is the name of the directory that will contain your wiki instance

If you are an administrator, you also need to collect the following:

  • USER is the user name of the web server

  • GROUP is the name of the group to which the web server belongs

Now, Linux folks, let's store these settings in memory:

> export PREFIX=/usr                # this might be something else
> export SHARE=$PREFIX/share/moin   # this should be correct for most people
> export WIKILOCATION=$SHARE        # this is just an example
> export INSTANCE=mywiki            # this is just an example

Administrators also need the following two lines:

> export USER=www-data              # this is just an example
> export GROUP=www-data             # this is just an example

Copy the files

To create your new instance, you first need to create a directory named like your instance, inside the WIKILOCATION. Then you need to copy the data and underlay directories from your SHARE directory into your instance directory. Finally, you need to copy the wikiconfig.py file from the config directory into the instance directory.

Linux folks need just type these commands:

> cd $WIKILOCATION
> mkdir $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 permissions

Administrators

Administrators need to restrict the permissions of the files, so that only the web server (and the administrator of course) can read and write them. For maximum security, no other user on the machine should be able to read or write anything in the wiki instance directory. Don't forget that this directory contains sensitive information, notably the (encrypted) passwords of the wiki users.

On Linux, the following commands should be enough:

> 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

Normal users

Normal users, on the contrary, need to broaden the permissions of the files, so that the web server can read and write them. On recent Windows versions, and on some versions of Unix, Linux and other systems, access control lists can be used to that effect. They are, however, powerful and complicated, much beyond the scope of this document. Ask a knowledgeable person about them.

Without them, normal users have to allow everybody to access the instance directory. This is the only way the web server can enter it and do its work. This is, of course, VERY INSECURE, since any other user and program on the server can read the directory. You should not use such a setup for a wiki open to the public.

On Linux, the following commands will open the instance directory to the whole world:

> chmod -R a+rwX $INSTANCE

Note:

  • it is also possible to put the web server and the normal user in the same group, and then only open the instance directory to the members of that group. This is a bit more secure (depending on who else is in the group), but you need the cooperation of the server administrator; he is the one setting up groups.

  • the best other possibility is that the server administrator sets up suexec to execute CGI scripts in user directories under the user id of that user. You don't need to give world permissions that way, so it is a quite secure setup, but you also need cooperation of the administrator.

Tune configuration

Now, you need to tune the configuration of your web server and of your wiki instance. Look at the appropriate help page for your web server, then come back here to tune the settings of your wiki instance.

Edit wikiconfig.py. The default settings should work fine in most cases, but there are some things that you will probably want to change, like the name and logo of your wiki! :) Read the comments inside wikiconfig.py, they will guide you through this process. (Start with "Wiki identity", around line 25.)

HelpOnConfiguration contains all the details about all the options, in case the comments in wikiconfig.py are not enough.


Linux Installation using Apache

This page describes the particular steps that need to be taken to create a wiki instance using MoinMoin on Linux with the Apache web server. You should have already performed the ../BasicInstallation.

Two scenarios are possible. You might be the administrator (root) of the server, able to install and modify files almost anywhere on the machine, and notably able to modifiy the Apache configuration. You might also be a simple user, only able to write files into your home directory, and unable to alter the master Apache config file. The two scenarios are discussed below.

Table of contents

Contents

  1. Administrator (root)
    1. Create a wiki instance
    2. Install moin.cgi
    3. Configure moin.cgi
    4. Configure Apache
    5. Configure MoinMoin
    6. Test the wiki
    7. Apache tricks
  2. Simple user (home directory installation)
    1. Make sure /~username works
    2. Create a wiki instance
    3. Install the htdocs files
    4. Install moin.cgi
    5. Configure moin.cgi
    6. Configure MoinMoin
    7. Test the wiki
  3. Troubleshooting
    1. Adding permission to serve the htdocs directory

Administrator (root)

Most GNU/Linux distributions come with Apache pre-installed. There is, however, some variation as to where exactly the various Apache files are located. You should consult your distribution manual, or ask on the appropriate discussion board. In the following paragraphs, we assume a (quite standard) file system layout with:

  • /etc/httpd/httpd.conf - the main Apache configuration file

  • /var/log/httpd/error_log - the log file containing Apache error messages

Some distributions use apache instead of httpd for the directory names, others may use weirder settings.

Create a wiki instance

Creating a wiki instance involves copying files around and setting appropriate permissions. Before you can proceed, you need to know what user and group your Apache server runs as. The easiest way to know this is to issue this command:

> egrep "^User|^Group" /etc/httpd/httpd.conf
User wwwrun
Group nogroup

This shows a typical result: "wwwrun.nogroup". Other common results are "nobody.nogroup" and "www-data.www-data". You can of course use your own. What matters is that you know which ones are in use, because you will need them to set file permissions.

Once you have gathered this information, read ../WikiInstanceCreation and follow the steps described there.

Install moin.cgi

There is one last file you need to copy, the bridge between Apache and MoinMoin: the CGI script that Apache will call every time a wiki page is requested, and that will in turn invoke all the MoinMoin components to handle the request. You can actually put this script anywhere you like (all the paths to the files MoinMoin needs can be configured to match your filesystem layout), but for the sake of simplicity and security, we suggest you follow the instructions below, unless you think you know better.

We will create a cgi-bin subdirectory in the instance directory. Using the environment variables defined in ../WikiInstanceCreation, run the following commands:

> cd $WIKILOCATION/$INSTANCE
> mkdir cgi-bin
> cp $SHARE/server/moin.cgi cgi-bin
> chown -R $USER.$GROUP cgi-bin
> chmod -R ug+rx cgi-bin
> chmod -R o-rwx cgi-bin

Configure moin.cgi

When moin.cgi is launched, it imports a MoinMoin module that in turn imports other modules and the configuration file. While the MoinMoin modules should always be found in a properly configured system (as described in ../BasicInstallation), it is likely that the configuration file will not be found. Edit the moin.cgi script to correct that. Add these lines near the top of the file:

import sys
sys.path.insert(0, '..')

You can also use the absolute name of the directory that contains the wikiconfig.py file instead of '..'.

Configure Apache

Now that every file is in place and properly locked down (as far as the filesystem is concerned), we need to configure Apache so that it offers access to the right files, and no others. However, since the default Apache configuration varies a lot according to the distribution you use, and since administrators often make important additions and changes to it, we cannot give exact instructions that cover all cases. Instead, we will first describe roughly what needs to be done, and then give a few specific lines that you should add at the appropriate place in your Apache config.

Your Apache should be set up so that:

  • Access to your instance directory is denied (sane Apache installations should actually deny access to the whole server, and then only allow a few specific directories).
  • An alias is set up to redirect requests from /wiki/ (in the URL) to the htdocs directory (in the share directory, as discussed at the bottom of ../BasicInstallation)

  • A script alias is set up to redirect requests from whatever you want (we suggest you use your instance name, for example /mywiki) to the CGI script you just copied.

The following commands will add two lines at the bottom of your Apache config file. These lines only cover the last two items listed above. You have to check the first one by yourself (there is too much variation in Linux distributions). Note that you may have to move the two lines to the appropriate place in your config file -- maybe near other similar lines.

> echo "" >>/etc/httpd/httpd.conf
> echo "Alias /wiki/ \"$SHARE/htdocs/\"" >>/etc/httpd/httpd.conf
> echo "ScriptAlias /mywiki \"$WIKILOCATION/$INSTANCE/cgi-bin/moin.cgi\"" >>/etc/httpd/httpd.conf

You only need to define the alias for htdocs once. You need to define a different script alias for each wiki instance you intend to run.

Configure MoinMoin

Finally, check that the wikiconfig.py file in the instance directory contains correct paths for the htdocs prefix, the instance data directory, and the instance underlay directory. You can use relative paths for the directories, but note that they are relative to the CGI script, not the configuration file! You can also use absolute paths, and save yourself some headaches.

Here are the settings you should have in the config file if you followed all our suggestions:

    data_dir = '../data/'
    data_underlay_dir = '../underlay/'
    url_prefix = '/wiki'

There are other settings you will likely want to alter, look at the bottom of ../WikiInstanceCreation for more details about them.

Test the wiki

Everything should work fine now. It is time to restart the Apache server (usually with "/etc/init.d/apache restart", sometimes with "apachectl restart") and perform the following steps:

  • Run the MoinMoin CGI Diagnosis: connect to "http://127.0.0.1/mywiki?action=test" (or the name and port you have defined in the Apache configuration file). Verify that the displayed information is correct. Check that the directories listed under Checking directories... are OK.

  • Access your new wiki with the URL "http://127.0.0.1/mywiki/" (or the name and port you have defined in the Apache configuration file). You should see the FrontPage.

  • If this is the case, try to edit it and save your changes.
  • If that works, see if your edit is reflected on the RecentChanges page.

  • If you see them, congratulations, your new wiki works! :)

If something goes wrong, have a look at Troubleshooting, at the bottom of this page.

Apache tricks

For more advanced configuration and some tricks see HelpMiscellaneous.

Simple user (home directory installation)

On machines shared by many people, simple users typically have no access to the root account, cannot modify the httpd.conf file, and cannot copy files into the system-wide cgi-bin and htdocs directories. In that case, Apache can be set up so that each user can host a web site in the home directory of his or her shell account, using the UserDir directive. If the machine administrator decides to use it, all URLs that start with "/~username" will be redirected to a directory in the users' home directories, where they have write permission and can install MoinMoin.

As an example, we will consider the case of a user named "mm". Of course, wherever you see "mm" below, you will replace it with your own username.

Make sure /~username works

The home directory installation can only work if the administrator (root) has allowed it. So, the first step is of course to check that it works. Typically, Apache is set up so that the public_html subdirectory in the home directory is used as the web site root. So, the first first step is to check if that directory exists.

> ls -ld ~/public_html
drwxr-xr-x   2 mm       users        4096 Nov 30 00:29 public_html

If the directory does not exist, create it, and be sure it can be read and entered by the web server.

> mkdir public_html
> chmod a+rx public_html
> ls -ld ~/public_html
drwxr-xr-x   2 mm       users        4096 Nov 30 00:35 public_html

Now, check if the "/~mm" URL works:

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

If you get a "200 OK" response code, then it works, and you can go on to the next check. If you get a "403 Forbidden" or a "404 Not Found" response, then maybe something is wrong with your directory, or maybe the whole thing has not been enabled by your administrator.

  • Check the permissions for your home directory (~) and your public_html directory. The first one should at least end with "--x", and the second one, as we saw above, with "r-x".

  • It also possible that the administrator has set up another name for the personal web site directory. "public_html" is just the usual default, but anything can actually be used. There is no way to know, you have to ask the administrator (root).

  • Finally, if the personal web site feature is disabled, maybe you can ask the administrator to enable it?

Once you have checked you can read the files in the directory, you need to check that you are also able to execute CGI scripts in that directory. Use the following commands to create a simple CGI script in the appropriate location:

> mkdir -p ~/public_html/cgi-bin
> cat > ~/public_html/cgi-bin/test.cgi
#!/bin/sh
echo Content-Type: text/plain
echo
echo "CGI scripts work"
<CTRL-D>
> chmod a+rx ~/public_html/cgi-bin/test.cgi
> lynx -dump http://localhost/~jh/cgi-bin/test.cgi
CGI scripts work

If you get anything else than "CGI scripts work", then something went wrong. Check the directory permissions as above, try other names (or ask about them). The sad truth might be that you are not allowed to execute CGI scripts. You would then have to ask the administrator (root) for that permission.

Once you get it, you can set up your wiki instance in the public_html directory. :)

Create a wiki instance

Creating a wiki instance involves copying files around and setting appropriate permissions. Read ../WikiInstanceCreation and follow the steps described there.

Install the htdocs files

The web server needs to access these files, so we need to copy them in the "public_html" directory. Just use this:

> cd ~/public_html
> cp -R ~/share/moin/htdocs wiki
> chmod -R a+rX wiki

Install moin.cgi

There is one last file you need to copy, the bridge between Apache and MoinMoin: the CGI script that Apache will call every time a wiki page is requested, and that will in turn invoke all the MoinMoin components to handle the request. You need to put this file in a directory for which CGI scripts execution is enabled. By default, this should work:

> cd ~/public_html
> mkdir cgi-bin
> cp $SHARE/server/moin.cgi cgi-bin
> chmod -R a+rx cgi-bin

Configure moin.cgi

When moin.cgi is launched, it imports a MoinMoin module (that in turn imports other modules and the configuration file). Since everything has been installed in your home directory, it is likely none of these will be found. Edit the moin.cgi script to correct that. Add these lines near the top of the file:

import sys
sys.path.insert(0, '/home/mm/lib/python2.3')
sys.path.insert(0, '/home/mm/lib/python2.3/site-packages')
sys.path.insert(0, '/home/mm/share/moin/mywiki')

Of course, you need to adapt the paths to your situation. The first two lines should help locate the MoinMoin modules, the last one should help locate the wikiconfig.py file.

Note: You might also need to edit the first line of the file, to point to the correct version of Python. The default should be fine, but a line like "#! /usr/bin/python2.3" might help you if the default does not work.

Note 2: In this file there is a line reading request = RequestCGI(). If you have a complex mod_rewrite case, you might want to add properties = {'script_name': '/mywiki'}  in the parenthesis. This will let MoinMoin generate URLs that start with /mywiki and not the path that the webserver passed to MoinMoin.

Configure MoinMoin

Finally, check that the wikiconfig.py file in the instance directory contains correct paths for the htdocs directory, the instance data directory, and the instance underlay directory. You can use relative paths for the directories, but note that they are relative to the CGI script, not the configuration file! You can also use absolute paths, and save yourself some headaches.

    data_dir = '/home/mm/share/moin/mywiki/data/'
    data_underlay_dir = '/home/mm/share/moin/mywiki/underlay/'
    url_prefix = '/~mm/wiki'

Test the wiki

Everything should work fine, now. It is time to perform the following steps:

  • Run the MoinMoin CGI Diagnosis: > lynx -dump http://localhost/~mm/cgi-bin/moin.cgi?action=test

  • If it worked, try to access your new-born wiki with the URL "http://127.0.0.1/~mm/cgi-bin/moin.cgi". You should see the FrontPage.

  • If this is the case, try to edit it and save your changes.
  • If that works, see if your edit is reflected on the RecentChanges page.

  • If you see them, congratulations, you have a new wiki! :)

If something goes wrong, have a look at Troubleshooting, below.

Troubleshooting

See also ../TroubleShooting for generic stuff.

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.

Adding permission to serve the htdocs directory

In some (sane) Linux distributions (like SuSE 9.0) serving directories other than the document-root "/srv/www/htdocs" with Apache is switched off by default for security reasons in "/etc/httpd/httpd.conf" (or for Apache2 "/etc/apache2/httpd.conf"):

# forbid access to the entire filesystem by default
<Directory />
  Options None
  AllowOverride None
  Order deny,allow
  Deny from all
</Directory>

To allow Apache to serve directories outside of the document root you have to add these lines to "/etc/httpd/httpd.conf" (in SuSE it is recommended to create a new "http.conf.local" and include this file in "/etc/sysconfig/apache2"):

Alias /wiki/ "/usr/share/moin/htdocs/"
<Directory "/usr/share/moin/htdocs/>
   Order deny,allow
   Allow from all
</Directory>

ScriptAlias /mywiki "/usr/share/moin/mywiki/cgi-bin/moin.cgi"
<Directory "/usr/share/moin/mywiki/cgi-bin">
   Order deny,allow
   Allow from all
</Directory>

Of course, you need to adapt the paths to your particular situation.


FastCGI Setup using Apache

Using MoinMoin with apache + mod_fastcgi

FastCGI is a method which enables apache to communicate with long-running scripts. This has the advantage that the script is only started and initialized one time, and that data could be cached in memory from request to request, enhancing the performance of the CGI application.

Deploying MoinMoin with apache + mod_fastcgi

To deploy MoinMoin using FastCGI you need an apache with mod_fastcgi. Please refer to the documentation of mod_fastcgi how to build it.

Follow the basic apache installation for your operating system as described in other parts of the MoinMoin installation documentation. In places where the documentation refers to moin.cgi you use moin.fcg instead. Be sure that .fcg is handled by the FastCGI module (AddHandler fastcgi-script .fcg in your apache config).

Normally apache will start CGI scripts with its own user and group, or with the user and group of the VirtualHost if you are using the suexec wrapper. To enable this with FastCGI you need to use FastCgiWrapper On in your apache config (see FastCGI Documentation).

Be sure to restart your apache after you changed py files (i.e. the config) for a running FastCGI server, or you won't see any changes!

Running as an external application and/or on Windows

/!\ Experimental.

MoinMoin can be run as an external application that answers FastCGI request via a local TCP/IP socket. This works on Windows as well. All you need to do (after having installed mod_fastcgi and a working MoinMoin instance) is this:

  1. Select a port number for the internal communication. It should be larger than 1023. For this example, we chose 8888 (just for fun).
  2. Add the following lines to your httpd.conf:

    Alias /moin.fcg "/your/path/to/moin.fcg"
    FastCgiExternalServer "/your/path/to/moin.fcg" -host localhost:8888
    
  3. Edit moin.fcg. Replace

    fcg = thfcgi.THFCGI(handle_request)
    

    with

    fcg = thfcgi.THFCGI(handle_request, 0, 8888)
    
  4. Start the file moin.fcg manually like a Python script:

    python moin.fcg
    
  5. Start Apache.
  6. Enjoy MoinMoin running with FastCGI support!

Add a safe fallback

Install and test MoinMoin according to HelpOnInstalling/ApacheOnLinux. Then make and test the changes to run mod_fastcgi. If you are satisfied, you can add the following block to your apache config:

<IfModule !mod_fastcgi.c>
    ScriptAlias /mywiki "/your/path/to/moin.cgi"
</IfModule>
<IfModule mod_fastcgi.c>
    AddHandler fastcgi-script .fcg
    ScriptAlias /mywiki "/your/path/to/moin.fcg"
</IfModule>

Now Apache will use mod_fastcgi if available and otherwise use the slow cgi script.


mod_python Setup using Apache

Contents

  1. Why Use mod_python
  2. Basic configuring
    1. Install mod_python
    2. Set up a wiki instance
    3. Edit `wikiconfig.py`
    4. Changes to Apache `httpd.conf`
  3. Solving script_name problems
  4. Configuring root wiki
  5. Older mod_python versions
    1. Use a wrapper script
    2. Fix mod_python
  6. Troubleshooting

Why Use mod_python

mod_python embeds the python interpreter into the apache server. This saves initialization time and the need of forking cgi scripts. It doesn't have the ability to run as different users. It will always run as the main apache user and group. Be sure that your wiki data files are accessible and writable by your apache server.

<!> The basic configuration is suitable for mod_python 3.1.3 and later. If you use older version, see the section "Older mod_python versions"

<!> mod_python will cause your apache processes to increase their memory requirements considerably - especially as apache runs many separate processes which will each need to have their own copy of the python code and data in the process memory space. You may find that FastCGI, as detailed in HelpOnInstalling/ApacheWithFastCgi is rather more efficient in this respect.

Basic configuring

  1. Install mod_python
  2. Set up a wiki instance
  3. Edit wikiconfig.py

  4. Changes to Apache httpd.conf

  5. Restart Apache

The sample configurations below are for a wiki instance called mywiki installed in a directory /var/www/moin/mywiki with the main MoinMoin installation installed in python's default site library path. The wiki appears as URL /mywiki under the server - ie http://my.ser.ver/mywiki. You will need to change these to reflect your installation.

Install mod_python

Most people will just add a mod_python package to their current operating system installation. If you are building from source then you should consult the mod_python documentation.

The mod_python installation should have added some lines to the Apache configuration file - either in the file itself or in an included configuration file (for example on Red Hat or Fedora linux the mod_python configuration is in /etc/httpd/conf.d/python.conf).

Make sure you have this line in httpd.conf or mod_python will not work:

LoadModule python_module modules/mod_python.so

After this restart Apache and make sure that it starts successfully, and that the error log has a line similar to this:-

[Sat Jan 01 15:40:49 2005] [notice] mod_python: Creating 4 session mutexes based on 150 max processes and 0 max threads.

You may need to change some environment variables on (eg) FreeBSD - this is detailed in the port installation message.

Set up a wiki instance

This is done as shown in WikiInstanceCreation. Its recommended to first configure the wiki with cgi and check that it works, then change the configuratin to use mod_python. This allows you be sure that any problems are in the mod_python transition rather than the basic MoinMoin installation.

  1. Copy moin.cgi into your wiki directory
  2. Configure httpd.conf as cgi first:

    • Alias /wiki/ "/usr/share/moin/htdocs/"
      ScriptAlias /mywiki "/var/www/moin/mywiki/moin.cgi"
      

Restart Apache and make test that your wiki works.

Edit `wikiconfig.py`

Make sure you use only absolute paths - relative paths will not work!

data_dir = '/var/www/moin/mywiki/data/'
data_underlay_dir = '/var/www/moin/mywiki/underlay/'

Test that the wiki works after this change.

  • (!) In 1.2 and earlyer, the configuration file is called moin_config.py.

Changes to Apache `httpd.conf`

After you wiki is running as cgi script, conver it to run with mod_python.

If you run your wiki as cgi as we recommended before, remove or comment the ScriptAlias directive:

#ScriptAlias /mywiki "/var/www/moin/mywiki/moin.cgi"

Add a Location directive:

<Location /mywiki>
    SetHandler python-program
    # Add the path of your wiki directory
    PythonPath "['/var/www/moin/mywiki'] + sys.path"
    PythonHandler MoinMoin.request::RequestModPy.run
</Location>

If you have multiple MoinMoin instances then add one location directive for each one (changing the paths as appropriate).

If you did not install MoinMoin in the default location, you will have to add the path to MoinMoin to the system path:

    PythonPath "['/var/www/moin/mywiki', '/prefix/lib/python2.x/site-packages'] + sys.path"

Restart Apache - everything should now work correctly.

Solving script_name problems

On some installations, mod_python hands MoinMoin incorrect script_name and path_info. It usually happens when using the Apache Location directive, with a wiki in an arbitary path:

<Location /farm/mywiki>
    ...
</Location>

This will not work, because its not clear what is the script name, since with location setup, there is no real script.

To solve this problem, use a PythonOption directive:

<Location /farm/mywiki>
    # Location value must match the Apache Location value!
    PythonOption Location /farm/mywiki
    ...
</Location>
  • (!) New in release 1.3.5

Configuring root wiki

You may wish to have your wiki appearing at the root of your webserver - for example so that http://wiki.example.com/ will map to your wiki rather than having to use http://wiki.example.com/mywiki/. This requires a slightly different form of configuration using mod_rewrite - this is a standard module of recent Apache distributions, and is often enabled by default.

You need to set up your wiki instance as described above, and also copy moinmodpy.py from the Moin installation directory to the wiki instance directory (/var/www/moin/mywiki in these examples).

The Apache configuration needs mod_rewrite enabled - so the line

LoadModule rewrite_module modules/mod_rewrite.so

should appear in the first part of the httpd.conf configuration file.

The wiki and virtual host configuration sould look like this:-

<VirtualHost *:80>
  ServerAdmin postmaster@example.com
  DocumentRoot /var/www/html
  ServerName wiki.example.com
  Alias /wiki/ "/usr/share/moin/htdocs/"

  # Rewrite urls
  RewriteEngine On
  RewriteLogLevel 0
  # map /wiki static files to Moin htdocs
  RewriteRule ^/wiki/(.*)$ /usr/share/moin/htdocs/$1 [last]
  # map everything else to server script
  RewriteRule ^(.*)$ /var/www/moin/mywiki/moinmodpy.py$1

  <Directory "/var/www/moin/testwiki">
    # Modpy stuff
    AddHandler python-program .py
    # Add the path to the wiki directory, where
    # moinmodpy.py and wikiconfig.py are located.
    PythonPath "['/var/www/moin/mywiki'] + sys.path"
    PythonHandler moinmodpy
  </Directory>
</VirtualHost>

Apache should be restarted, and the FrontPage of mywiki should now appear at http://wiki.example.com/.

Other ways of handling root level wikis with Apache are detailed in the appropriately named HelpOnConfiguration/ApacheVoodoo.

Older mod_python versions

mod_python versions 2.7.10, 3.0.4 and 3.1.2b have a bug in apache.resolve_object. This bug was reported to the mod_python maintainers and has been fixed in the 3.1.3 release. The best fix for this is to update to the current release. However if you are unable to do this there are 2 possible solutions:

Use a wrapper script

MoinMoin come with a moinmodpy.py wrapper script, and this could be used by changing the PythonPath and PythonHandler directives as shown in the moinmodpy.htaccess file. The wrapper was named moin_modpy.py in MoinMoin 1.2.

Fix mod_python

mod_python has a small resolver bug in versions 2.7.10, 3.0.4 and 3.1.2b. The method resolve_object in mod_python/apache.py checks the wrong object, and so the lookup for RequestModPy.run fails.

To fix it you need to change the method resolve_object (around line 551 for mod_python 3.1.2b) from

        if silent and not hasattr(module, obj_str):
            return None

to

        if silent and not hasattr(obj, obj_str):
            return None

Troubleshooting

Page access gives apache error::

  • PythonHandler MoinMoin.request::RequestModPy.run: OSError: [Errno 2] No such file or directory: 'data/user' This appears to be caused by you not having an absolute path for data_dir in moin_config.py. There are several other lines of error traceback preceding this one in the apache error log. Fix the path in moin_config.py.


Setup using Twisted

Using MoinMoin with Twisted

Twisted is a standalone python framework for many kinds of applications. For MoinMoin, we use Twisted as a python web server that just imports MoinMoin persistently.

This has the advantage that the Python interpreter and all Python scripts (including Twisted itself and also MoinMoin) is only loaded and initialized one time, and that data can be cached in memory from request to request, enhancing the performance of MoinMoin.

Another advantage is that this is all based on Python. ;)

First do ../BasicInstallation and ../WikiInstanceCreation.

Install Twisted

First, install Twisted (see URL above). Many Linux distributions have Twisted packages. Please refer to the documentation of Twisted for installation information.

Configuring the Twisted server

Copy the file wiki/server/mointwisted.py to your wiki directory. Edit and adapt the settings to your needs.

System path configuration

If you did a standard install, and you are not a developer, you probably want to skip this section. Otherwise, you might want to add the path to moin and config file, like that:

sys.path.insert(0, '/path/to/moin')
sys.path.insert(0, '/path/to/wikiconfig')

Config class options

If you did a standard install, the default options might be just what you need. Check and change what you like:

Option

Default

Comment

docs

'/usr/share/moin/wiki/htdocs'

Path to moin shared files

user

'www-data'

If you run as root, the server will run as this user

group

'www-data'

If you run as root, the server will run as this group

port

8080

Port to serve. To serve a privileged port below 1024 you will have to run as root

interfaces

['']

A list of interfaces the server will listen to. If the list contains the entry '' (like for the default configuration), all other entries are ignored and the server will listen to all interfaces.

logPath

'mointwisted.log'

Log file.

profiler

commented python code

Useful only if you are a moin developer.

Configuring wikiconfig.py

The sample config file should be just fine.

Option

Default

Comment

url_prefix

'/wiki'

You should not change this, or images and css file will not be available to the wiki!

Starting the server on Unix

On GNU/Linux, Mac OS X or another POSIX-like OS, copy wiki/server/mointwisted to your wiki directory. You might want to adapt PYTHONPATH and the path to twistd.

Start the server with ./mointwisted start and test your wiki at http://localhost:8080/. Stop the server with ./mointwisted stop.

Starting the server on Windows

Copy wiki/server/mointwisted.cmd to your wiki directory. You might have to change the path pointing to the python-scripts directory.

Double click mointwisted.cmd to start the server. It will create a new terminal window. To stop the server, close the terminal window.


Linux Installation using standalone server

Installing and configuring standalone server

The standalone server is especially made for local wikis because it does not need a web server installed. Only Python and Moin are necessary!

To install and run the standalone server:

  1. If MoinMoin is not installed yet, preform ../BasicInstallation

  2. Create a wiki instance as described in ../WikiInstanceCreation

  3. Copy moin.py to your wiki directory, where your wikiconfig.py is

  4. If you installed with --prefix option, you must edit moin.py and set docs to the correct path.

  5. Run moin.py

  6. Access your wiki at http://localhost:8000/

On most cases, the default settings will be just fine. You many want to edit moin.py and change some of the options, as described in the next section.

Configuring moin.py

System path configuration

If you did a standard install, and you are not a developer, you probably want to skip this section. If not, you might want to add the path to moin and config file, like that:

import sys
sys.path.insert(0, '/path/to/moin')
sys.path.insert(0, '/path/to/wikiconfig')

Config class options

Option

Default

Comment

docs

'/usr/share/moin/wiki/htdocs'

Path to moin shared files. If you used --prefix install, the default path will not work, and you must set the path to 'PREFIX/share/moin/wiki/htdocs'.

user

'www-data'

If you run as root, the server will run with as this user

group

'www-data'

If you run as root, the server will run with as this group

port

8000

Port to serve. To serve privileged port under 1024 you will have to run as root

interface

'localhost'

The interface the server will listen to. The default will listen only to localhost. Set to '' to listen to all.

logPath

'moin.log'

Log file. Default is commented.

serverClass

'ThreadPoolServer', 'ThreadingServer', 'ForkingServer', 'SimpleServer'

The server type to use, see the comments in the moin.py. The default is 'ThreadPoolServer', which create a pool of threads and reuse them for new connections.

threadLimit

10

How many threads to create.

requestQueueSize

50

The count of socket connection requests that are buffered by the operating system.

  • (!) There may be more options useful to moin developers, see the comments in moin.py

Configuring wikiconfig.py

The sample config file should be just fine.

Option

Default

Comment

url_prefix

'/wiki'

You should not change this, or images and css file will not be available to the wiki!

Starting the server

Run moin.py from the command line:

$ ./moin.py
Serving on localhost:8000

Test your wiki at http://localhost:8000/

On Windows, you can double click moin.py to start the server. A new terminal window will be opened. Close the window or press Control + Pause to stop the server.

On Unix, interrupt the server with Control + C in order to shut it down.

Serving port 80 on Unix

On GNU/Linux, Mac OS X or other Posix like OS, you can serve the standard port 80 used for web serving, but you must run as root for this.

Set port to 80, and verify that user and group exists on your system. If not, set them to an existing user, meant for web serving. If needed, chown your wiki dir to this user and group.

Run moin.py as root:

$ sudo moin.py
Password:
Serving on localhost:8000
Running as uid/gid 70/70

Test your wiki at http://localhost/


Mac OS X Installation using Apache

You must not be afraid to use the terminal. It is possible but much harder to install without using the terminal.

There are 2 step in the installation:

  1. Install the MoinMoin engine - once

  2. Create wiki instance. You can create and serve as many wikis as you like.

Download

Download the source on the Desktop. You should see a moin-1.3.tar.gz file. Extract this file on the desktop with Stuffit Expander, or from the terminal (faster and safer):

cd ~/Desktop
tar -xzf moin-1.3.0.tar.gz

Installing MoinMoin

Use these commands in the terminal to install the MoinMoin wiki engine into the system.

First, open a shell as root. You will need this to install MoinMoin and configure the wiki. When asked, enter your password.

sudo -s
... password:

Now you have root privileges in this shell.

Install:

cd moin-1.3.0
python setup.py install --install-data='/usr/local'
  • (!) The --install-data='/usr/local' will put the shared data in the convenient '/usr/local/share/moin' folder. If you don't use it, your shared data will be at '/System/Library/Frameworks/Python.framework/Versions/2.3/share/moin'. On Mac OS X, '/usr' belong to Apple, and it is safer to install in '/usr/local'.

    (!) The default Python used by Apache is the framework one supplied by Apple. If you have added another Python version such as through DarwinPorts or Fink, then you should substitute "/usr/bin/python" for "python" above or you should substitute the specific path for the Python that will be used by Apache.

Now the installation is finished. You will not have to repeat this step unless you upgrade moin.

Creating a wiki

After you have installed the software, you need to create a wiki. You may create several wikis if you need.

Copying a template wiki

Copy a template wiki from the /usr/local/share/moin. Do not try to run the wiki from /usr/local/share/moin/data because your wiki will be overwritten when you install a new version of moin.

  • <!> Security warning: do not put your wiki folder where the web server can access it! Your wiki should not be at the "Sites" folder in your home folder.

The following instructions will create a wiki called "mywiki". You can choose any name you like, except the reserved name "wiki".

Do these commands:

cd /usr/local/share/moin
mkdir mywiki
cp -r data mywiki
cp -r underlay mywiki
cp server/moin.cgi mywiki
cp config/wikiconfig.py mywiki

Setting Permissions

You have to make the web server the owner of the files in your wiki. Unless you changed the default configuration, both are 'www'.

chown -R www:www mywiki
chmod -R ug+rwX mywiki
chmod -R o-rwx mywiki

Configure Apache

We'll use the pico editor:

pico /etc/httpd/httpd.conf

Go to the end of the Aliases section and edit like the example below:

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

Use Control+O to save the file and Control+X to exit pico.

Restart Apache - open System Preferences, go to the Sharing page, select "Personal Web Sharing" and click "Stop" then "Start". Or just type this instead:

apachectl graceful
... /usr/sbin/apachectl graceful: httpd gracefully restarted

Installation finished - exit from the shell with the root privileges - working as root is dangerous.

exit

Now you are running again safely.

Testing Your New Wiki

In a web-browser surf to the site: http://localhost/mywiki

You should see the FrontPage of your new wiki.

Now run the unit tests, to make sure everything is fine. Go to this address: http://localhost/mywiki?action=test

You should see a report on the wiki and tests results for the MoinMoin engine. If some of the tests fail, please report the problem on MoinMoinBugs.

Configuring Your wiki

The wiki you created is a new "Untitled Wiki", using the default configuration. You want to give a better name and setup some configuration values. Open wikiconfig.py and read the comments. You can edit the file with any text editor, like pico, emacs, or BBEdit.

  • (!) Note that the file belongs to user and group www:www. You can edit the file as root, or change the group of the file to yourself with chown www:username wikiconfig.py.

For more help on configuration, see HelpOnConfiguration.

Optional Installs

RSS

If you want your wiki to support RSS and Mozilla Firefox Live Bookmarks features, you have to install PyXML. Get PyXML from http://sourceforge.net/projects/pyxml/ and install according to the instructions.


Windows Installation using Apache

Index

Contents

  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

Contents

  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.


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.