This HTML page contains the basic install docs that can be found on http://master.moinmo.in/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
This page describes the installation procedure of MoinMoin. 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. If you already have a wiki running and want to upgrade, see HelpOnUpdating.
A MoinMoin installation is done by some elementary steps:
Basic Installation explains the "setup.py" step of the installation in more detail. This is used to get the MoinMoin code and wiki template installed onto your system. This applies equally to all scenarios, and you should read it before trying a live installation.
Wiki Instance Creation explains how you make a new wiki instance (data and configuration), this is also common to all scenarios.
Getting the web server to serve static stuff under the url_prefix_static URL - used for theme CSS and images, etc. - this is slightly different for the various web servers that can be used - see below.
Getting the web server to execute the moin code when you access wiki pages. This is done either by CGI, FastCGI, mod_python or Twisted or the built-in stand alone server - this is slightly different for the various web servers that can be used - see below.
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.
Trouble-shooting helps with fixing any general problems you might encounter, which apply to any installation platform.
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:
How to do a basic installation of MoinMoin on your system.
Contents
Before you can integrate MoinMoin into your web environment, you have to install the MoinMoin source code and data files using the standard Python distutils mechanism (setup.py). This page explains the steps you usually need to take to do this. For more details on the distutils installation process, consult the Installing Python Modules document in your Python documentation set.
The installation is similar on Windows and Linux (and other POSIX-type systems; for simplicity, we just say "Linux" in the docs).
We use text such as > command arguments to show what you have to type at the command prompt (also known as shell, terminal, etc.). In our examples "> " is the prompt, you don't have to type it in, you have to type what comes after it. Lines that do not begin with "> " are the answers to the commands you have typed. Read them carefully.
Check if Python is working
MoinMoin needs Python to run, so the first step is to check if an usable version of Python is installed and correctly set-up. If this is not the case, you will have to fix that before you can proceed.
The CHANGES file in the MoinMoin archive mentions what versions are supported. Python 2.3 is the minimum requirement for MoinMoin 1.7, but we suggest you use the latest Python release version.
You can download Python at http://www.python.org/download/.
If you are pretty sure an acceptable version of Python is installed but the commands below do not work, this may be because your Python files are not in the search path. Correctly setting the search path is outside the scope of this document; please ask for help on your favorite Python, Linux, or Windows discussion board.
If you have shell access, checking if Python is working is very simple. Just type the following command, and look at the result:
> python -V Python 2.4.4
If you don't have shell access, you can try using this pythontest.cgi script (it assumes that you are using a Linux kind of webserver). Upload the script to your cgi-bin directory, use chmod a+rx pythontest.cgi (or a similar command in your FTP program) to make it executable, and invoke it using your web browser.
If it doesn't display "CGI scripts work", well, then CGI scripts don't work. If it doesn't show one or more Python version numbers, then Python is not correctly installed. In both cases, before you can proceed, you will have to get in touch with the administrator of the server so that the problems get corrected.
Also be sure to read ../ApacheOnLinuxFtp after you've completed the ../BasicInstallation illustrated here.
Download MoinMoin
To download the distribution archive, go to the download page and fetch the latest archive.
The next step is to unpack the distribution archive (which you have done already if you are reading this text from your hard drive). If you read this on the web, the distribution comes in a versioned .tar.gz archive, which you can unpack as shown below.
On Windows
On Linux
You can use your favorite file manager -- it should be able to unpack them.
At any shell prompt, you can use the tar command.
The distribution archive will always unpack into a directory named moin-<version>, for example moin-1.7.0.
Here is how you would unpack the archive (using GNU tar) and enter the directory with the MoinMoin files:
> tar xzf moin-1.7.0.tar.gz > cd moin-1.7.0
Install MoinMoin
You can install MoinMoin to either:
a system location (if you have the necessary rights to do that -- on Linux you need to be root)
some specific location, like your home directory (Linux) or C:\moin (Windows).
The installation to a system location is easier, so choose that if possible.
If you have several versions of Python installed, please use the same version for setup and for running the wiki. Usually, the latest Python version will get the best results.
Recommended installation command for Linux (and MacOs X)
As you have chosen to not use a preconfigured package for your system this time it is highly recommended that you do not install MoinMoin into the default location. This is because otherwise, if you later want to install a moin package of your distribution this will overwrite your existing installation. The most common path for your own installations is below /usr/local (this is called the PREFIX). A command that should be ok for most Linux distributions and also MacOS X is
> python setup.py install --prefix='/usr/local' --record=install.log
This will install the shared files to '/usr/local/share/moin' and the moin code to /usr/local/lib/python2.x/site-packages/MoinMoin/.
Debugging setup process
If you have problems with the setup.py install step, try using the command:
> python -v setup.py --quiet install --record=install.log
The additional -v flag should provide you detailed verbose messages every step of the way.
On Linux, if you get an error like Invalid Python installation: cannot find /usr/lib/Python2.x/config/Makefile, you may not have the python module distutils installed, it's usually a part of the Python development libarary (python-dev). Some Linux distributions may not have installed it by default. For example, on Mandrake you need to install the python-devel package, on Debian it's called python-dev.
Installing to the default system location
> python setup.py --quiet install --record=install.log
This installs MoinMoin to the default system location (typically the Python directory, for example on Linux, inside /usr/lib/python2.x/site-packages/MoinMoin and /usr/share/moin). Look at the install.log file to see what was installed, and where.
Installing in the home directory or another specific location
Linux example, installing in the home directory:
> python setup.py --quiet install --prefix=$HOME --record=install.log
Windows example, installing in the C:\moin directory:
> python setup.py --quiet install --prefix="C:\moin" --record=install.log
All MoinMoin files will then be installed inside those directories, see install.log to know which files were installed, and where.
Note: 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, or it won't find the MoinMoin code.
For example, if you are running using a webserver and standard CGI, edit moin.cgi and add your installation directory to the Python path, like this:
import sys sys.path.insert(0, 'C:/moin')
Test installation
As a final step, if you have access to the shell or the command prompt, you can check that everything is correctly installed and ready to run. Start Python and type import MoinMoin. Nothing should be displayed in response to this command. Example:
> python Python 2.4.4 (...) Type "help", "copyright", "credits" or "license" for more information. >>> import MoinMoin >>>
If you get this instead:
>>> import MoinMoin Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: No module named MoinMoin >>>
then you have to tune your installation. Try modifying sys.path, as described above.
What has been installed
So, you have a ready-to-work MoinMoin installation now. Congratulations! Before you go on to configuring it, take a look at the various files and directories that have been installed.
It is important that you understand the different locations used in a MoinMoin setup, so read this carefully.
In the following descriptions, PREFIX is what you used with the setup.py command, or a default location if you didn't use the --prefix option. (Typical default values on Linux are /usr and /usr/local.) X.Y is the version of Python. Typically, this is 2.3, 2.4 or 2.5.
Look into install.log to find out about following important locations:
MoinMoin directory, usually PREFIX/lib/pythonX.Y/site-packages/MoinMoin -- this is where the MoinMoin source code is located
share directory, usually PREFIX/share/moin - this is where the templates are located
data directory (wiki pages, users, etc.) - only MoinMoin should access this
underlay directory (wiki pages) - only MoinMoin should access this
htdocs directory with html support files (images for the various themes, etc.) - the web server will need to access this
server - MoinMoin example startup files (like moin.cgi for CGI, and other files for other startup methods)
config - MoinMoin example configuration files (like wikiconfig.py)
bin directory with some scripts that help you use the MoinMoin shell commands
We talk of templates in the share directory because you usually will not use those files at that location, but copy them elsewhere when you need them. This way, you can set-up several wikis without problems, and easily upgrade to new MoinMoin versions.
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 independent 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.
Linux users can use createinstance.sh (a bash script that creates the instance) instead of doing all steps manually:
If anything is unclear, just read the sections below for more hints.
Have a look into the script before running it, if all settings are correct for your setup:
USER and GROUP should be the user and group used by your web-server for running moin.
SHARE is where the shared files were copied to, see install.log from the setup.py install step
The script takes a single parameter: the location of your wiki instance (see "Choose a location" section below):
# ./createinstance.sh /path/to/mywiki
Now continue in section "Tune configuration"
Read this first
Security warnings
|
|
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.
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
INSTANCE is the directory containing the wiki instance. It cannot be an existing directory readable through Apache, otherwise it will fail.
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 to 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
Note that you just need to keep one underlay directory on your system if you are running multiple wikis (e.g. in a farm.)
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 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.
|
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. Installations on other Unices like FreeBSD are very similar.
On this page two installation scenarios are discussed:
You have Administrator Rights (you are user 'root' or may use sudo) for a server and are able to install and modify files almost anywhere on the machine, and notably able to modifiy the Apache configuration.
You are a Simple User, only able to write files into your home directory, and unable to alter the master Apache configuration file.
The following options are not mentioned here:
using suEXEC
using FastCGI (see ../FastCgi)
using mod_python (see ../ApacheWithModPython)
setting up a Root Wiki (see HelpOnConfiguration/ApacheVoodoo)
For more advanced configurations and some tricks see also HelpMiscellaneous.
Table of contents
Administrator Scenario
The exact location of the various Apache configs varies - often used locations are: /etc/httpd/, /etc/apache/ or /etc/apache2/. You should have at least some know-how of how to set up and deal with Apache, especially when it comes to virtual host setup. If you do not know what we are talking about, please read about Configuration Files and Apache Virtual Host documentation in the Apache documentation.
On Apache2 it is quite usual to have a directory (like /etc/httpd/conf.d) for virtual hosts. So every file ending with .conf will be included into the main Apache configuration file. To look if this is true for your configuration, search for the word "Include".
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", "apache.apache" 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, '..')
An even better way is to use the absolute path 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 depending on 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 /moin_static160/ (in the URL - see also url_prefix_static configuration variable) to the htdocs directory (in the share directory, as discussed at the bottom of ../BasicInstallation). Please note that url_prefix_static will change with every moin release!
A ScriptAlias 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 /moin_static170/ \"$SHARE/htdocs/\"" >>/etc/httpd/httpd.conf > echo "ScriptAlias /mywiki \"$WIKILOCATION/$INSTANCE/cgi-bin/moin.cgi\"" >>/etc/httpd/httpd.conf
So this would add two lines like the both below to a config file (possibly you use one for each virtual server):
Alias /moin_static170/ /usr/local/share/htdocs/ ScriptAlias /mywiki /usr/local/share/moin/mywiki/cgi-bin/moin.cgi
You only need to define the Alias for htdocs once, no matter how many wikis you run with the 1.6.0 version of moin. You need to define a different script alias for each wiki instance you intend to run. So you could also define the Alias in a central Apache configuration file and only define the ScriptAlias in virtual host configurations.
Configure MoinMoin
Finally, check that the wikiconfig.py file in the instance directory contains correct paths for:
url_prefix_static (static stuff like css/img/js)
data_dir (the instance data directory) and
data_underlay_dir (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! Better 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/' # better use absolute path
data_underlay_dir = '../underlay/' # better use absolute path
url_prefix_static = '/moin_static160' # depends on moin versionThere 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:
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 some wiki page - read it.
Then go to the WikiSandBox page.
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.
Simple User Scenario
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 into the "public_html" directory. Just use this:
> cd ~/public_html > cp -R ~/share/moin/htdocs moin_static170 > chmod -R a+rX moin_static170
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.4') sys.path.insert(0, '/home/mm/lib/python2.4/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.4" 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 parentheses. This will let MoinMoin generate URLs that start with /mywiki and not the path that the webserver passed to MoinMoin:
def handle_request(req, env, form):
request = RequestCGI(req, env, form, properties = {'script_name': '/mywiki'})
request.run()
Configure MoinMoin
Finally, check that the wikiconfig.py file in the instance directory contains correct paths for url_prefix_static (the htdocs directory), data_dir (the instance data directory) and data_underlay_dir (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! It is better to 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/moin_static170'
Test the wiki
Everything should work fine, now. It is time to perform the following steps:
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 some wiki page - read it.
Now go to the WikiSandBox page.
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 or Lighttpd
FastCGI is a method which enables a web server 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.
Follow the basic installation for your operating system as described in other parts of the MoinMoin installation documentation. This is HelpOnInstalling/BasicInstallation and HelpOnInstalling/WikiInstanceCreation, or HelpOnInstalling/ApacheOnLinux in most cases.
Using MoinMoin with FastCgi
For more general information:
http://fastcgi.com - FastCGI Homepage
FastCGI — The Forgotten Treasure (introduction)
Deploying on Apache
To deploy MoinMoin using FastCGI you need an apache with mod_fastcgi. Please refer to the documentation of mod_fastcgi ( mod_fastcgi homepage ).
Don't forget to install the fastcgi Apache module (e.g. libapache2-mod-fastcgi). Then 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 (check your distributions and/or 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!
Script options
No matter how and where you install or how you configure, you can add some options (in Apache config or as self-running process). Here is a list of some options.
FastCgiExternalServer
-host [hostname:port] - The port and on what host name to respond. -idle-timeout [seconds] - The number of seconds of inactivity allowed before request is aborted.
FastCgiServer
-port [port] - The port the application will use for communication with the web server. -idle-timeout [seconds] - The number of seconds of inactivity allowed before request is aborted.
Example for Apache2 on Debian
Edit the /etc/apache2/conf.d/your_wiki:
<IfModule mod_fastcgi.c> AddHandler fastcgi-script .fcgi .fcg FastCgiServer /your/path/to/moin.fcg -idle-timeout 60 -processes 1 ScriptAlias /your_wiki "/your/path/to/moin.fcg" </IfModule>
number of processes depends on your hardware..
Expand the Apache installation:
apt-get install libapache2-mod-fastcgi a2enmod fastcgi apache2ctl graceful
Now, your wiki should respond a little faster.
Running as an external application and/or on Windows
(see also ../ApacheOnWin32withFastCgi for a Windows-specific how-to)
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:
Select a port number for the internal communication. It should be larger than 1023. For this example, we chose 8888 (just for fun).
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
Edit moin.fcg. Replace
fcg = thfcgi.FCGI(handle_request, max_requests=max_requests, backlog=backlog, max_threads=max_threads)
with
fcg = thfcgi.FCGI(handle_request, 0, 8888, max_requests=max_requests, backlog=backlog, max_threads=max_threads)
Start the file moin.fcg manually like a Python script:
python moin.fcg
Start Apache.
Fallback to CGI if FastCGI is not available
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.
Deploying on lighttpd
This is about running a wiki under "/" URL with lighttpd.
The moin.fcg processes will get spawned by lighttpd automatically (thus, if you want to restart moin, just restart lighttpd).
It will also take care about handling robots.txt and favicon.ico correctly.
First add fastcgi and rewriting support to your lighttpd.conf (if you don't already have it):
server.modules = (
"mod_access",
"mod_rewrite", # <--- IMPORTANT!
"mod_status",
"mod_fastcgi", # <--- IMPORTANT!
"mod_accesslog",
"mod_redirect",
"mod_auth",
"mod_expire",
)