MoinMoin/InstallDocsThis HTML page contains the basic install docs that can be found on . 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 WikiThis 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 systemsThe 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: Linux Installation using Apache Linux Installation using standalone server Long-Running-Process Setup: FastCGI Setup using Apache or Lighttpd mod_python Setup using Apache Setup using twisted Mac OS X: Mac OS X Installation using Apache Windows: Windows Installation using Apache Windows Installation using IIS How to do a basic installation of MoinMoin on your system.ContentsBefore 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 workingMoinMoin 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 . 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. pythontest.cgi 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 MoinMoinTo 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 You can use recent versions of programs like 7-Zip, WinZip, WinRar, and WinAce, which handle .tar.gz kind of archives. At the command prompt, you can use GNU gzip and GNU tar for 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 MoinMoinYou 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 processIf 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 locationLinux 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\', whichis not in Python's module search path (sys.path) -- you'llhave to change the search path yourselfThis 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: Test installationAs 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 "", 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 installedSo, 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): Now continue in section "Tune configuration" Read this firstSecurity 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 usersAll 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 nameChoose 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 locationChoose 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 informationThis 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 ../BasicInstallationSHARE is the name of the share directory, as discussed at the bottom of ../BasicInstallationWIKILOCATION 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 filesTo 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 permissionsAdministratorsAdministrators 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 usersNormal 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 configurationNow, 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. /!\Warning: don't forget to restart your web server in order to apply changes in wikiconfig.pyHelpOnConfiguration contains all the details about all the options, in case the comments in wikiconfig.py are not enough. Linux Installation using ApacheThis 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 suEXECusing 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 contentsAdministrator ScenarioThe 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 instanceCreating 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.cgiThere 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.cgiWhen 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: An even better way is to use the absolute path name of the directory that contains the wikiconfig.py file instead of '..'. Configure ApacheNow 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_static160/ \"$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): 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 MoinMoinFinally, 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: There are other settings you will likely want to alter, look at the bottom of ../WikiInstanceCreation for more details about them. Test the wikiEverything 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 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 ScenarioOn 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 worksThe 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"
> 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 instanceCreating a wiki instance involves copying files around and setting appropriate permissions. Read ../WikiInstanceCreation and follow the steps described there. Install the htdocs filesThe 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_static160
> chmod -R a+rX moin_static160]]>Install moin.cgiThere 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.cgiWhen 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: 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: Configure MoinMoinFinally, 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. Test the wikiEverything 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=testIf 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. TroubleshootingSee 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 directoryIn 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"):
Options None
AllowOverride None
Order deny,allow
Deny from all
]]>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"):
Order deny,allow
Allow from all
ScriptAlias /mywiki "/usr/share/moin/mywiki/cgi-bin/moin.cgi"
Order deny,allow
Allow from all
]]>Of course, you need to adapt the paths to your particular situation. FastCGI Setup using Apache or LighttpdFastCGI 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 FastCgiFor more general information: - FastCGI Homepage FastCGI — The Forgotten Treasure (introduction) Deploying on ApacheTo 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 optionsNo 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. FastCgiExternalServerFastCgiServerExample for Apache2 on DebianEdit the /etc/apache2/conf.d/your_wiki:
AddHandler fastcgi-script .fcgi .fcg
FastCgiServer /your/path/to/moin.fcg -idle-timeout 60 -processes 1
ScriptAlias /your_wiki "/your/path/to/moin.fcg"
]]>number of processes depends on your hardware.. Expand the Apache installation: 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:Edit moin.fcg. Replace with Start the file moin.fcg manually like a Python script:Start Apache. Fallback to CGI if FastCGI is not availableInstall 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:
ScriptAlias /mywiki "/your/path/to/moin.cgi"
AddHandler fastcgi-script .fcg
ScriptAlias /mywiki "/your/path/to/moin.fcg"
]]>Now Apache will use mod_fastcgi if available and otherwise use the slow cgi script. Deploying on lighttpdThis 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): Then configure it to run moin.fcg for your wiki site and also serve the static stuff: "/robots.txt",
"^/favicon.ico" => "/favicon.ico",
"^/moin_static161/(.*)" => "/moin_static161/$1",
"^/(.*)" => "/wiki-engine/$1"
)
server.document-root = "/srv/org.example/htdocs/"
$HTTP["url"] =~ "^/wiki-engine/" {
fastcgi.server = ( "/wiki-engine" =>
(( "docroot" => "/",
"min-procs" => 10,
"max-procs" => 10,
"max-load-per-proc" => 2,
# allocate successive port numbers for each process, starting with "port"
"bin-path" => "/srv/org.example/bin/moin.fcg",
"host" => "127.0.0.1",
"port" => 3060,
"check-local" => "disable",
))
)
}
}]]>Finally adapt moin.fcg: Using HTTP Authenticationlighttpd mod_fastcgi does not add the AUTH_TYPE variable to the cgi environment, which will cause http auth in moin to fail. See for more information, and an attached diff file to correct to issue. MoinMoin Startup scriptHere is a startup script for Mac OS X, using DarwinPortsStartup system. It is probably useful for other unix like platforms. /dev/null
}
]]> /dev/null
}
]]>&2
;;
esac
]]>Mac OS X: Adding MoinMoin startup scriptWith this script, moin instances will be started automatically on startup. Install darwinportsInstall DarwinPortsStartup package: Copy moin.sh into /opt/local/etc/rc.d: mod_python Setup using ApacheWhy Use mod_pythonmod_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/FastCgi is rather more efficient in this respect. Basic configuringInstall mod_python Set up a wiki instance Edit wikiconfig.pyChanges to Apache httpd.confRestart 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_pythonMost 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: After this restart Apache and make sure that it starts successfully, and that the error log has a line similar to this:- You may need to change some environment variables on (eg) FreeBSD - this is detailed in the port installation message. Set up a wiki instanceThis 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. Copy moin.cgi into your wiki directory Configure httpd.conf as cgi first (the shown Alias is for moin version 1.6.0): Restart Apache and make test that your wiki works. Edit `wikiconfig.py`Make sure you use only absolute paths - relative paths will not work! If you do not want to use absolute paths, you can use Python's os module to construct the relative paths: {{{import os data_dir = os.path.join(os.path.dirname(file), 'data/') data_underlay_dir = os.path.join(os.path.dirname(file), 'underlay/') }}} Test that the wiki works after this change. Changes to Apache `httpd.conf`After your wiki is running as cgi script, convert it to run with mod_python. If you run your wiki as cgi as we recommended before, remove or comment the ScriptAlias directive: Add a Location directive:
SetHandler python-program
# Add the path of your wiki directory
PythonPath "['/var/www/moin/mywiki'] + sys.path"
PythonHandler MoinMoin.request.request_modpython::Request.run
]]>If you have multiple MoinMoin instances then add one location directive for each one (changing the paths as appropriate) and add a line with the directive PythonInterpreter mywiki to each Location section. With this directive different subinterpreters with completely separate namespaces will be used for each wiki (see here for details). If you did not install MoinMoin in the default location, you will have to add the path to MoinMoin to the system path: Restart Apache - everything should now work correctly. Solving problems for non-root-mounted wikis/!\ If your wiki does not have a root URL (like http://www.example.com/FrontPage), then you might need to follow the next steps: 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:
...
]]>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 value must match the Apache Location value!
PythonOption Location /farm/mywiki
...
]]>Configuring root wikiYou 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 should appear in the first part of the httpd.conf configuration file. The wiki and virtual host configuration should look like this (Alias is for moin version 1.6.0):-
ServerAdmin postmaster@example.com
DocumentRoot /var/www/html
ServerName wiki.example.com
Alias /moin_static160/ "/usr/share/moin/htdocs/"
]]>
# 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 MoinMoin.request.request_modpython::Request.run
]]>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 versionsmod_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 scriptMoinMoin 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. Fix mod_pythonmod_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 to TroubleshootingPage 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 TwistedUsing MoinMoin with TwistedTwisted is an event-driven networking framework for many kinds of applications. For MoinMoin Twisted is used as a 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. /!\ First do ../BasicInstallation and ../WikiInstanceCreation. Besides the general installation you need 3 files: the script /path/to/cgi-dir/mointwisted (see "Starting the server" below) the webserver script file like mointwisted.py (which needs to be in the same directory where your working directory is). the configuration file like /path/to/wikiconfig-dir/wikiconfig.pyInstall TwistedFirst, install Twisted (see URL above). Many Linux distributions have Twisted packages. Please refer to the documentation of Twisted for installation information. Configuring the Twisted serverCopy the file wiki/server/mointwisted.py to your wiki directory. Edit and adapt the settings to your needs. System path configurationIf 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: Config class optionsIf you did a standard install, the default options might be just what you need. Check and change what you like: OptionDefaultComment 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.pyThe sample config file should be just fine. Don't change url_prefix_static as the default value is hardcoded in the Twisted server. Starting the serveron UnixOn 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 . Stop the server with ./mointwisted stop. For more options run ./mointwisted without arguments. If you want to start the server via initscript make sure mointwisted finds montwisted.py on startup! on WindowsCopy 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 serverInstalling and configuring standalone serverSee also: HelpOnConfiguration/IntegratingWithApacheThe standalone server is especially made for local wikis because it does not need a web server installed. Only Python and Moin are necessary! The quick waySee DesktopEdition. The flexible wayInstead of just running it like described above, you can of course move stuff to different places (see ../BasicInstallation, ../WikiInstanceCreation). You can then invoke the moin standalone server using the moin scripting command: Of course you have to give correct values that match your setup: --config-dir gives the directory that contains your wikiconfig (or farmconfig). wikiconfig points to other important pathes, e.g. data_dir and underlay_dir--docs gives the directory where moin finds the static files (css, imgs, etc.) If it does not find the moin command: if you used setup.py it should have copied it to /usr(/local)/bin - check your PATH. if you don't want to use setup.py just write your own moin command script: (!) If it crashes and tells it can't import MoinMoin, then just uncomment and fix the sys.path stuff you see above. Now point your browser at http://localhost:8080/ (or whatever moin tells you). If you want to run the moin process as a daemon, have a look at the --start, --stop and --pidfile options. Serving port 80 on UnixOn GNU/Linux, Mac OS X or other Posix like OS, you can serve the standard port 80 used for web serving, but you must start moin 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. Standalone Server configurationAlternatively to giving parameters by commandline options, you can also have a wikiserverconfig.py and specify your stuff in a Config class there. See the example file in the toplevel directory. OptionDefaultComment name 'moin' Server name, used by default for log and pid files. 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. serverClass 'ThreadPoolServer', 'ThreadingServer', 'ForkingServer', 'SimpleServer', 'SecureThreadPoolServer' 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. properties {} allow overriding any request property by setting the value in this dict e.g properties = {'script_name': '/mywiki'}. ssl_privkey None If using the SecureThreadPoolServer, this must point to the server's private key. ssl_certificate None If using the SecureThreadPoolServer, this must point to the server's certificate. (!) There may be more options useful to moin developers, see the comments in moin.pyConfiguring wikiconfig.pyThe sample config file should be just fine. The default value of url_prefix_static is hardcoded into the standalone server script, do not change it or it won't work! Using the secure standalone serverThe standalone server supports SSL when using the SecureThreadPoolServer server class. The SSL support is provided by the TLSLite library. All wiki traffic is forced to SSL when using the SecureThreadPoolServer. Two additional configuration options are required when using the SecureThreadPoolServer. First, ssl_privkey must point to the server's private key. Second, ssl_certificate must point to the server's certificate. /!\TLSLite does not support a password protected private key unless additional libraries are used. Consult the TLSLite webpage for more information.Typically a certificate would be purchased from an certificate authority, such as Thawte (). However, since the suggested usage of the standalone server is for personal use, a self signed certificate may be appropriate. For more information on how to generate a server private key, and a self signed certificate, see the openssl HOWTO pages. For example, to create the server's private key, run the following: openssl genrsa -out privkey.pem 2048To create a self signed certificate for the newly created private key, run the following: openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095moin.py then needs to be told about the generated files privkey.pem and cacert.pem. For the example above, the following lines would need to be added to moin.py: /!\ Using a self signed certificate will cause your browser to generate a warning that it cannot verify the identify of the wiki server. This is because the certificate was not signed by a recognized certificate authority (CA). In order to get rid of this warning, you must purchase a certificate from a CA. Mac OS X Installation using Apache<<Include: execution failed ['NoneType' object has no attribute 'nodeName'] (see also the log)>>Windows Installation using ApacheSystem Requirements & PreparationBefore 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. Windows 2000, XP, or greater (including server variants, such as Windows 2000 Server). Earlier versions of Windows (such as Win98 or WinME) are not recommended due to their obsolete and poor-performing multiple-process handling. WinNT is obsolete and Microsoft has officially dropped support for it and should not be considered a safe server platform for the Internet. Run Windows Update to ensure that you are running the latest service packs and security patches. Apache doesn't require Windows Server (unlike IIS), so it's a great way to use an older desktop without using a Server license! Apache doesn't artificially limit the number of connections, unlike personal IIS for example. 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:\PythonPython C:\Python24 C:\Moinwiki instances C:\My Documents\Moin Downloading and installing all of the required components below will require almost 100 MB of disk space - shouldn't be a problem nowadays, right? InstallationInstalling ApacheDownload & Install Apache 2.0.xx or greater Apache2 was re-written with better support for non-unix systems, therefore the 2.0.xx series is strongly recommended for Windows users over Apache 1.3.xx. Go to download the Win32 Binary (MSI Installer) for the latest version of Apache 2. Read the Apache documentation to determine the correct installation procedure for your situation. Test your Apache installation to make sure it runs correctly before proceeding (questions and problems with the Apache installation should be resolved through the resources provided by the Apache organization). Installing PythonThere are currently two different distributions of Python available for Windows. The normal Python distribution is available from . This is distributed as a windows executable (.exe) file. An alternative distribution called ActivePython is available from . This distribution uses the MSI Installer and contains some tools specific to the Windows operating system and a popular Windows IDE called Pythonwin, which may be useful if you also plan to develop in Python. 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.3 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. Installing MoinMoinDownload MoinMoinThe most current version is here: MoinMoinDownloadExpand the archiveNote: users of older versions of WinZip report problem expanding .tar.gz files. Either upgrade or use the free 7-Zip utility. Expand the archive into C:\TEMP or an alternative location. You should then have a folder such as 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. Run Setup.py from the commandlineOpen an DOS window (start > Run... > type cmd) and enter the commands: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 can use Windows Explorer to examine the newly created folders within C:\Python. You should find a C:\Python\share\moin folder and a C:\Python\Lib\site-packages\MoinMoin folder. The MoinMoin folder contains many Python scripts and several subfolders. You are now ready to create a wiki instance. ConfigurationIt 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. 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 name you choose for mywiki will become part of the url used to access your site, e.g. http://server.myorganization.org/mywiki/FrontPage. Creating a Wiki InstanceStart an DOS window and enter the commands below. This will create a clone of the MoinMoin wiki in the mywiki folder. If your server is going to run multiple wikis, you need to create additional clones. Do the same commands again, but use mywiki2 instead of mywiki. Configuring wikiconfig.pyEdit C:\Moin\mywiki\wikiconfig.py and at least change sitename to the name of your wiki: Additionally, set data_dir and data_underlay_dir to the absolute paths of the particular directories. Like here: For a public installation, you'll normally want to forbid some of the more dangerous actions. Add a line like this to wikiconfig.py: If you will not be running a Wiki farm (if you're not sure what this means, then you probably won't be), make sure to delete the farmconfig.py file from the C:\Moin\mywiki directory, or else moin.cgi will most likely give off various errors (including one about not being able to find a configuration file) and will ultimately fail to start up properly. Additional configuration details can be found in HelpOnConfiguration. Configuring moin.cgiUse 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. Configuring Apache httpd.confThe 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. The Alias line 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. 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. TroubleshootingThe first place to look for clues when the unexpected happens is to try changing your url to: http://127.0.0.1/mywiki?action=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 ErrorIf 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 FoundIf 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 foundIf the Apache error log shows the message "File does not exist: C:/Apache/htdocs/????", you may have mistyped the url "" into your browser. FrontPage Loads Without IconsIf 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. If you did not install MoinMoin in the Python site-packages folder (i.e. only if you deviated from the above instructions), you will have to activate the lines which add a folder to the sys.path and enter your path to MoinMoin there:Next StepsAuthenticating MoinMoin Users Against a Domain ControllerMany organizations are setting up wiki's for documentation on their internal network. As a result, many organizations require the security of authentication, which protects their content, as well as allowing people to work remotely on the wiki without anonymous eye's peeking at their site. Domain authentication is convenient for both the administrator and the user, because it uses the same password the user would use for other network logins. If this describes you, proceed to: ../ApacheOnWin32withDomainAuthenticationSimple Windows MoinMoin BackupSimple strategy for backing up your wiki: ../Win32MoinEasyBackupFastCGI with WindowsDramatically increase performance of your wiki with the FastCGI Apache module: ../ApacheOnWin32withFastCgiWindows Installation using IISIndexRequirements & PreparationBefore you install MoinMoin, make sure you have the necessary infrastructure in place, namely the Internet Information Services webserver (any version should be OK), and a Python installation (at least version 2.3 is required, the latest python release is recommended). These instructions make the basic assumption that you will have these components installed in their default locations. In reality, you'll probably have them installed elsewhere (on the D: drive, for example). Be careful to substitute your drive and paths based on the following assumed default locations: IIS to its default location C:\Python - the Python interpreter C:\Moin - MoinMoin itself InstallationInstalling IISFrom Microsoft: () To install IIS, add components, or remove components: Click Start => Settings => Control Panel => Add/Remove Programs. Click 'Add/Remove Windows Components', Check 'Internet Information Services' and follow the on-screen instructions to install. ( /!\ it is also recommended to click the 'details' button and un-selecting components you will not need. This will depend on your server role; but for example, you probably will not need FTP, or "Frontpage 2000 Server Extensions"). 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 PythonThere are currently two different distributions of Python available for Windows. Either version will work fine. - The standard open-source Python distribution. The installer is a windows executable (.exe) file. - An alternative, commercially-supported, distribution (distributed for free (email address required)). The installer is a Windows .MSI file. If you are or plan to develop in the Python language, ActivePython has some tools specific to the Windows operating system and includes a popular Windows IDE called Pythonwin. MoinMoin works with either distribution, but requires Python release 2.3 or later. Download and install the distribution of your choice. Be sure your Python installation is correct before proceeding. Installation is straightforward; however, any questions or issues regarding the Python installation process should be resolved through the use of resources provided by Python.org or ActiveState. Installing MoinMoinDownload MoinMoinThe most current version is here: MoinMoinDownloadExpand the archiveNote: users of older versions of WinZip report problem expanding .tar.gz files. Either upgrade or use the free 7-Zip utility. Expand the archive into C:\TEMP or an alternative location. You should then have a folder such as 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. Run Setup.py from the commandlineOpen an DOS window (start > Run... > type cmd) and enter the commands: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. You are now ready to create a wiki instance. ConfigurationCreating a Wiki InstanceEnter these commands in a console window from C:\Moin>: "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 confusion and problems later on. We have to make sure that moin.cgi can find the MoinMoin directory, so that "import MoinMoin" will work. The easiest way to make sure MoinMoin can be imported is to append to sys.pathwithinmoin.cgi. You can change the first two lines of code in moin.cgi to something like this: Notice that we're pointing to the directory which contains the MoinMoin directory, not the directory itself. Configuring IISNext, you'll need to create two virtual directories in IIS. One for the shared data, and one for this specific wiki instance. Configuring IIS 5.0 and aboveOpen Internet Services Manager (Start > Settings > Control Panels > Administrative Tools > ...). 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 mandatory useless first screen, hit next. Enter "wiki" for the alias name, hit next. Browse to "C:\Moin\share\moin\htdocs", hit next. Leave the Access permissions at their defaults, 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". Use IIS Admin to remove permissions to read the data directory: expand the "mywiki" node right click on dataselect Propertiesand uncheck Read. Repeat these steps with the underlay directory. Now you need to setup the 'mywiki' alias so that it will run Python to interpret .cgi files. On Windows Server 2003, click the Create button under Application Settings to create an application space. 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 extension. 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 beginning period. Make sure 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. IIS 6.0 (Windows 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: Open IIS Manager (Start > Programs > Administrative Tools > IIS Manager). Go to the Web Service Extensions folder. Under the Action menu, select Add a new Web service extension.... For Extension name, give it a name such as .cgi or Python cgi or similar. Under Required files click the Add... button and type in the exact command-line string you used above. Eg: c:\python24\python.exe -u "%s" "%s", then click the Ok button. Make sure the Set extension status to Allowed checkbox is checked and click the Ok button. Another change that may be necessary if you are receiving HTTP Error 403 19 1314 while using IIS 6.0 is to adjust the Identity settings for the Application Pool that is being used by your site. The following steps assume you are adjusting the Default Web Site. Open IIS Manager (Start > Programs > Administrative Tools > IIS Manager). Go to the Application Pool folder. Select the Application Pool you wish to adjust. (likely DefaultAppPool ) When you do this on the right you will see the Application pools for each site on the server. This will include a Description (likely Default Application ) and a Path (<Default Web Site>). In this way you can be certain you are adjusting the appropriate Application Pool. With DefaultAppPool still selected right click and select Properties. Select the Identity tab and with Predefined clicked use the drop down box to change the Identity to Local System instead of Network Service. Please be aware that this is a workaround since you SHOULD set your group settings to allow Network Service to access the cgi scripts.Under Windows Server 2003, you will also need to give your IUSR_MACHINENAME account Modify access to the mywiki\data and mywiki\underlay sub-directories, as file system permissions are more restricted by default than previous Windows versions. That is all, try to access your new-born wiki with the URL . 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. Configuring wikiconfig.pyFinally, edit "wikiconfig.py" and at least change "sitename" and "logo_string" to some personal values: My Wiki']]>Where "images" is a directory under your "mywiki" instance. NOTE: The configuration variable "url_prefix" in "wikiconfig.py" should match the alias for "C:\Moin\share\moin\htdocs" or themes will not work ("/wiki" for the instructions above). This way, any reference in "wikiconfig.py" to "/wiki/something" will look in the shared data directory and a reference to "/mywiki/something" will look in the wiki instance directory. These are considered absolute paths because relative paths will not work correctly. It seems you need to change the Custom Errors setting for 404 before you can create new pages. You can accomplish this by performing the following steps: Go into the IIS Manager, right-click on 'mywiki' (or whatever your wiki instance directory is called), and select properties. Next, go to the Custom Errors tab and find the 404 entry, and click the Set to Default button. TroubleshootingIf you see an error like "ImportError: No module named MoinMoin", it means that python cannot find MoinMoin. See above for how to add to sys.path. If you see an error like Error 13: Permission Denied, it means that your web user permissions for the files do not have write/modify enabled. If the page never loads after hitting Save Changes, you should check the permissions of the data directory. Make sure the IUSR_COMPUTERNAME user has modify permissions. If some images like InterWiki and WorldWideWeb don't show up, it could have been because of incorrect permissions or a bad "url_prefix" in "wikiconfig.py" or the cached pages need to be updated by an Edit or deleting them in the data folder. Or you are using MS IE which has broken CSS :before support - try another browser. If you see an error message like:and you don't intend on using a serverfarm, remove the farmconfig.py and farmconfig.pyc files and try again. The error message shouldn't appear when you refresh the page. If you are using URLScan, you might have to add the following setting in the file %SystemRoot%\system32\inetsrv\urlscan\urlscan.ini:Next StepsBacking up MoinMoin is simple. Look at HelpOnInstalling/Win32MoinEasyBackup for guidance (despite the somewhat misleading title, the procedure would be the same for IIS). Trouble-shootingHow to deal with common errorsFirst follow the instructionsMoin has provided instructions for common usage. Try creating a wiki using the default values within the instructions. Your wiki would then be stored where ours is, and named mywiki ... but you can change that place, and this name, AFTER you have a working wiki. The default values have been chosen carefully to work for most people on most platforms, or at least be a good start. First follow the instructions Do not change any configuration option unless you must. Play with a working wiki before you try to customize it. Change one thing at a timeWhen your wiki is running, go and customize it to your needs, but remember to change only one option at a time. You probably don't fully understand how all options work, and if you go and break few things in the same step, you will have hard time to fix it. Check That Your Webserver Can Use PythonThis is also in HelpOnInstalling/BasicInstallation. Use this script: &1
python2.3 -V 2>&1
python2.4 -V 2>&1
python2.5 -V 2>&1
echo "Finished."]]>to see if you can get it to announce that cgi works. Then you will also know which versions of python are usable. This is especially handy for users with no root access. Duelling PythonsThe 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: When installing, make sure you install with the version of python you want to run moin with. python setup.py install will install with the first python in the path, which may be the version you expect or not! /usr/local/bin/python2.4 will install in specific python. You will have to use the same path in the moin server script. Missing file permissionsIf 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 wiki engine also needs write access. To fix this, first find out where the Python module directory is; look in install.log, or run the command: For the example below, we'll assume that the Python module directory is /usr/local/lib/python2.4/site-packages. Make the files world-readable using the following commands: Set Your Variables CarefullyBe especially careful when you retype instead of cut and paste. Quoting errors in wikiconfig.py can cause things to fail. The following items are also variable issues. Also, some features only work if they are enabled by their option in either wikiconfig.py or farmconfig.py. moin.cgi found, Moin doesn't runIf you have to add the moin code location into the system path, make sure to specify the place above MoinMoin itself, so that the word MoinMoin is recognized during the import request. CSS files do not workA very common error is missing CSS styles. Your wiki looks bare and ugly, unlike this nice wiki. In most cases, you did break the configuration by not reading the instructions. The fix is very easy: make sure your Apache Alias and ScriptAlias are NOT the same. This Apache setup will never work: The Alias is used to serve static files: css, images, etc. ScriptAlias is used to hide moin.cgi from the url. You must use different values! You can use anything you like for ScriptAlias, or Alias, but Alias must match the url_prefix_static configuration option. Here is an example that works (the default):