This HTML page contains the basic install docs that can be found on http://moinmaster.wikiwikiweb.de/MoinMoin/InstallDocs. It contains all necessary information to get your wiki up and running, even without being online. If you have a permanent internet connection, you might want to browse the docs on the HelpOnInstalling page, which might contain more up-to-date information.

After following the procedures on this page, you should have a working wiki and can browse the rest of the online docs there.

How to install your own MoinMoin Wiki

如何安装自己的WIKI系统

这篇文章就是描述这样建立自己的WIKI系统,moinmoin1.1版本以上,这下一部分,将让你懂得如何在不同的环境下安装, #基本安装安装细节部分

This page describes the installation procedure applying to MoinMoin version 1.1 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.

Please make sure that you do not accidently put your wiki's data/ directory under a directory directly accessible by your web server (like below document root). Or at least forbid your web server serving anything below data/ to a user - this is neither needed nor wanted! Your web server needs to serve moin.cgi and the stuff below htdocs only.

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:

Windows:

Mac OS X:

Long-Running-Process Setup:

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-1.1. To download the distribution archive, go to the download area.

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-1.1.zip
        cd moin-1.1
        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/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.



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

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 a file system layout with:

  • /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 "/tmp" 注1.

Open a shell and enter the following commands:

cd /tmp
tar xzf moin-1.1.tgz
cd moin-1.1
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.

`FootNote [top]
  • 注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 (usually "/etc/init.d/apache restart") 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 an old Python version installed into "/usr", and a newer Python distribution into "/usr/local"; this is typical for GNU/Linux distributions that still come bundled with an old Python version.

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:

#!/usr/local/bin/python

"""
    MoinMoin - CGI Driver Script
...
"""

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.x.x-xmdk.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.3/site-packages. Make the files world-readable using the following commands:

cd /usr/local
chmod -R a+rX lib/python2.3/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 is also assumed.

jh@localhost:~ > python -V
Python 2.3

(!) The command line examples show your input after the prompt (jh@localhost:~ >). 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 (1.1) and download URLs.

Doing the basic installation

The following commands will fetch and install a moin tarball. Use an appropriate URL to the version you want to install.

mkdir ~/tmp
cd ~/tmp
wget http://moin.sf.net/files/moin-1.1.tar.gz
tar xfz moin-1.1.tar.gz
cd moin-1.1
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.png'

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.3

@@ -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

Requirements

Before you install MoinMoin, you must have the necessary infrastructure in place. This procedure explains the steps necessary to install the infrastructure and provides detailed instructions for the installation of MoinMoin.

Downloading and installing all of the required components will require almost 100 MB of disk space. The table below shows the approximate sizes of the various components.

Product

Download MB

Installation MB

Apache

5

20

Python

10-15

40-60

win32all

4

20

MoinMoin

0.5

10

Many users prefer to install software products in a folder other than the installation default. Python typically changes the default installation folder name with each point release, and Apache has changed the default installation folder name with the release of version 2. Instead of enumerating all the possibilities at each step, this procedure will use the Reference name in the table below as the installed location for each product. Substitute your real installation location when editing configuration files and entering commands.

Reference

Product

Installation Default or Typical Name

C:\Apache

Apache

C:\Program Files\Apache Group\Apache2

C:\Python

Python

C:\Python22

C:\Moin

wiki instances

C:\My Documents\Moin

This installation procedure was tested with Apache 1.3.26 and Apache 2.0.44 for Windows running on Windows/ME, and using Python 2.1, 2.2 and 2.3a.

Preparation

MSI Installer

Installation of Apache and one alternative distribution of Python require the Microsoft MSI Installer. The latest version, 2.0, was released in September of 2001. You will know you don't have the correct version if you receive errors after double-clicking on a file name ending in .msi. To get the latest version, go to http://www.microsoft.com/, search for msi installer, and follow the instructions. There are two versions, one for Windows/ME, 98, and 95; and another for Windows 2000 and NT. Windows/XP has the 2.0 version and requires no update.

WinZip, unzip, ...

MoinMoin is distributed in a zipped format for Windows users. Some versions of Windows are distributed with an unzip utility, many other Windows users rely on WinZip, a popular shareware program, available from http://www.winzip.com/. There are many alternative compression utilities that are compatible with the .zip format. Since the .zip format is so commonly used for downloaded files, this procedure assumes you have a zip utility and know how to use it. If not, download WinZip or an alternative and review the instructions.

WinCVS, TortoiseCVS, or Neither

Because development snapshots of the Nightly CVS tarball and Stable CVS tarball of MoinMoin are now downloadable directly from SourceForge, few users will need to install a CVS utility. In general, the latest MoinMoin release will be the most stable and best documented choice for new users, Stable CVS should be trouble free and may have useful new features but may lack corresponding documentation, and Nightly CVS should be chosen only if you are a Python programmer and want to help test freshly coded features.

CVS utilities are discussed here only because they are uncommon in the Windows environment, and many Windows users may not be familiar with them. If you intend to modify MoinMoin source code to add your own new features, then you may want to consider installing a CVS utility. CVS utilities allow you modify your local MoinMoin source code and automatically merge your changes with changes made by other developers when you update your local copy of the MoinMoin source code from the CVS Head. Even better, if you wish to submit your nifty new feature to the MoinMoin developers for inclusion in a future MoinMoin release, you can create a patch of your enhancement that a MoinMoin developer can easily install and test on their own local copy of the MoinMoin source.

If you are unfamiliar with CVS or are not a Python programmer, your choice for now should definitely be Neither. You can always revisit this step later. While either CVS utility is easy to install, you should expect to spend a few days learning CVS concepts.

WinCVS is probably the most widely installed CVS utility. You can read more about it in MoinMoinWinCvs.

TortoiseCVS is an add-on component for Microsoft's Windows Explorer. It works by changing the icons used for CVS-related folders and files and adds entries to the Windows Explorer menus. One advantage of TortoiseCVS for one-person development shops is that it can create and update a CVS repository for your own development projects. WinCVS requires a separate CVS repository utility to function and there are few/none available for Windows. You can learn more about TortoiseCVS at http://www.tortoisecvs.org/. Don't be confused by the alternative TortoiseSVN product -- you will need TortoiseCVS.

With either WinCVS or TortoiseCVS, you can install MoinMoin directly from your \CVSRoot\moin folder, just follow the installation instructions below as if you unzipped the current release into that folder. Note there is a potential problem if you instruct WinCVS to mark files with the Read-Only attribute. The setup program will not work correctly the second time you try to reinstall MoinMoin from \CVSRoot\moin because it will fail while attempting to overwrite the Read-Only files from the prior installation.

Installing Apache

To obtain the latest version of Apache, go to http://www.apache.org/, and click on the link to HTTP Server. Find the link to download the Win32 Binary (MSI Installer) version. Read the Apache documentation to determine the correct installation procedure for your situation. Questions and problems with the Apache installation process should be resolved through use of the resources provided by the Apache organization. Be sure your webserver runs correctly before proceeding.

Warning: the procedure described above tends to trivialize the installation of the Apache web server. Apache can be installed and running on your PC in a very few minutes with only a cursory examination of the Apache documentation. Before you undertake the installation of any web server that can be accessed through the internet, you should exercise a controlled level of paranoia and assess the potential damage that may be caused by hackers accessing or destroying sensitive data. This should include not only the all data which resides on the PC which will host the Apache web server, but all other PCs on the local LAN which participate in any form of file sharing.

Windows/ME, 98SE, 98, 95, and probably NT should be considered inappropriate hosts for any Apache web server that can be accessed via the internet. Use either Windows/2000 or XP and install all security patches available for your operating system.

Do not let the above discourage you from installing MoinMoin. Most of the internet activity probing your system for weaknesses will be from virus infected Windows/NT systems running IIS whose owners have neglected to apply available security patches. The starting Apache configuration is secure and you will not have a problem provided you:

  • Regularly review and apply security patches for your installed software.
  • Understand the ramifications of any changes you make to the Apache config files.
  • Regularly review the Apache logs for suspicious activity.
  • Regularly take backups of your data.

Installing Python

There are currently two different distributions of Python available for Windows. The normal Python distribution is available from http://www.python.org. This is distributed as a windows executable (.exe) file.

An alternative distribution called ActivePython is available from http://www.activestate.com. This distribution uses the MSI Installer and contains some tools specific to the Windows operating system and a popular Windows IDE called Pythonwin. ActivePython is available for free; an email address is requested (but not required) before downloading.

MoinMoin will work with either distribution, but requires Python release 2.0 or later. Download and install the distribution of your choice. Questions and problems dealing with the Python installation process should be resolved through the use of resources provided by Python.org or ActiveState. Be sure your Python installation is correct before proceeding.

For file locking, you will also need to download and install the Win32 extensions for Python (aka win32all). Choose the version matching the Python version you are using. The alternative ActivePython distribution discussed above include these extensions.

Installing MoinMoin

Download the current version of MoinMoin from http://moin.sourceforge.net/ into C:\TEMP or an alternative location. Be sure to choose the version in the .zip format rather than the .tgz or .tar.gz format. (If you have decided to install either the stable CVS tarball or nightly CVS tarball for some reason that makes sense to you, your zip utility may be able to read the .tar.gz format. If not, try WinZip.)

Using your favorite unzip utility discussed above, unzip the MoinMoin distribution file into the same folder. You should then have a folder C:\TEMP\moin-x.x where "x.x" is the current release number. This folder will contain a setup.py file in addition to several other files and subfolders.

Open an MS-DOS or console window and enter the commands:

C:
cd \TEMP\moin-x.x
C:\Python\python setup.py install --record=install.log

The above commands will add MoinMoin to your C:\Python installation and create an install.log file in C:\temp\moin-x.x listing all the copied files. You may use Windows Explorer to examine the newly created folders within C:\Python. You should find a C:\Python\share\moin folder with subfolders cgi-bin, data, and htdocs. If you have Python 2.0 or 2.1 you will find a folder C:\Python\MoinMoin, but with Python 2.2 and later it will be C:\Python\Lib\site-packages\MoinMoin. The MoinMoin folder contains many Python scripts and several subfolders.

You are now ready to create a wiki instance.

Creating a Wiki Instance

It is a good practice to try to keep all of your personal or site specific data under a few root folders. This way you can easily backup your important data on a regular basis without having to waste time either backing up static files or picking out dozens of important folders scattered throughout your folder structure. You should avoid placing your wiki data under the C:\Python folder so that you can later upgrade Python or MoinMoin without accidentally overwriting or deleting your wiki data. For the same reason, you probably don't want to place your wiki data within the C:\Apache folder. The default personal folder under many Windows versions is called C:\My Documents.

Choose a location appropriate for you; the following instructions assume you will be creating one or more wiki instances in C:\Moin\ and the first wiki instance will be named mywiki.

You may replace the name mywiki with almost any name you wish, but do not use wiki because that is used by MoinMoin for loading standard images and style sheets. Although this can be changed later, the plan is that the name you choose for mywiki will become part of the url used to access your site, e.g. http://myorganization.org/mywiki/FrontPage.

Start an MS-DOS or console window and enter the commands below. This will create a clone of the MoinMoin wiki in the mywiki folder. The wikidata folder will be used later for mywiki customization, such as logos and style sheets.

cd C:\ 
md Moin
md Moin\wikidata
md Moin\mywiki
md Moin\mywiki\data
cd \Python\share\moin
xcopy data        C:\Moin\mywiki\data /E
copy  cgi-bin\*.* C:\Moin\mywiki\*.*

If your server is going to run multiple wikis, you need to create additional clones. The commands below will create mywiki2. The wikidata folder created above can contain custom logos and style sheets for all your wikis.

cd C:\ 
md Moin\mywiki2
md Moin\mywiki2\data
cd \Python\share\moin
xcopy data        C:\Moin\mywiki2\data /E
copy  cgi-bin\*.* C:\Moin\mywiki2\*.*

Use your editor to edit the file C:\Moin\mywiki\moin.cgi. Change the first line (the shebang statement) to point to your local Python executable program. Note the forward slashes -- Apache uses the Unix convention for folder separators. This tells Apache the moin.cgi file is an executable script that will be interpreted by a program to be loaded from C:/Python/python.

#! C:/Python/python

The next step is to tell Apache that is has more work to do. Use your editor to append the following lines to C:\Apache\conf\httpd.conf. Note the presence and absence of trailing slashes, it is important to enter the lines exactly as shown below.

Alias       /wiki/     "C:/Python/share/moin/htdocs/"
Alias       /wikidata/ "C:/Moin/wikidata/"
ScriptAlias /mywiki    "C:/Moin/mywiki/moin.cgi"

The Alias lines for wiki and wikidata above instructs Apache to serve images, style sheets, etc. from the specified folders and subfolders. The ScriptAlias line is needed once for each wiki instance, so if you have multiple wikis, repeat the statement using mywiki2, mywiki3, etc. The ScriptAlias statement instructs Apache to execute scripts from the specified folder. See the Apache docs for a complete explanation.

Test your changes by restarting your Apache server and try to access your newborn 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, verify your edit is reflected on the RecentChanges page.

Finally, edit C:\Moin\mywiki\moin_config.py and at least change sitename to the name of your wiki:

sitename = 'My Wiki'

If you want to replace the MoinMoin logo with one named mywikilogo.gif, copy your logo to C:\Moin\wikidata and change logo_url in moin_config.py as follows:

logo_url = '/wikidata/mywikilogo.gif'

For a personal or intranet installation, you'll normally also add this line to moin_config.py:

allowed_actions = ['DeletePage', 'AttachFile']

Additional configuration details can be found in HelpOnConfiguration.

And now, it is up to you and your user community to transform your wiki into an informative and useful tool. You will probably want to retain most of the HelpOn~ pages dealing with editing, delete those pages with irrelevant information (like this page, don't let your users or boss know how easy it was to install MoinMoin ;) ), and rewrite the FrontPage to introduce your wiki topic.

Troubleshooting

The first place to look for clues when the unexpected happens is to try changing your url to: http://127.0.0.1/mywiki?test. If Apache can find and execute the module C:/Moin/mywiki/moin.cgi, a page of diagnostics titled MoinMoin CGI Diagnosis will be displayed. Check the output for error messages.

The second place to look for is C:\Apache\logs\error.log. The following are common errors grouped by the message displayed by your browser.

Internal Server Error

If the Apache log shows a message "The system cannot find the file specified." then a possibility is the shebang statement in moin.cgi is incorrect.

If the Apache log shows a different error message, then the MoinMoin Python scripts may be abending. To determine the cause, you could try temporarily renaming moin.cgi to moin.py, loading moin.py with the Python idle IDE and executing it to determine if there are any error messages.

Not Found

If the Apache error log shows the message "File does not exist: C:/Apache/htdocs/mywiki", the ScriptAlias statement in httpd.conf may be incorrect.

The Page Cannot be found

If the Apache error log shows the message "File does not exist: C:/Apache/htdocs/????", you may have mistyped the url "http://127.0.0.1/mywiki" into your browser.

FrontPage Loads Without Icons

If the Apache Error log shows many error messages "File does not exist: C:/Apache/htdocs/wiki", then the Alias statement in httpd.conf may be incorrect.



Windows Installation using IIS

Index

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.3 or higher is recommended, don't run 2.0/2.1 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.3.2 and install it. Python installation is done via a standard Windows installer program.

For file locking, you will also need to download and install the Win32 extensions for Python (aka win32all). Choose the version matching the Python version you are using.

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" directory注1.

Open a console window and enter the following commands:

C:
cd \temp
unzip moin-1.1.zip
cd moin-1.1
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.

`FootNote [top]
  • 注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\Lib\site-packages')

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

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']

IIS 6.0 (Windows.NET Server 2003)

The instructions below also apply to IIS 6.0 but the more aggressive security settings in newer version of IIS disallow the usage of unknown CGI extensions. That means you will always get a 404 error unless you do this:

  1. Open "Internet Information Services (IIS)" in the control panel.
  2. Go the the "Web Service Extensions" folder.
  3. There you will see "All Unknown CGI Extensions" is probably set to "Prohibited". Make it "Allowed" and MoinMoin should now work.

At the time I'm writing this, I'm running Windows.NET Standard Server 2003 _RC1_. It may be different in later version. But if you get a 404 error on moin.cgi after following the regular steps, double-check that setting. -- FrancoisDenisGonthier

Enabling "All Unknown CGI Extensions" can be a security hole. To just enable Python CGI scripts, add and enable a new web service extension where the 'required files' exactly match the path plus arguments as described above (e.g. C:\Python22\python.exe -u %s %s). You cannot have any spaces in the path to python.exe. There are also permission issues related to the user executing the moinmoin code (access to cmd.exe) which I have not yet sorted through. -- mb

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.



Mac OS X Installation using Apache

installing MoinMoin on OS X

An install report of a succesfull install on a powermac G4 running mac OS X 10.2.6. In the examples you will see that the machine name is pm142 and the administrator account is giels. The wiki site that is created is called mgwiki.

before you begin

  • You should have activated the root user

  • You must not be afraid to use the terminal ;)

  • some practice with the pico editor might be useful as well

download

Download the source on the desktop: you should see a moin-x.x.tar.gz file. Extract this file on the desktop with Stuffit. You will get a folder moin-x.x.

install

All code examples are taken form a terminal session.

First check everything:

[pm142:~] giels% su root
Password:
[pm142:/Users/giels] giels# whoami
root
[pm142:/Users/giels] giels# python -c 'import sys; print sys.prefix'
/usr
[pm142:/Users/giels] giels# 
[pm142:/Users/giels] giels# cd Desktop/moin-1.0
[pm142:giels/Desktop/moin-1.0] giels# ls -al
total 264
drwxr-xr-x  15 giels  staff    510 May 10  2002 .
drwxr-xr-x   9 giels  staff    306 May 12 19:39 ..
-rw-r--r--   1 giels  staff  19118 May 10  2002 CHANGES
-rw-r--r--   1 giels  staff  17992 Jun  9  2001 COPYING
-rw-r--r--   1 giels  staff  42827 May  9  2002 INSTALL.html
-rw-r--r--   1 giels  staff    837 Feb 27  2002 MANIFEST.in
drwxr-xr-x  37 giels  staff   1258 May 10  2002 MoinMoin
-rw-r--r--   1 giels  staff    553 May 10  2002 PKG-INFO
-rw-r--r--   1 giels  staff   5831 Apr 17  2002 README
-rw-r--r--   1 giels  staff    908 Jan 16  2002 TODO
drwxr-xr-x   5 giels  staff    170 May 10  2002 contributions
-rw-r--r--   1 giels  staff  13878 Jul  5  2001 moinlogo.bmp
-rw-r--r--   1 giels  staff    229 Jul  5  2001 setup.cfg
-rw-r--r--   1 giels  staff   6586 May  9  2002 setup.py
drwxr-xr-x   5 giels  staff    170 May 10  2002 wiki
[pm142:giels/Desktop/moin-1.0] giels#

the real install:

[pm142:giels/Desktop/moin-1.0] giels# python setup.py install --record=install.log 
running install
running build
running build_py
creating build
....
creating /usr/share/moin/htdocs/applets
creating /usr/share/moin/htdocs/applets/TWikiDrawPlugin
writing list of installed files to 'install.log'

Now installation is finished. You will find a file install.log on the desktop in the folder moin-x.x.

configuration

First make a copy of the original MoinMoin site:

[pm142:giels/Desktop/moin-1.0] giels# 
[pm142:giels/Desktop/moin-1.0] giels# egrep "^User|^Group" /etc/httpd/httpd.conf
User www
Group www
[pm142:giels/Desktop/moin-1.0] giels# cd /usr/share/moin/
[pm142:/usr/share/moin] giels# ls -al
total 0
drwxr-xr-x   5 root  wheel   170 May 12 19:49 .
drwxr-xr-x  44 root  wheel  1496 May 12 19:49 ..
drwxr-xr-x   4 root  wheel   136 May 12 19:49 cgi-bin
drwxr-xr-x   9 root  wheel   306 May 12 19:49 data
drwxr-xr-x   6 root  wheel   204 May 12 19:49 htdocs
[pm142:/usr/share/moin] giels# 
[pm142:/usr/share/moin] giels# mkdir mgwiki
[pm142:/usr/share/moin] giels# cp -r data mgwiki
[pm142:/usr/share/moin] giels# cp cgi-bin/* mgwiki
[pm142:/usr/share/moin] giels# chown -R www.www mgwiki
[pm142:/usr/share/moin] giels# chmod a+rx mgwiki/*.cgi
[pm142:/usr/share/moin] giels# 

Configure Apache. We'll use the pico editor:

[pm142:/usr/share/moin] giels# pico /etc/httpd/httpd.conf

Scroll to the end of the file and edit like the example below, (only the last two lines are added; use control-x to save the file):

RegisterDefaultSite
</IfModule>

Include /private/etc/httpd/users

Alias /wiki/ "/usr/share/moin/htdocs/"      
ScriptAlias /mgwiki "/usr/share/moin/mgwiki/moin.cgi"       


^G Get Help   ^O WriteOut   ^R Read File  ^Y Prev Pg    ^K Cut Text   ^C Cur Pos    
^X Exit       ^J Justify    ^W Where is   ^V Next Pg    ^U UnCut Text ^T To Spell   

Restart Apache:

[pm142:/etc] giels# apachectl help
usage: /usr/sbin/apachectl (start|stop|restart|fullstatus|status|graceful|configtest|help)

start      - start httpd
stop       - stop httpd
restart    - restart httpd if running by sending a SIGHUP or start if 
             not running
fullstatus - dump a full status screen; requires lynx and mod_status enabled
status     - dump a short status screen; requires lynx and mod_status enabled
graceful   - do a graceful restart by sending a SIGUSR1 or start if not running
configtest - do a configuration syntax test
help       - this screen

[pm142:/etc] giels# 
[pm142:/etc] giels# apachectl graceful
/usr/sbin/apachectl graceful: httpd gracefully restarted
[pm142:/etc] giels# 

testing

In a web-browser surf to the site: pm142/mgwiki

Comments

Here are a couple of issues with my Mac OS X install I needed to fix:

  1. The TWiki drawing jar file is not installed, so drawings do not work. You have to find the twikidraw.jar file (download the latest stable MoinMoin tar.gz file and uncompress like: tar xzvf moinmoin.tar.gz), and copy the twikidraw.jar file (under htdocs/applets/TWikiDrawPlugin) to this folder /usr/share/moin/htdocs/applets/TWikiDrawPlugin/. You'll probably need to use sudo:
    sudo cp twikidraw.jar /usr/share/moin/htdocs/applets/TWikiDrawPlugin/
    and set permissions:
    sudo chmod 755 /usr/share/moin/htdocs/applets/TWikiDrawPlugin/twikidraw.jar

  2. The RSS feed for your RecentChanges page may be broken. You need to install the most recent version of PyXML. Here's how I did so and the RSS feed was fixed.
    curl -O http://aleron.dl.sourceforge.net/sourceforge/pyxml/PyXML-0.8.3.tar.gz
    tar xzvf PyXML-0.8.3.tar.gz
    cd PyXML-0.8.3
    sudo python setup.py --without-xpath build
    sudo python setup.py install

OS X users with a fink install need to chance the path /usr/share/moin to /sw/share/moin. see install.log.



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!



mod_python Setup using Apache

Using MoinMoin with apache + 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 by your apache server!

/!\ 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 will be fixed in the next releases, as they promised. The sample files use a wrapper to get around this bug, so there is no need to worry.

Deploying MoinMoin with mod_python

Follow the basic apache installation for your operating system as described in other parts of the MoinMoin installation documentation. Don't copy moin.cgi, cause you won't need it. Be sure that the apache process can access the wiki data files (check User and Group in your apache.conf).

Copy the sample moin_modpy.htaccess as .htaccess to the path below which your wiki instance should be found:

cd /usr/local/share/moin
cp wiki/cgi-bin/moin_modpy.htaccess /path/to/your/docroot/.htaccess

Check the .htaccess that the PythonPath matches your installation. It should contain the path where the moin_modpy.py wrapper is installed (Note: the wrapper does not have to be within your DOCROOT). You can also change the name of your instance (<Files wikiname>).

Check sys.path of moin_modpy.py. It needs to find the MoinMoin package (not needed if MoinMoin is installed system wide) and your moin_config.py.

In some cases you need to restart apache after changes to py files used by mod_python. Please refer to the mod_python documentation.

Fixing the mod_python bug

/!\ If you did use the wrapper setup from the previous section, you don't need to do this.

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. You have two possibilities to live with it: either use the wrapper script moin_modpy.py or fix the bug.

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

This bug is currently in all versions of mod_python (2.7.10, 3.0.4, 3.1.2b) and should be fixed in newer mod_python versions (bug and patch are reported to the mod_python development list). Please read the changelog of mod_python to be sure that you have a fixed version, or verify the lines on your own!

Deploying with a fixed mod_python

/!\ This section only works with a fixed mod_python (see previous section)!

Follow the deployment documentation above. Use the special commented out section of moin_modpy.htaccess instead of the default wrapper using part.

Check the PythonPath in the .htaccess that it matches your installation. It should contain the python lib path where the MoinMoin package is stored (not needed if MoinMoin is installed system wide) and the path to your moin_config.py.

The wrapper script moin_modpy.py is not needed, cause the RequestModPy class is used directly by mod_python.



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. ;)

Deploying MoinMoin with Twisted

First install twisted (see URL above). Many Linux distributions have twisted packages. Please refer to the documentation of twisted how to install it.

Now see wiki/cgi-bin/moin_twisted.sh - maybe you have to slightly adapt the command in there.

Also check wiki/cgi-bin/moin_twisted.py - change the settings in the upper script section to fit your needs.

After setting up your own data directory somewhere, try starting moin_twisted.sh - your wiki should be running now.