view docs/INSTALL.html @ 196:d0250ed0cd53

make interwiki underlay install-docs imported from: moin--main--1.5--patch-198
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 05 Nov 2005 21:26:59 +0000
parents 6ddcb13c0f4e
children 345d0228a0bd
line wrap: on
line source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="shortcut icon" href="http://moinmaster.wikiwikiweb.de/wiki/favicon.ico">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="robots" content="noindex,nofollow">

<title>MoinMoin/InstallDocs - MoinMaster</title>
<script type="text/javascript" src="/wiki/common/js/common.js"></script>


<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="wiki/htdocs/modern/css/common.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="wiki/htdocs/modern/css/print.css">
<link rel="alternate" title="MoinMaster Recent Changes" href="http://moinmaster.wikiwikiweb.de/RecentChanges?action=rss_rc&amp;ddiffs=1&amp;unique=1" type="application/rss+xml">

<link rel="Start" href="http://moinmaster.wikiwikiweb.de/FrontPage">
<link rel="Alternate" title="Wiki Markup" href="http://moinmaster.wikiwikiweb.de/MoinMoin/InstallDocs?action=raw">
<link rel="Alternate" media="print" title="Print View" href="http://moinmaster.wikiwikiweb.de/MoinMoin/InstallDocs?action=print">
<link rel="Up" href="http://moinmaster.wikiwikiweb.de/MoinMoin">
<link rel="Search" href="http://moinmaster.wikiwikiweb.de/FindPage">
<link rel="Index" href="http://moinmaster.wikiwikiweb.de/TitleIndex">
<link rel="Glossary" href="http://moinmaster.wikiwikiweb.de/WordIndex">
<link rel="Help" href="http://moinmaster.wikiwikiweb.de/HelpOnFormatting">
</head>

<body  lang="en" dir="ltr">
<div id="page" lang="en" dir="ltr">
<div id="interwiki"><span><a href="http://moinmaster.wikiwikiweb.de/FrontPage">MoinMaster</a></span></div>
<ul id="pagelocation">
<li>MoinMoin/InstallDocs</li>
</ul>
<div lang="en" id="content" dir="ltr">
<a id="top"></a><p>This HTML page contains the basic install docs that can be found on <a href="http://moinmaster.wikiwikiweb.de/MoinMoin/InstallDocs"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://moinmaster.wikiwikiweb.de/MoinMoin/InstallDocs</a>. 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. </p>
<p>After following the procedures on this page, you should have a working wiki and can browse the rest of the online docs there. </p>

<h1 id="head-378d73a512870e1afed036c887489ab98ba3c56a">How to install your own MoinMoin Wiki</h2>

<p>This page describes the installation procedure of <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a>. In the next section, there is a list of real-world <a href="#installscenarios">Installation Scenarios</a> 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 <a class="interwiki" title="MoinMaster" href="http://moinmaster.wikiwikiweb.de/HelpOnUpdating"><img src="wiki/htdocs/modern/img/moin-inter.png" alt="[MoinMaster]" height="16" width="16">HelpOnUpdating</a>. </p>
<p>A MoinMoin installation is done by some elementary steps: </p>
<ul>
<li><p> <a href="#basic-install">Basic Installation</a> explains the "<tt>setup.py</tt>" step of the installation in more detail. This is uses 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. </p>
</li>
<li><p> <a href="#wikiinstance-creation">Wiki Instance Creation</a> explains how you make a new wiki instance (data and configuration), this is also common to all scenarios. </p>
</li>
<li><p> Getting the web server to serve static stuff under the <tt>/wiki</tt> URL (url_prefix) - used for theme CSS and images, etc. - this is slightly different for the various web servers that can be used - see below. </p>
</li>
<li><p> 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. </p>
</li>
<li><p> After a successful installation, you might want to read more about configuration and other options that you, as the wiki administrator, can set up. <a class="interwiki" title="MoinMaster" href="http://moinmaster.wikiwikiweb.de/HelpOnAdministration"><img src="wiki/htdocs/modern/img/moin-inter.png" alt="[MoinMaster]" height="16" width="16">HelpOnAdministration</a> contains links to pages that cover these topics. Especially, the <a class="interwiki" title="MoinMaster" href="http://moinmaster.wikiwikiweb.de/HelpOnConfiguration"><img src="wiki/htdocs/modern/img/moin-inter.png" alt="[MoinMaster]" height="16" width="16">HelpOnConfiguration</a> and <a class="interwiki" title="MoinMaster" href="http://moinmaster.wikiwikiweb.de/HelpOnUpdating"><img src="wiki/htdocs/modern/img/moin-inter.png" alt="[MoinMaster]" height="16" width="16">HelpOnUpdating</a> pages provide additional information regarding wiki setup and maintenance. </p>
</li>
<li><p> <a href="#trouble-shooting">Trouble-shooting</a> helps with fixing any general problems you might encounter, which apply to any installation platform.  </p>
</li>
</ul>
<a id="installscenarios"></a>
<p> </p>

<h1 id="head-bee4ae5a5ef44b7af47ecd4f29b44226ba935e5b">Installation steps specific for some web servers and operating systems</h2>

<p>The following links will show you concrete examples of installation sessions, showing the commands used and explaining what they do. You <em>must first read the general information on installing above</em> before doing the installation steps described on the pages linked from below: </p>
<p>Linux: </p>
<ul>
<li><p> <a href="#linuxapache-install">Linux Installation using Apache</a> </p>
</li>
<li><p> <a href="#linuxstandalone-install">Linux Installation using standalone server</a> </p>
</li>
</ul>
<p>Long-Running-Process Setup: </p>
<ul>
<li><p> <a href="#fastcgi-install">FastCGI Setup using Apache</a> </p>
</li>
<li><p> <a href="#modpy-install">mod_python Setup using Apache</a> </p>
</li>
<li><p> <a href="#twisted-install">Setup using twisted</a> </p>
</li>
</ul>
<p>Mac OS X: </p>
<ul>
<li><p> <a href="#macosx-install">Mac OS X Installation</a> </p>
</li>
</ul>
<p>Windows: </p>
<ul>
<li><p> <a href="#win32apache-install">Windows Installation using Apache</a> </p>
</li>
<li><p> <a href="#win32iis-install">Windows Installation using IIS</a> </p>
</li>
</ul>
<a id="basic-install"></a>
<p> <div lang="en" id="Include_HelpOnInstalling/BasicInstallation" dir="ltr">
<a id="top_Include_HelpOnInstalling/BasicInstallation"></a><p><strong>How to do a basic installation of <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> on your system.</strong> </p>
<p><strong>Contents</strong> <ol>
<li><a href="#head-2fa431ad9c9bff5badd07c5ee676b19852ed28e3">Check if Python is working</a></li>
<li><a href="#head-119b1acf8110bb618e4f366c3d1f8a35ad625f75">Download MoinMoin</a></li>
<li><a href="#head-a84e58c8b4256bd645b9c47b5a900219a356259f">Install MoinMoin</a><ol>
<li><a href="#head-640b21abea127e7ac4b48c938607c233b7119bd5">Installing in the default system location</a></li>
<li><a href="#head-ae8ab55eb5e8c11d4fd1eb06e12d69f1b33d411b">Installing in the home directory or another specific location</a></li>
</ol>
<li><a href="#head-d7d600c8dcfdd9270f4a6642566404ede510f46a">Test installation</a></li>
<li><a href="#head-87a60f1d02c36fb1804b442815dba49cbc8adfe7">What has been installed</a></li>
</ol>
 </p>
<p>Before you can integrate MoinMoin into your web environment, you have to install the <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> source code and data files using the standard Python <em>distutils</em> mechanism (<tt>setup.py</tt>). This page explains the steps you usually need to take to do this. For more details on the <em>distutils</em> installation process, consult the <a class="external" href="http://www.python.org/doc/current/inst/inst.html"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> Installing Python Modules</a> document in your Python documentation set. </p>
<p>The installation is similar on Windows and Linux (and other POSIX-type systems; for simplicity, we just say "Linux" in the docs). </p>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> We use text such as <strong><tt>&gt;&nbsp;command&nbsp;arguments</tt></strong> to show what you have to type at the command prompt (also known as shell, terminal, etc.). In our examples "<tt>&gt;&nbsp;</tt>" 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 "<tt>&gt;&nbsp;</tt>" are the answers to the commands you have typed. Read them carefully. </p>
</li>
</ul>

<h1 id="head-2fa431ad9c9bff5badd07c5ee676b19852ed28e3">Check if Python is working</h2>

<p>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. </p>
<p>The <tt>CHANGES</tt> file in the MoinMoin archive mentions what versions are supported. Python 2.3 is the minimum requirement for MoinMoin 1.5, but we suggest you use the latest Python release version. </p>
<p>You can download Python at <a class="external" href="http://www.python.org/download/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://www.python.org/download/</a>. </p>
<p>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 <em>search path</em>. 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. </p>
<p>If you have shell access, checking if Python is working is very simple. Just type the following command, and look at the result: 
</p>
<pre>
&gt; python -V
Python 2.3.4
</pre>
<p>If you don't have shell access, you can try using this <tt>pythontest.cgi</tt> script (it assumes that you are using a Linux kind of webserver). Upload the script to your <tt>cgi-bin</tt> directory, use <tt>chmod&nbsp;a+rx&nbsp;pythontest.cgi</tt> (or a similar command in your FTP program) to make it executable, and invoke it using your web browser. 
</p>
<pre>
#!/bin/sh
echo Content-Type: text/plain
echo
echo "Your web server is running as:"
id
echo "CGI scripts work"
echo "Now we try to invoke Python interpreters and get their versions:"
python -V 2&gt;&amp;1
python2.3 -V 2&gt;&amp;1
python2.4 -V 2&gt;&amp;1
echo "Finished."
</pre>
<p>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. </p>
<p>Also be sure to read <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/ApacheOnLinuxFtp">../ApacheOnLinuxFtp</a> after you've completed the <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">../BasicInstallation</a> illustrated here. </p>

<h1 id="head-119b1acf8110bb618e4f366c3d1f8a35ad625f75">Download MoinMoin</h2>

<p>To download the distribution archive, go to the <a class="external" href="http://sourceforge.net/project/showfiles.php?group_id=8482"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> download area</a> and fetch the latest archive. </p>
<p>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 <tt>.tar.gz</tt> archive, which you can unpack as shown below. </p>
<ul>
<li><p> On Windows </p>
<ul>
<li><p> You can use recent versions of programs like WinZip, WinRar, and WinAce, which handle .tar.gz kind of archives. </p>
</li>
<li><p> At the command prompt, you can use <a class="external" href="http://gnuwin32.sourceforge.net/packages/gzip.htm"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> GNU gzip</a> and <a class="external" href="http://gnuwin32.sourceforge.net/packages/tar.htm"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> GNU tar</a> for Windows. </p>
</li>
</ul>
</li>
<li><p> On Linux </p>
<ul>
<li><p> You can use your favorite file manager -- it should be able to unpack them. </p>
</li>
<li><p> At any shell prompt, you can use the <tt>tar</tt> command. </p>
</li>
</ul>
</li>
</ul>
<p>The distribution archive will always unpack into a directory named <tt>moin-&lt;version&gt;</tt>, for example <tt>moin-1.5</tt>. </p>
<p>Here is how you would unpack the archive (using GNU tar) and enter the directory with the MoinMoin files: 
</p>
<pre>
&gt; tar xzf moin-1.5.0.tar.gz
&gt; cd moin-1.5.0
</pre>

<h1 id="head-a84e58c8b4256bd645b9c47b5a900219a356259f">Install MoinMoin</h2>

<p>You can install MoinMoin to either: </p>
<ul>
<li><p> a system location (if you have the necessary rights to do that -- on Linux you need to be root) </p>
</li>
<li><p> some specific location, like your home directory (Linux) or <tt>C:\moin</tt> (Windows). </p>
</li>
</ul>
<p>The installation to a system location is easier, so choose that if possible. </p>
<p><img src="wiki/htdocs/modern/img/alert.png" alt="/!\" height="15" width="15"> 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. </p>
<p>If you have problems with the <tt>setup.py</tt> install step, try using the command: 
</p>
<pre>
&gt; python -v setup.py --quiet install --record=install.log
</pre>
<p>The additional <tt>-v</tt> flag should provide you detailed verbose messages every step of the way. </p>
<p><img src="wiki/htdocs/modern/img/alert.png" alt="/!\" height="15" width="15"> On Linux, if u get an error like <tt>Invalid&nbsp;Python&nbsp;installation:&nbsp;cannot&nbsp;find&nbsp;/usr/lib/Python2.x/config/Makefile</tt>, you may not have the python module <strong><tt>distutils</tt></strong> installed, it's usually a part of the <strong>Python development libarary (<tt>python-dev</tt>)</strong>. Some Linux distributions may not have installed it by default. For example, on Mandrake you need to install the <strong><tt>python-devel</tt></strong> package, on Debian it's called <strong><tt>python-dev</tt></strong>. </p>

<h2 id="head-640b21abea127e7ac4b48c938607c233b7119bd5">Installing in the default system location</h3>


<pre>
&gt; python setup.py --quiet install --record=install.log
</pre>
<p>This installs MoinMoin to the default system location (typically the Python directory, for example on Linux, inside <tt>/usr/lib</tt> and <tt>/usr/share</tt>). Look at the <tt>install.log</tt> file to see what was installed, and where. </p>
<ul>
<li><p> Mac OS X note: use the command: 
</p>
<pre>
python setup.py install --install-data='/usr/local'
</pre>
<p>This will install the shared files to '/usr/local/share/moin', instead of an inconvenient location in the System folder. </p>
</li>
</ul>

<h2 id="head-ae8ab55eb5e8c11d4fd1eb06e12d69f1b33d411b">Installing in the home directory or another specific location</h3>

<p>Linux example, installing in the home directory: 
</p>
<pre>
&gt; python setup.py --quiet install --prefix=$HOME --record=install.log
</pre>
<p>Windows example, installing in the <tt>C:\moin</tt> directory: 
</p>
<pre>
&gt; python setup.py --quiet install --prefix="C:\moin" --record=install.log
</pre>
<p>All MoinMoin files will then be installed inside those directories, see <tt>install.log</tt> to know which files were installed, and where. </p>
<p><strong>Note:</strong> You will likely see the following warning: </p>
<ul>
<li style="list-style-type:none"><p><tt>warning:&nbsp;install:&nbsp;modules&nbsp;installed&nbsp;to&nbsp;'C:\moin\',&nbsp;which</tt><br>
 <tt>is&nbsp;not&nbsp;in&nbsp;Python's&nbsp;module&nbsp;search&nbsp;path&nbsp;(sys.path)&nbsp;--&nbsp;you'll</tt><br>
 <tt>have&nbsp;to&nbsp;change&nbsp;the&nbsp;search&nbsp;path&nbsp;yourself</tt> </p>
</li>
</ul>
<p>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. </p>
<p>For example, if you are running using a webserver and standard CGI, edit <tt>moin.cgi</tt> and add your installation directory to the Python path, like this: 
</p>
<pre>
import sys
sys.path.insert(0, 'C:/moin')
</pre>

<h1 id="head-d7d600c8dcfdd9270f4a6642566404ede510f46a">Test installation</h2>

<p>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 <tt>import&nbsp;MoinMoin</tt>. Nothing should be displayed in response to this command. Example: </p>

<pre>
&gt; python
Python 2.3.4 (#1, May 29 2004, 17:05:23)
[GCC 3.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import MoinMoin
&gt;&gt;&gt;
</pre>
<p>If you get this instead: </p>

<pre>
&gt;&gt;&gt; import MoinMoin
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in ?
ImportError: No module named MoinMoin
&gt;&gt;&gt;
</pre>
<p>then you have to tune your installation. Try modifying <tt>sys.path</tt>, as described above. </p>

<h1 id="head-87a60f1d02c36fb1804b442815dba49cbc8adfe7">What has been installed</h2>

<p>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. </p>
<p><img src="wiki/htdocs/modern/img/alert.png" alt="/!\" height="15" width="15"> It is important that you understand the different locations used in a MoinMoin setup, so read this carefully. </p>
<p>In the following descriptions, <tt>PREFIX</tt> is what you used with the <tt>setup.py</tt> command, or a default location if you didn't use the <tt>--prefix</tt> option. (Typical default values on Linux are <tt>/usr</tt> and <tt>/usr/local</tt>.) <tt>X.Y</tt> is the version of Python. Typically, this is <tt>2.3</tt> or <tt>2.4</tt>. </p>
<p>Look into <tt>install.log</tt> to find out about following important locations: </p>
<ul>
<li><p> <strong><tt>MoinMoin</tt> directory</strong>, usually <tt>PREFIX/lib/pythonX.Y/site-packages/MoinMoin</tt> -- this is where the MoinMoin <strong>source code</strong> is located </p>
</li>
<li><p> <strong><tt>share</tt> directory</strong>, usually <tt>PREFIX/share/moin</tt> - this is where the <em>templates</em> are located </p>
<ul>
<li><p> <strong><tt>data</tt></strong> directory (wiki pages, users, etc.) - only MoinMoin should access this </p>
</li>
<li><p> <strong><tt>underlay</tt></strong> directory (wiki pages) - only MoinMoin should access this </p>
</li>
<li><p> <strong><tt>htdocs</tt></strong> directory with html support files (images for the various themes, etc.) - the web server will need to access this </p>
</li>
<li><p> <strong><tt>server</tt></strong> - MoinMoin example startup files (like <tt>moin.cgi</tt> for CGI, and other files for other startup methods) </p>
</li>
<li><p> <strong><tt>config</tt></strong> - MoinMoin example configuration files (like <tt>wikiconfig.py</tt>) </p>
</li>
</ul>
</li>
<li><p> <strong><tt>bin</tt></strong> directory with some scripts that help you use the MoinMoin shell commands </p>
</li>
</ul>
<p>We talk of <em>templates</em> in the <tt>share</tt> 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. </p>
<a id="bottom_Include_HelpOnInstalling/BasicInstallation"></a>
</div>
 </p>
<hr class="hr2">
<p> <a id="wikiinstance-creation"></a>
 <div lang="en" id="Include_HelpOnInstalling/WikiInstanceCreation" dir="ltr">
<a id="top_Include_HelpOnInstalling/WikiInstanceCreation"></a><p>After you have downloaded and installed MoinMoin, you will want to "have a wiki". As explained at the bottom of <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">../BasicInstallation</a>, 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. </p>
<p>Every time you copy those files (and modify the configuration of your server accordingly), you create what is called a <em>wiki instance</em>. Each wiki instance is independant from the others, with a different configuration, different pages, different users, etc. </p>
<p>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. </p>

<h1 id="head-8c227c275465dec3f8e3b326d53f9566727c5648">Read this first</h2>


<h2 id="head-6e91ed0b234e903763a945b5249e7de8b726e5d7">Security warnings</h3>

<div>
<table style="color: red">
<tr>
<td>
<p> <img src="wiki/htdocs/modern/img/alert.png" alt="/!\" height="15" width="15"> <strong>Warning: make sure that your <tt>data</tt> directory and your configuration files are not accessible through your web server. Do not put your wiki directory in <tt>public_html</tt>, <tt>Sites</tt> or any other directory your web server can access. The web server only needs to access the file in the <tt>htdocs</tt> directory and the <tt>moin.cgi</tt> script! (Or whatever script your server uses to start MoinMoin.)</strong> </p>
</td>
</tr>
</table>
</div>
<div>
<table style="color: red">
<tr>
<td>
<p> <img src="wiki/htdocs/modern/img/alert.png" alt="/!\" height="15" width="15"> <strong>Warning: make sure that the <tt>data</tt> 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.</strong> </p>
</td>
</tr>
</table>
</div>

<h2 id="head-942d29849126a576afcc19bdbfd59c661739eb55">Note to Windows users</h3>

<p>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. </p>

<h1 id="head-66ec28f32e6870e96f6062a4a6ac77bbb4606109">Choose a wiki name</h2>

<p>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. </p>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/attention.png" alt="&lt;!&gt;" height="15" width="15"> <strong>Do not use the name "wiki" - it is reserved for internal use. You would need a special setup to use this with CGI, and you can't use it at all with standalone or twisted server.</strong> </p>
</li>
</ul>
<p>The name "<tt>mywiki</tt>" is used as an example in the various commands below. </p>

<h1 id="head-379ea73c819b2c729ba9c2432b8a4c4b4c524f71">Choose a location</h2>

<p>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. </p>
<p>If you are the administrator (or root) of the server, you can use anything you like or that makes sense to you, for example <tt>/usr/local/var/moin</tt>, <tt>/mnt/wikis</tt>, etc. </p>
<p>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 <tt>share/moin</tt> subdirectory. </p>

<h1 id="head-951584cdd82db21218fc2ffd3945de602f8275c0">Collect some important information</h2>

<p>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. </p>
<p>On Linux, the <tt>export</tt> 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. </p>
<ul>
<li><p> <tt>PREFIX</tt> is the prefix you used during the <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">../BasicInstallation</a> </p>
</li>
<li><p> <tt>SHARE</tt> is the name of the <tt>share</tt> directory, as discussed at the bottom of <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">../BasicInstallation</a> </p>
</li>
<li><p> <tt>WIKILOCATION</tt> is the name of the directory that will contain your wiki instance </p>
</li>
</ul>
<p>If you are an administrator, you also need to collect the following: </p>
<ul>
<li><p> <tt>USER</tt> is the user name of the web server </p>
</li>
<li><p> <tt>GROUP</tt> is the name of the group to which the web server belongs </p>
</li>
</ul>
<p>Now, Linux folks, let's store these settings in memory: 
</p>
<pre>
&gt; export PREFIX=/usr                # this might be something else
&gt; export SHARE=$PREFIX/share/moin   # this should be correct for most people
&gt; export WIKILOCATION=$SHARE        # this is just an example
&gt; export INSTANCE=mywiki            # this is just an example
</pre>
<p>Administrators also need the following two lines: </p>

<pre>
&gt; export USER=www-data              # this is just an example
&gt; export GROUP=www-data             # this is just an example
</pre>

<h1 id="head-c3fc33e072973371ea739841440fb52175ddb9f6">Copy the files</h2>

<p>To create your new instance, you first need to create a directory named like your instance, inside the <tt>WIKILOCATION</tt>. Then you need to copy the <tt>data</tt> and <tt>underlay</tt> directories from your <tt>SHARE</tt> directory into your instance directory. Finally, you need to copy the <tt>wikiconfig.py</tt> file from the <tt>config</tt> directory into the instance directory. </p>
<p>Linux folks need just type these commands: 
</p>
<pre>
&gt; cd $WIKILOCATION
&gt; mkdir $INSTANCE                   # make a directory for this instance
&gt; cp -R $SHARE/data $INSTANCE       # copy template data directory
&gt; cp -R $SHARE/underlay $INSTANCE   # copy underlay data directory
&gt; cp $SHARE/config/wikiconfig.py $INSTANCE   # copy wiki configuration sample file
</pre>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/alert.png" alt="/!\" height="15" width="15"> Note that you just need to keep one underlay directory on your system if you are running multiple wikis (e.g. in a farm.) </p>
</li>
</ul>

<h1 id="head-027e3666aea4dc02569ad386901ae9456bad5ae1">Set permissions</h2>


<h2 id="head-3b8b040007c209e4621b176c8724b3bbcb755957">Administrators</h3>

<p>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. </p>
<p>On Linux, the following commands should be enough: 
</p>
<pre>
&gt; chown -R $USER.$GROUP $INSTANCE   # check that USER and GROUP are correct
&gt; chmod -R ug+rwX $INSTANCE         # USER.GROUP may read and write
&gt; chmod -R o-rwx $INSTANCE          # everybody else is rejected
</pre>

<h2 id="head-19c5987edf26a8517fbf6cbee5ba5dd5f36ec280">Normal users</h3>

<p>Normal users, on the contrary, need to broaden the permissions of the files, so that the web server can read and write them. On recent Windows versions, and on some versions of Unix, Linux and other systems, <em>access control lists</em> 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. </p>
<p>Without them, normal users have to allow <em>everybody</em> to access the instance directory. This is the only way the web server can enter it and do its work. This is, of course, <strong>VERY INSECURE</strong>, since any other user and program on the server can read the directory. You should <strong>not</strong> use such a setup for a wiki open to the public. </p>
<p>On Linux, the following commands will open the instance directory to the whole world: 
</p>
<pre>
&gt; chmod -R a+rwX $INSTANCE
</pre>
<p><strong>Note:</strong> </p>
<ul>
<li><p> it is also possible to put the web server and the normal user in the same <em>group</em>, 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. </p>
</li>
<li><p> the best other possibility is that the server administrator sets up <tt>suexec</tt> 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. </p>
</li>
</ul>

<h1 id="head-442871161f523855f2162b426248f0bb0523c289">Tune configuration</h2>

<p>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. </p>
<p>Edit <tt>wikiconfig.py</tt>. 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! <img src="wiki/htdocs/modern/img/smile.png" alt=":)" height="15" width="15"> Read the comments inside <tt>wikiconfig.py</tt>, they will guide you through this process.  (Start with "Wiki identity", around line 25.) </p>
<p><a href="http://moinmaster.wikiwikiweb.de/HelpOnConfiguration">HelpOnConfiguration</a> contains all the details about all the options, in case the comments in <tt>wikiconfig.py</tt> are not enough. </p>
<a id="bottom_Include_HelpOnInstalling/WikiInstanceCreation"></a>
</div>
 </p>
<hr class="hr1">
<p> <a id="linuxapache-install"></a>
 
<h1>Linux Installation using Apache</h1>

<div lang="en" id="Include_HelpOnInstalling/ApacheOnLinux" dir="ltr">
<a id="top_Include_HelpOnInstalling/ApacheOnLinux"></a><p>This page describes the particular steps that need to be taken to create a wiki instance using <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> on Linux with the Apache web server. <strong>You should have already performed the <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">../BasicInstallation</a>. </strong>Installations on other Unices like FreeBSD are very similar. </p>
<p>Two scenarios are possible. You might be the administrator (root) of the server, able to install and modify files almost anywhere on the machine, and notably able to modifiy the Apache configuration. You might also be a simple user, only able to write files into your home directory, and unable to alter the master Apache config file. The two scenarios are discussed below. </p>
<p><strong>Table of contents</strong> <ol>
<li><a href="#head-5a61f5b0107edba120089e4251cd633be60b6e15">Administrator (root)</a><ol>
<li><a href="#head-c27688fbe7f65d67190a47ce8d32eba244ab0d01">Create a wiki instance</a></li>
<li><a href="#head-e3e9e08058bb0ae34c33f53367cd58d6c7411998">Install moin.cgi</a></li>
<li><a href="#head-408a7a283b2406c4e6b24646b25ec7996d5ff459">Configure moin.cgi</a></li>
<li><a href="#head-b02e2f66403a66cc3b1ff0ce2c7261cf44e4f0d4">Configure Apache</a></li>
<li><a href="#head-ffa39b171f9d130bb07a8481a5fff1a5a9065e86">Configure MoinMoin</a></li>
<li><a href="#head-0f7a0fb8dccf6a13b6042fa17e0d7cda751fe3f3">Test the wiki</a></li>
<li><a href="#head-52920da3312438e6a484347d4dfaa369b86cb521">Apache tricks</a></li>
</ol>
<li><a href="#head-e559f024646d8751eee1135ad5423247d72ab7fd">Simple user (home directory installation)</a><ol>
<li><a href="#head-6a39e2829f37fd34c569c2ffa768c9b3ec2289cc">Make sure /~username works</a></li>
<li><a href="#head-c27688fbe7f65d67190a47ce8d32eba244ab0d01-2">Create a wiki instance</a></li>
<li><a href="#head-ec9ce458a3f08281e5906f6d1e2e5cc008d620db">Install the htdocs files</a></li>
<li><a href="#head-e3e9e08058bb0ae34c33f53367cd58d6c7411998-2">Install moin.cgi</a></li>
<li><a href="#head-408a7a283b2406c4e6b24646b25ec7996d5ff459-2">Configure moin.cgi</a></li>
<li><a href="#head-ffa39b171f9d130bb07a8481a5fff1a5a9065e86-2">Configure MoinMoin</a></li>
<li><a href="#head-0f7a0fb8dccf6a13b6042fa17e0d7cda751fe3f3-2">Test the wiki</a></li>
</ol>
<li><a href="#head-3f286acb05ce4ad64240f788c78a8f915f59e34e">Troubleshooting</a><ol>
<li><a href="#head-b8c0d1c1aba9cd39d0d15f86ea33025f7f25d48d">Adding permission to serve the htdocs directory</a></li>
</ol>
</li>
</ol>
 </p>

<h2 id="head-5a61f5b0107edba120089e4251cd633be60b6e15">Administrator (root)</h3>

<p>Most GNU/Linux distributions come with Apache pre-installed. There is, however, some variation as to where exactly the various Apache files are located. You should consult your distribution manual, or ask on the appropriate discussion board. In the following paragraphs, we assume a (quite standard) file system layout with: </p>
<ul>
<li><p> <tt>/etc/httpd/httpd.conf</tt> - the main Apache configuration file </p>
</li>
<li><p> <tt>/var/log/httpd/error_log</tt> - the log file containing Apache error messages </p>
</li>
</ul>
<p>Some distributions use <tt>apache</tt> instead of <tt>httpd</tt> for the directory names, others may use weirder settings. </p>

<h3 id="head-c27688fbe7f65d67190a47ce8d32eba244ab0d01">Create a wiki instance</h4>

<p>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: </p>

<pre>
&gt; egrep "^User|^Group" /etc/httpd/httpd.conf
User wwwrun
Group nogroup
</pre>
<p>This shows a typical result: "<tt>wwwrun.nogroup</tt>". Other common results are "<tt>nobody.nogroup</tt>", "<tt>apache.apache</tt>" and "<tt>www-data.www-data</tt>". 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. </p>
<p>Once you have gathered this information, read <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/WikiInstanceCreation">../WikiInstanceCreation</a> and follow the steps described there. </p>

<h3 id="head-e3e9e08058bb0ae34c33f53367cd58d6c7411998">Install moin.cgi</h4>

<p>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. </p>
<p>We will create a <tt>cgi-bin</tt> subdirectory in the instance directory. Using the environment variables defined in <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/WikiInstanceCreation">../WikiInstanceCreation</a>, run the following commands: </p>

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

<h3 id="head-408a7a283b2406c4e6b24646b25ec7996d5ff459">Configure moin.cgi</h4>

<p>When <tt>moin.cgi</tt> 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 <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">../BasicInstallation</a>), it is likely that the configuration file will not be found. Edit the <tt>moin.cgi</tt> script to correct that. Add these lines near the top of the file: </p>

<pre>
import sys
sys.path.insert(0, '..')
</pre>
<p>You can also use the absolute name of the directory that contains the <tt>wikiconfig.py</tt> file instead of <tt>'..'</tt>. </p>

<h3 id="head-b02e2f66403a66cc3b1ff0ce2c7261cf44e4f0d4">Configure Apache</h4>

<p>Now that every file is in place and properly locked down (as far as the filesystem is concerned), we need to configure Apache so that it offers access to the right files, and no others. However, since the default Apache configuration varies a lot according to the distribution you use, and since administrators often make important additions and changes to it, we cannot give exact instructions that cover all cases. Instead, we will first describe roughly what needs to be done, and then give a few specific lines that you should add at the appropriate place in your Apache config. </p>
<p>Your Apache should be set up so that: </p>
<ul>
<li><p> 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). </p>
</li>
<li><p> An alias is set up to redirect requests from <tt>/wiki/</tt> (in the URL) to the <tt>htdocs</tt> directory (in the <tt>share</tt> directory, as discussed at the bottom of <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">../BasicInstallation</a>) </p>
</li>
<li><p> A script alias is set up to redirect requests from whatever you want (we suggest you use your instance name, for example <tt>/mywiki</tt>) to the CGI script you just copied. </p>
</li>
</ul>
<p>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. </p>

<pre>
&gt; echo "" &gt;&gt;/etc/httpd/httpd.conf
&gt; echo "Alias /wiki/ \"$SHARE/htdocs/\"" &gt;&gt;/etc/httpd/httpd.conf
&gt; echo "ScriptAlias /mywiki \"$WIKILOCATION/$INSTANCE/cgi-bin/moin.cgi\"" &gt;&gt;/etc/httpd/httpd.conf
</pre>
<p>You only need to define the alias for <tt>htdocs</tt> once. You need to define a different script alias for each wiki instance you intend to run. </p>

<h3 id="head-ffa39b171f9d130bb07a8481a5fff1a5a9065e86">Configure MoinMoin</h4>

<p>Finally, check that the <tt>wikiconfig.py</tt> file in the instance directory contains correct paths for the htdocs prefix, the instance data directory, and the instance underlay directory. You can use relative paths for the directories, but note that they are relative to the CGI script, not the configuration file! You can also use absolute paths, and save yourself some headaches. </p>
<p>Here are the settings you should have in the config file if you followed all our suggestions: </p>

<pre>
    data_dir = '../data/'
    data_underlay_dir = '../underlay/'
    url_prefix = '/wiki'
</pre>
<p>There are other settings you will likely want to alter, look at the bottom of <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/WikiInstanceCreation">../WikiInstanceCreation</a> for more details about them. </p>

<h3 id="head-0f7a0fb8dccf6a13b6042fa17e0d7cda751fe3f3">Test the wiki</h4>

<p>Everything should work fine now. It is time to <strong>restart the Apache server</strong> (usually with "<tt>/etc/init.d/apache&nbsp;restart</tt>", sometimes with "<tt>apachectl&nbsp;restart</tt>") and perform the following steps: </p>
<ul>
<li><p> Run the <em>MoinMoin CGI Diagnosis</em>: connect to "<tt>http://127.0.0.1/mywiki?action=test</tt>" (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 <em>Checking directories...</em> are <em>OK</em>. </p>
</li>
<li><p> Access your new wiki with the URL "<tt>http://127.0.0.1/mywiki/</tt>" (or the name and port you have defined in the Apache configuration file). You should see the FrontPage. </p>
</li>
<li><p> If this is the case, try to edit it and save your changes. </p>
</li>
<li><p> If that works, see if your edit is reflected on the RecentChanges page. </p>
</li>
<li><p> If you see them, congratulations, your new wiki works! <img src="wiki/htdocs/modern/img/smile.png" alt=":)" height="15" width="15"> </p>
</li>
</ul>
<p>If something goes wrong, have a look at Troubleshooting, at the bottom of this page. </p>

<h3 id="head-52920da3312438e6a484347d4dfaa369b86cb521">Apache tricks</h4>

<p>For more advanced configuration and some tricks see <a href="http://moinmaster.wikiwikiweb.de/HelpMiscellaneous">HelpMiscellaneous</a>. </p>

<h2 id="head-e559f024646d8751eee1135ad5423247d72ab7fd">Simple user (home directory installation)</h3>

<p>On machines shared by many people, simple users typically have no access to the root account, cannot modify the <tt>httpd.conf</tt> file, and cannot copy files into the system-wide <tt>cgi-bin</tt> and <tt>htdocs</tt> 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 <tt>UserDir</tt> directive. If the machine administrator decides to use it, all URLs that start with "<tt>/~username</tt>" will be redirected to a directory in the users' home directories, where they have write permission and can install MoinMoin. </p>
<p>As an example, we will consider the case of a user named "<tt>mm</tt>". Of course, wherever you see "<tt>mm</tt>" below, you will replace it with your own username. </p>

<h3 id="head-6a39e2829f37fd34c569c2ffa768c9b3ec2289cc">Make sure /~username works</h4>

<p>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 <tt>public_html</tt> subdirectory in the home directory is used as the web site root. So, the first first step is to check if that directory exists. </p>

<pre>
&gt; ls -ld ~/public_html
drwxr-xr-x   2 mm       users        4096 Nov 30 00:29 public_html
</pre>
<p>If the directory does not exist, create it, and be sure it can be read and entered by the web server. </p>

<pre>
&gt; mkdir public_html
&gt; chmod a+rx public_html
&gt; ls -ld ~/public_html
drwxr-xr-x   2 mm       users        4096 Nov 30 00:35 public_html
</pre>
<p>Now, check if the "<tt>/~mm</tt>" URL works: </p>

<pre>
&gt; lynx -error_file=/dev/stderr -dump http://localhost/~mm/ &gt;/dev/null
URL=http://localhost/~mm/ (GET)
STATUS=HTTP/1.1 200 OK
</pre>
<p>If you get a "<tt>200&nbsp;OK</tt>" response code, then it works, and you can go on to the next check. If you get a "<tt>403&nbsp;Forbidden</tt>" or a "<tt>404&nbsp;Not&nbsp;Found</tt>" response, then maybe something is wrong with your directory, or maybe the whole thing has not been enabled by your administrator. </p>
<ul>
<li><p> Check the permissions for your home directory (<tt>~</tt>) and your <tt>public_html</tt> directory. The first one should at least end with "<tt>--x</tt>", and the second one, as we saw above, with "<tt>r-x</tt>". </p>
</li>
<li><p> It also possible that the administrator has set up another name for the personal web site directory. "<tt>public_html</tt>" is just the usual default, but anything can actually be used. There is no way to know, you have to ask the administrator (root). </p>
</li>
<li><p> Finally, if the personal web site feature is disabled, maybe you can ask the administrator to enable it? </p>
</li>
</ul>
<p>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: </p>

<pre>
&gt; mkdir -p ~/public_html/cgi-bin
&gt; cat &gt; ~/public_html/cgi-bin/test.cgi
#!/bin/sh
echo Content-Type: text/plain
echo
echo "CGI scripts work"
&lt;CTRL-D&gt;
&gt; chmod a+rx ~/public_html/cgi-bin/test.cgi
&gt; lynx -dump http://localhost/~jh/cgi-bin/test.cgi
CGI scripts work
</pre>
<p>If you get anything else than "<tt>CGI&nbsp;scripts&nbsp;work</tt>", 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. </p>
<p>Once you get it, you can set up your wiki instance in the <tt>public_html</tt> directory. <img src="wiki/htdocs/modern/img/smile.png" alt=":)" height="15" width="15"> </p>

<h3 id="head-c27688fbe7f65d67190a47ce8d32eba244ab0d01-2">Create a wiki instance</h4>

<p>Creating a wiki instance involves copying files around and setting appropriate permissions. Read <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/WikiInstanceCreation">../WikiInstanceCreation</a> and follow the steps described there. </p>

<h3 id="head-ec9ce458a3f08281e5906f6d1e2e5cc008d620db">Install the htdocs files</h4>

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

<pre>
&gt; cd ~/public_html
&gt; cp -R ~/share/moin/htdocs wiki
&gt; chmod -R a+rX wiki
</pre>

<h3 id="head-e3e9e08058bb0ae34c33f53367cd58d6c7411998-2">Install moin.cgi</h4>

<p>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: </p>

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

<h3 id="head-408a7a283b2406c4e6b24646b25ec7996d5ff459-2">Configure moin.cgi</h4>

<p>When <tt>moin.cgi</tt> 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 <tt>moin.cgi</tt> script to correct that. Add these lines near the top of the file: </p>

<pre>
import sys
sys.path.insert(0, '/home/mm/lib/python2.3')
sys.path.insert(0, '/home/mm/lib/python2.3/site-packages')
sys.path.insert(0, '/home/mm/share/moin/mywiki')
</pre>
<p>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 <tt>wikiconfig.py</tt> file. </p>
<p><strong>Note:</strong> 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 "<tt>#!&nbsp;/usr/bin/python2.3</tt>" might help you if the default does not work. </p>
<p><strong>Note 2:</strong> In this file there is a line reading <tt>request&nbsp;=&nbsp;RequestCGI()</tt>. If you have a complex mod_rewrite case, you might want to add <tt>properties&nbsp;=&nbsp;{'script_name':&nbsp;'/mywiki'}&nbsp;</tt> in the parenthesis. This will let <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> generate URLs that start with <tt>/mywiki</tt> and not the path that the webserver passed to <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a>. </p>

<h3 id="head-ffa39b171f9d130bb07a8481a5fff1a5a9065e86-2">Configure MoinMoin</h4>

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

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

<h3 id="head-0f7a0fb8dccf6a13b6042fa17e0d7cda751fe3f3-2">Test the wiki</h4>

<p>Everything should work fine, now. It is time to perform the following steps: </p>
<ul>
<li><p> Run the <em>MoinMoin CGI Diagnosis</em>: <tt>&gt;&nbsp;lynx&nbsp;-dump&nbsp;http://localhost/~mm/cgi-bin/moin.cgi?action=test</tt> </p>
</li>
<li><p> If it worked, try to access your new-born wiki with the URL "<tt>http://127.0.0.1/~mm/cgi-bin/moin.cgi</tt>". You should see the FrontPage. </p>
</li>
<li><p> If this is the case, try to edit it and save your changes. </p>
</li>
<li><p> If that works, see if your edit is reflected on the RecentChanges page. </p>
</li>
<li><p> If you see them, congratulations, you have a new wiki! <img src="wiki/htdocs/modern/img/smile.png" alt=":)" height="15" width="15"> </p>
</li>
</ul>
<p>If something goes wrong, have a look at Troubleshooting, below. </p>

<h2 id="head-3f286acb05ce4ad64240f788c78a8f915f59e34e">Troubleshooting</h3>

<p>See also <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/TroubleShooting">../TroubleShooting</a> for generic stuff. </p>
<p>The first thing to do when your wiki does not work as expected is to issue the command "<tt>tail&nbsp;/var/log/httpd/error_log</tt>" to display the most recent errors. Usually, you will get a hint on what went wrong, like missing file system permissions. </p>

<h3 id="head-b8c0d1c1aba9cd39d0d15f86ea33025f7f25d48d">Adding permission to serve the htdocs directory</h4>

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

<pre>
# forbid access to the entire filesystem by default
&lt;Directory /&gt;
  Options None
  AllowOverride None
  Order deny,allow
  Deny from all
&lt;/Directory&gt;
</pre>
<p>To allow Apache to serve directories outside of the document root you have to add these lines to "<tt>/etc/httpd/httpd.conf</tt>" (in SuSE it is recommended to create a new "<tt>http.conf.local</tt>" and include this file in "<tt>/etc/sysconfig/apache2</tt>"): </p>

<pre>
Alias /wiki/ "/usr/share/moin/htdocs/"
&lt;Directory "/usr/share/moin/htdocs/"&gt;
   Order deny,allow
   Allow from all
&lt;/Directory&gt;

ScriptAlias /mywiki "/usr/share/moin/mywiki/cgi-bin/moin.cgi"
&lt;Directory "/usr/share/moin/mywiki/cgi-bin"&gt;
   Order deny,allow
   Allow from all
&lt;/Directory&gt;
</pre>
<p>Of course, you need to adapt the paths to your particular situation. </p>
<a id="bottom_Include_HelpOnInstalling/ApacheOnLinux"></a>
</div>
 </p>
<hr class="hr2">
<p> <a id="fastcgi-install"></a>
 
<h1>FastCGI Setup using Apache</h1>

<div lang="en" id="Include_HelpOnInstalling/ApacheWithFastCgi" dir="ltr">
<a id="top_Include_HelpOnInstalling/ApacheWithFastCgi"></a>
<h2 id="head-6839f37b445b94c0c179f023498969fb53e3d925">Using MoinMoin with apache + mod_fastcgi</h3>

<p><a class="external" href="http://fastcgi.com"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> FastCGI</a> is a method which enables apache to communicate with long-running scripts. This has the advantage that the script is only started and initialized one time, and that data could be cached in memory from request to request, enhancing the performance of the CGI application. </p>

<h3 id="head-a37ae17ad8fb640605fa790fcef7b8cbf0b29353">Deploying MoinMoin with apache + mod_fastcgi</h4>

<p>To deploy <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> using FastCGI you need an apache with mod_fastcgi. Please refer to the documentation of mod_fastcgi how to build it. </p>
<p>Follow the basic apache installation for your operating system as described in other parts of the <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> installation documentation. This is <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/ApacheOnLinux">HelpOnInstalling/ApacheOnLinux</a> in most cases. In places where the documentation refers to <tt>moin.cgi</tt> you use <tt>moin.fcg</tt> instead. Be sure that <strong>.fcg</strong> is handled by the FastCGI module (<tt>AddHandler&nbsp;fastcgi-script&nbsp;.fcg</tt> in your apache config). </p>
<p>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 <tt>FastCgiWrapper&nbsp;On</tt> in your apache config (see FastCGI Documentation). </p>
<p>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! </p>

<h3 id="head-cd07429ac863a0a4bf393f5936fbccbffe17e9b4">Running as an external application and/or on Windows</h4>

<p><img src="wiki/htdocs/modern/img/alert.png" alt="/!\" height="15" width="15"> Experimental. </p>
<p><a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> 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 <tt>mod_fastcgi</tt> and a working <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> instance) is this: </p>
<ol type="1">
<li><p>Select a port number for the internal communication. It should be larger than 1023. For this example, we chose 8888 (just for fun). </p>
</li>
<li class="gap"><p>Add the following lines to your httpd.conf:
</p>
<pre>
Alias /moin.fcg "/your/path/to/moin.fcg"
FastCgiExternalServer "/your/path/to/moin.fcg" -host localhost:8888
</pre>
</li>
<li class="gap"><p>Edit <tt>moin.fcg</tt>. Replace
</p>
<pre>
fcg = thfcgi.THFCGI(handle_request)
</pre>
<p> with 
</p>
<pre>
fcg = thfcgi.THFCGI(handle_request, 0, 8888)
</pre>
</li>
<li class="gap"><p>Start the file <tt>moin.fcg</tt> manually like a Python script:
</p>
<pre>
python moin.fcg
</pre>
</li>
<li class="gap"><p>Start Apache. </p>
</li>
<li class="gap"><p>Enjoy <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> running with FastCGI support! </p>
</li>
</ol>

<h3 id="head-4f0ae2079d5166e93d946467cf44f193f0c8e571">Add a safe fallback</h4>

<p>Install and test <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> according to <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/ApacheOnLinux">HelpOnInstalling/ApacheOnLinux</a>. Then make and test the changes to run mod_fastcgi. If you are satisfied, you can add the following block to your apache config: 
</p>
<pre>
&lt;IfModule !mod_fastcgi.c&gt;
    ScriptAlias /mywiki "/your/path/to/moin.cgi"
&lt;/IfModule&gt;
&lt;IfModule mod_fastcgi.c&gt;
    AddHandler fastcgi-script .fcg
    ScriptAlias /mywiki "/your/path/to/moin.fcg"
&lt;/IfModule&gt;
</pre>
<p>Now Apache will use mod_fastcgi if available and otherwise use the slow cgi script. </p>
<a id="bottom_Include_HelpOnInstalling/ApacheWithFastCgi"></a>
</div>
 </p>
<hr class="hr2">
<p> <a id="modpy-install"></a>
 
<h1>mod_python Setup using Apache</h1>

<div lang="en" id="Include_HelpOnInstalling/ApacheWithModPython" dir="ltr">
<a id="top_Include_HelpOnInstalling/ApacheWithModPython"></a><ol>
<li><a href="#head-4e6235e8e3535359b4aa9df9722961dfd62a685a">Why Use mod_python</a></li>
<li><a href="#head-52f515a2448d32357136b23a188dd227330baeb2">Basic configuring</a><ol>
<li><a href="#head-8cd6758d1fcc77b433f6584bcc34e24469568d75">Install mod_python</a></li>
<li><a href="#head-671adcfb8441deb9daa6ba877d59cc69d5e9d25e">Set up a wiki instance</a></li>
<li><a href="#head-08923628c7a5b449b5f210251334c431791adec9">Edit `wikiconfig.py`</a></li>
<li><a href="#head-b628477f88ab294636a22af4ee665656a8897b3a">Changes to Apache `httpd.conf`</a></li>
</ol>
<li><a href="#head-2dba68d0d0ad069f1c4a2a46bcdbd07cb21d3887">Solving problems for non-root-mounted wikis</a></li>
<li><a href="#head-e7e935fbfb5a81ceb0698ef82b5b7a897aa5e157">Configuring root wiki</a></li>
<li><a href="#head-53a11a51ff1c262df8f1f287084f8700685446d4">Older mod_python versions</a><ol>
<li><a href="#head-7b2283d5184932488fe551b2cee08e28fb18230c">Use a wrapper script</a></li>
<li><a href="#head-f2a32b29f0aff0101a91c87d692d063a6e0a4ec2">Fix mod_python</a></li>
</ol>
<li><a href="#head-17313e33f7320af70773f484730b290d86b62ee5">Troubleshooting</a></li>
</ol>
<p> </p>

<h1 id="head-4e6235e8e3535359b4aa9df9722961dfd62a685a">Why Use mod_python</h2>

<p><a class="external" href="http://modpython.org/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> mod_python</a> 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. </p>
<p><img src="wiki/htdocs/modern/img/attention.png" alt="&lt;!&gt;" height="15" width="15"> 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" </p>
<p><img src="wiki/htdocs/modern/img/attention.png" alt="&lt;!&gt;" height="15" width="15"> 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 <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/ApacheWithFastCgi">HelpOnInstalling/ApacheWithFastCgi</a> is rather more efficient in this respect. </p>

<h1 id="head-52f515a2448d32357136b23a188dd227330baeb2">Basic configuring</h2>

<ol type="1">
<li><p>Install mod_python </p>
</li>
<li><p>Set up a wiki instance </p>
</li>
<li><p>Edit <tt>wikiconfig.py</tt> </p>
</li>
<li><p>Changes to Apache <tt>httpd.conf</tt> </p>
</li>
<li><p>Restart Apache </p>
</li>
</ol>
<p>The sample configurations below are for a wiki instance called <tt>mywiki</tt> installed in a directory <tt>/var/www/moin/mywiki</tt> with the main <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> installation installed in python's default site library path. The wiki appears as URL <tt>/mywiki</tt> under the server - ie <tt>http://my.ser.ver/mywiki</tt>.  You will need to change these to reflect your installation. </p>

<h2 id="head-8cd6758d1fcc77b433f6584bcc34e24469568d75">Install mod_python</h3>

<p>Most people will just add a <tt>mod_python</tt> package to their current operating system installation.  If you are building from source then you should consult the <a class="external" href="http://modpython.org/live/current/doc-html/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> mod_python documentation</a>. </p>
<p>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 <tt>/etc/httpd/conf.d/python.conf</tt>). </p>
<p>Make sure you have this line in <tt>httpd.conf</tt> or mod_python will not work: 
</p>
<pre>
LoadModule python_module modules/mod_python.so
</pre>
<p>After this restart Apache and make sure that it starts successfully, and that the error log has a line similar to this:- 
</p>
<pre>
[Sat Jan 01 15:40:49 2005] [notice] mod_python: Creating 4 session mutexes based on 150 max processes and 0 max threads.
</pre>
<p>You may need to change some environment variables on (eg) FreeBSD - this is detailed in the port installation message. </p>

<h2 id="head-671adcfb8441deb9daa6ba877d59cc69d5e9d25e">Set up a wiki instance</h3>

<p>This is done as shown in <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/WikiInstanceCreation">WikiInstanceCreation</a>. 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 <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> installation. </p>
<ol type="1">
<li><p>Copy moin.cgi into your wiki directory </p>
</li>
<li><p>Configure <tt>httpd.conf</tt> as cgi first: </p>
<ul>
<li style="list-style-type:none">
<pre>
Alias /wiki/ "/usr/share/moin/htdocs/"
ScriptAlias /mywiki "/var/www/moin/mywiki/moin.cgi"
</pre>
</li>
</ul>
</li>
</ol>
<p>Restart Apache and make test that your wiki works. </p>

<h2 id="head-08923628c7a5b449b5f210251334c431791adec9">Edit `wikiconfig.py`</h3>

<p>Make sure you use only absolute paths - relative paths will not work! 
</p>
<pre>
data_dir = '/var/www/moin/mywiki/data/'
data_underlay_dir = '/var/www/moin/mywiki/underlay/'
</pre>
<p>If you do not want to use absolute paths, you can use Python's os module to construct the relative paths: </p>
<pre>
import os 
data_dir = os.path.join(os.path.dirname(__file__), 'data/')
data_underlay_dir = os.path.join(os.path.dirname(__file__), 'underlay/')
</pre>
<p>Test that the wiki works after this change. </p>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> In 1.2 and earlyer, the configuration file is called <tt>moin_config.py</tt>. </p>
</li>
</ul>

<h2 id="head-b628477f88ab294636a22af4ee665656a8897b3a">Changes to Apache `httpd.conf`</h3>

<p>After your wiki is running as cgi script, convert it to run with mod_python.  </p>
<p>If you run your wiki as cgi as we recommended before, remove or comment the <a class="nonexistent" href="http://moinmaster.wikiwikiweb.de/ScriptAlias">ScriptAlias</a> directive: 
</p>
<pre>
#ScriptAlias /mywiki "/var/www/moin/mywiki/moin.cgi"
</pre>
<p>Add a <tt>Location</tt> directive: 
</p>
<pre>
&lt;Location /mywiki&gt;
    SetHandler python-program
    # Add the path of your wiki directory
    PythonPath "['/var/www/moin/mywiki'] + sys.path"
    PythonHandler MoinMoin.request::RequestModPy.run
&lt;/Location&gt;
</pre>
<p>If you have multiple <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> instances then add one location directive for each one (changing the paths as appropriate) and add a line with the directive <tt>PythonInterpreter&nbsp;mywiki</tt> to each Location section. With this directive different subinterpreters with completely separate namespaces will be used for each wiki (see <a class="external" href="http://modpython.org/live/current/doc-html/pyapi-interps.html"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> here</a> for details). </p>
<p>If you did not install <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> in the default location, you will have to add the path to <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> to the system path: 
</p>
<pre>
    PythonPath "['/var/www/moin/mywiki', '/prefix/lib/python2.x/site-packages'] + sys.path"
</pre>
<p>Restart Apache - everything should now work correctly. </p>

<h1 id="head-2dba68d0d0ad069f1c4a2a46bcdbd07cb21d3887">Solving problems for non-root-mounted wikis</h2>

<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/alert.png" alt="/!\" height="15" width="15"> If your wiki does not have a root URL (like <tt>http://www.example.com/FrontPage</tt>), then you might need to follow the next steps: </p>
</li>
</ul>
<p>On some installations, mod_python hands <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> incorrect script_name and path_info. It usually happens when using the Apache Location directive, with a wiki in an arbitary path: 
</p>
<pre>
&lt;Location /farm/mywiki&gt;
    ...
&lt;/Location&gt;
</pre>
<p>This will not work, because its not clear what is the script name, since with location setup, there is no real script. </p>
<p>To solve this problem, use a <tt>PythonOption</tt> directive: 
</p>
<pre>
&lt;Location /farm/mywiki&gt;
    # Location value must match the Apache Location value!
    PythonOption Location /farm/mywiki
    ...
&lt;/Location&gt;
</pre>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> New in release 1.3.5 </p>
</li>
</ul>

<h1 id="head-e7e935fbfb5a81ceb0698ef82b5b7a897aa5e157">Configuring root wiki</h2>

<p>You may wish to have your wiki appearing at the root of your webserver - for example so that <tt>http://wiki.example.com/</tt> will map to your wiki rather than having to use <tt>http://wiki.example.com/mywiki/</tt>.  This requires a slightly different form of configuration using <tt>mod_rewrite</tt> - this is a standard module of recent Apache distributions, and is often enabled by default. </p>
<p>You need to set up your wiki instance as described above, and also copy <tt>moinmodpy.py</tt> from the Moin installation directory to the wiki instance directory (<tt>/var/www/moin/mywiki</tt> in these examples). </p>
<p>The Apache configuration needs <tt>mod_rewrite</tt> enabled - so the line 
</p>
<pre>
LoadModule rewrite_module modules/mod_rewrite.so
</pre>
<p>should appear in the first part of the <tt>httpd.conf</tt> configuration file. </p>
<p>The wiki and virtual host configuration sould look like this:- 
</p>
<pre>
&lt;VirtualHost *:80&gt;
  ServerAdmin postmaster@example.com
  DocumentRoot /var/www/html
  ServerName wiki.example.com
  Alias /wiki/ "/usr/share/moin/htdocs/"

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

  &lt;Directory "/var/www/moin/testwiki"&gt;
    # Modpy stuff
    AddHandler python-program .py
    # Add the path to the wiki directory, where
    # moinmodpy.py and wikiconfig.py are located.
    PythonPath "['/var/www/moin/mywiki'] + sys.path"
    PythonHandler moinmodpy
  &lt;/Directory&gt;
&lt;/VirtualHost&gt;
</pre>
<p>Apache should be restarted, and the FrontPage of <tt>mywiki</tt> should now appear at <tt>http://wiki.example.com/</tt>. </p>
<p>Other ways of handling root level wikis with Apache are detailed in the appropriately named <a href="http://moinmaster.wikiwikiweb.de/HelpOnConfiguration/ApacheVoodoo">HelpOnConfiguration/ApacheVoodoo</a>. </p>

<h1 id="head-53a11a51ff1c262df8f1f287084f8700685446d4">Older mod_python versions</h2>

<p>mod_python versions 2.7.10, 3.0.4 and 3.1.2b have a bug in <tt>apache.resolve_object</tt>. 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: </p>

<h2 id="head-7b2283d5184932488fe551b2cee08e28fb18230c">Use a wrapper script</h3>

<p><a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> come with a <tt>moinmodpy.py</tt> wrapper script, and this could be used by changing the <tt>PythonPath</tt> and <tt>PythonHandler</tt> directives as shown in the <tt>moinmodpy.htaccess</tt> file. The wrapper was named <tt>moin_modpy.py</tt> in <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> 1.2. </p>

<h2 id="head-f2a32b29f0aff0101a91c87d692d063a6e0a4ec2">Fix mod_python</h3>

<p>mod_python has a small resolver bug in versions 2.7.10, 3.0.4 and 3.1.2b. The method <tt>resolve_object</tt> in <tt>mod_python/apache.py</tt> checks the wrong object, and so the lookup for <tt>RequestModPy.run</tt> fails. </p>
<p>To fix it you need to change the method <tt>resolve_object</tt> (around line 551 for mod_python 3.1.2b) from </p>

<pre>
        if silent and not hasattr(module, obj_str):
            return None
</pre>
<p>to </p>

<pre>
        if silent and not hasattr(obj, obj_str):
            return None
</pre>

<h1 id="head-17313e33f7320af70773f484730b290d86b62ee5">Troubleshooting</h2>

<p>Page access gives apache error:: </p>
<ul>
<li style="list-style-type:none"><p><tt>PythonHandler&nbsp;MoinMoin.request::RequestModPy.run:&nbsp;OSError:&nbsp;[Errno&nbsp;2]&nbsp;No&nbsp;such&nbsp;file&nbsp;or&nbsp;directory:&nbsp;'data/user'</tt> This appears to be caused by you not having an absolute path for <tt>data_dir</tt> in <tt>moin_config.py</tt>.  There are several other lines of error traceback preceding this one in the apache error log.  Fix the path in <tt>moin_config.py</tt>. </p>
</li>
</ul>
<a id="bottom_Include_HelpOnInstalling/ApacheWithModPython"></a>
</div>
 </p>
<hr class="hr2">
<p> <a id="twisted-install"></a>
 
<h1>Setup using Twisted</h1>

<div lang="en" id="Include_HelpOnInstalling/TwistedWeb" dir="ltr">
<a id="top_Include_HelpOnInstalling/TwistedWeb"></a>
<h1 id="head-aadc9ea90352d5b5ad5745583f12238abc07f6b1">Using MoinMoin with Twisted</h2>

<p><a class="external" href="http://twistedmatrix.com"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> Twisted</a> is a standalone python framework for many kinds of applications. For <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a>, we use Twisted as a python web server that just imports <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> persistently. </p>
<p>This has the advantage that the Python interpreter and all Python scripts (including Twisted itself and also <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a>) is only loaded and initialized one time, and that data can be cached in memory from request to request, enhancing the performance of <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a>. </p>
<p>Another advantage is that this is all based on Python. <img src="wiki/htdocs/modern/img/smile4.png" alt=";)" height="15" width="15"> </p>
<p>First do <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">../BasicInstallation</a> and <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/WikiInstanceCreation">../WikiInstanceCreation</a>. </p>

<h2 id="head-781019b7b4433e2b39a07387d381c1ca28eb9134">Install Twisted</h3>

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

<h2 id="head-f377d8187c2c46a84ee4a6ae292b323853a6ae0c">Configuring the Twisted server</h3>

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

<h3 id="head-6cf160dca6339d0a63474b5e9d1c94115980d292">System path configuration</h4>

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

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

<h3 id="head-a51f43e6a56656fb4ff7b17d487afc09442427b5">Config class options</h4>

<p>If you did a standard install, the default options might be just what you need. Check and change what you like: </p>
<div>
<table>
<tr>
<td>
<p> <strong>Option</strong> </p>
</td>
<td>
<p> <strong>Default</strong> </p>
</td>
<td>
<p> <strong>Comment</strong> </p>
</td>
</tr>
<tr>
<td>
<p> docs </p>
</td>
<td>
<p> '/usr/share/moin/wiki/htdocs' </p>
</td>
<td>
<p> Path to moin shared files </p>
</td>
</tr>
<tr>
<td>
<p> user </p>
</td>
<td>
<p> 'www-data' </p>
</td>
<td>
<p> If you run as root, the server will run as this user </p>
</td>
</tr>
<tr>
<td>
<p> group </p>
</td>
<td>
<p> 'www-data' </p>
</td>
<td>
<p> If you run as root, the server will run as this group </p>
</td>
</tr>
<tr>
<td>
<p> port </p>
</td>
<td>
<p> 8080 </p>
</td>
<td>
<p> Port to serve. To serve a privileged port below 1024 you will have to run as root </p>
</td>
</tr>
<tr>
<td>
<p> interfaces </p>
</td>
<td>
<p> <tt>['']</tt> </p>
</td>
<td>
<p> A list of interfaces the server will listen to. If the list contains the entry <tt>''</tt> (like for the default configuration), all other entries are ignored and the server will listen to all interfaces. </p>
</td>
</tr>
<tr>
<td>
<p> logPath </p>
</td>
<td>
<p> 'mointwisted.log' </p>
</td>
<td>
<p> Log file. </p>
</td>
</tr>
<tr>
<td>
<p> profiler </p>
</td>
<td>
<p> commented python code </p>
</td>
<td>
<p> Useful only if you are a moin developer. </p>
</td>
</tr>
</table>
</div>

<h2 id="head-e4c385b7866dfc82bdf390d00038d1e191cd6870">Configuring wikiconfig.py</h3>

<p>The sample config file should be just fine. </p>
<div>
<table>
<tr>
<td>
<p> <strong>Option</strong> </p>
</td>
<td>
<p> <strong>Default</strong> </p>
</td>
<td>
<p> <strong>Comment</strong> </p>
</td>
</tr>
<tr>
<td>
<p> url_prefix </p>
</td>
<td>
<p> '/wiki' </p>
</td>
<td>
<p> You should not change this, or images and css file will not be available to the wiki! </p>
</td>
</tr>
</table>
</div>

<h2 id="head-828a44c0e867e6f0fb60395a972cb6003658f76f">Starting the server on Unix</h3>

<p>On GNU/Linux, Mac OS X or another POSIX-like OS, copy <tt>wiki/server/mointwisted</tt> to your wiki directory. You might want to adapt <tt>PYTHONPATH</tt> and the path to <tt>twistd</tt>.  </p>
<p>Start the server with <tt>./mointwisted&nbsp;start</tt> and test your wiki at <a href="http://localhost:8080/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://localhost:8080/</a>. Stop the server with <tt>./mointwisted&nbsp;stop</tt>. </p>
<p>For more options run <tt>./mointwisted</tt> without arguments. </p>

<h2 id="head-0457c39c25e65945e29141fa8f207afe318806fe">Starting the server on Windows</h3>

<p>Copy <tt>wiki/server/mointwisted.cmd</tt> to your wiki directory. You might have to change the path pointing to the python-scripts directory. </p>
<p>Double click <tt>mointwisted.cmd</tt> to start the server. It will create a new terminal window. To stop the server, close the terminal window. </p>
<a id="bottom_Include_HelpOnInstalling/TwistedWeb"></a>
</div>
 </p>
<hr class="hr2">
<p> <a id="linuxstandalone-install"></a>
 
<h1>Linux Installation using standalone server</h1>

<div lang="en" id="Include_HelpOnInstalling/StandaloneServer" dir="ltr">
<a id="top_Include_HelpOnInstalling/StandaloneServer"></a><p><strong>Installing and configuring standalone server</strong> </p>
<p>See also: <a href="http://moinmaster.wikiwikiweb.de/HelpOnConfiguration/IntegratingWithApache">HelpOnConfiguration/IntegratingWithApache</a> </p>
<p>The standalone server is especially made for local wikis because it does not need a web server installed. Only Python and Moin are necessary! </p>
<p>To install and run the standalone server: </p>
<ol type="1">
<li><p>If <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> is not installed yet, preform <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">../BasicInstallation</a> </p>
</li>
<li><p>Create a wiki instance as described in <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/WikiInstanceCreation">../WikiInstanceCreation</a> </p>
</li>
<li><p>Copy <tt>moin.py</tt> to your wiki directory, where your <tt>wikiconfig.py</tt> is </p>
</li>
<li><p>If you installed with <tt>--prefix</tt> option, you must edit moin.py and set <tt>docs</tt> to the correct path. </p>
</li>
<li><p>Run <tt>moin.py</tt> </p>
</li>
<li><p>Access your wiki at <a href="http://localhost:8000/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://localhost:8000/</a> </p>
</li>
</ol>
<p>On most cases, the default settings will be just fine. You many want to edit <tt>moin.py</tt> and change some of the options, as described in the next section. </p>

<h1 id="head-b104ff56fc1c89199447f1f2756b65995534e032">Configuring moin.py</h2>


<h2 id="head-5d2a2fc430a567acd72fcaa712af23333abca0df">System path configuration</h3>

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

<pre>
import sys
sys.path.insert(0, '/path/to/moin')
sys.path.insert(0, '/path/to/wikiconfig')
</pre>
<a id="options"></a>
<p> </p>

<h2 id="head-3cb7180f429490b9735cfc083869eaaa128ed64c">Config class options</h3>

<div>
<table>
<tr>
<td>
<p> <strong>Option</strong> </p>
</td>
<td>
<p> <strong>Default</strong> </p>
</td>
<td>
<p> <strong>Comment</strong> </p>
</td>
</tr>
<tr>
<td>
<p> name </p>
</td>
<td>
<p> <tt>'moin'</tt> </p>
</td>
<td>
<p> Server name, used by default for log and pid files. <img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> New in 1.5 </p>
</td>
</tr>
<tr>
<td>
<p> docs </p>
</td>
<td>
<p> <tt>'/usr/share/moin/wiki/htdocs'</tt> </p>
</td>
<td>
<p> Path to moin shared files. If you used <tt>--prefix</tt> install, the default path will not work, and you must set the path to <tt>'PREFIX/share/moin/wiki/htdocs'</tt>. </p>
</td>
</tr>
<tr>
<td>
<p> user </p>
</td>
<td>
<p> <tt>'www-data'</tt> </p>
</td>
<td>
<p> If you run as root, the server will run with as this user </p>
</td>
</tr>
<tr>
<td>
<p> group </p>
</td>
<td>
<p> <tt>'www-data'</tt> </p>
</td>
<td>
<p> If you run as root, the server will run with as this group </p>
</td>
</tr>
<tr>
<td>
<p> port </p>
</td>
<td>
<p> <tt>8000</tt> </p>
</td>
<td>
<p> Port to serve. To serve privileged port under 1024 you will have to run as root </p>
</td>
</tr>
<tr>
<td>
<p> interface </p>
</td>
<td>
<p> <tt>'localhost'</tt> </p>
</td>
<td>
<p> The interface the server will listen to. The default will listen only to localhost. Set to <tt>''</tt> to listen to all.</p>
</td>
</tr>
<tr>
<td>
<p> logPath </p>
</td>
<td>
<p> <tt>name&nbsp;+&nbsp;'.log'</tt> </p>
</td>
<td>
<p> Log file. Default is commented. </p>
</td>
</tr>
<tr>
<td>
<p> serverClass </p>
</td>
<td>
<p> <tt>'ThreadPoolServer'</tt>, <tt>'ThreadingServer'</tt>, <tt>'ForkingServer'</tt>, <tt>'SimpleServer'</tt> </p>
</td>
<td>
<p> The server type to use, see the comments in the <tt>moin.py</tt>. The default is <tt>'ThreadPoolServer'</tt>, which create a pool of threads and reuse them for new connections. <img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> New in 1.3.5 </p>
</td>
</tr>
<tr>
<td>
<p> threadLimit </p>
</td>
<td>
<p> <tt>10</tt> </p>
</td>
<td>
<p> How many threads to create. <img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> New in 1.3.5 </p>
</td>
</tr>
<tr>
<td>
<p> requestQueueSize </p>
</td>
<td>
<p> <tt>50</tt> </p>
</td>
<td>
<p> The count of socket connection requests that are buffered by the operating system. <img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> New in 1.3.5 </p>
</td>
</tr>
<tr>
<td>
<p> properties </p>
</td>
<td>
<p> <tt>&nbsp;{}&nbsp;</tt> </p>
</td>
<td>
<p> allow overriding any request property by setting the value in this dict e.g <tt>properties&nbsp;=&nbsp;{'script_name':&nbsp;'/mywiki'</tt>}. <img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> New in 1.5 </p>
</td>
</tr>
</table>
</div>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> There may be more options useful to moin developers, see the comments in <tt>moin.py</tt> </p>
</li>
</ul>

<h1 id="head-09dea245aaa1a9c2da2585949e627adb3e22284d">Configuring wikiconfig.py</h2>

<p>The sample config file should be just fine. </p>
<div>
<table>
<tr>
<td>
<p> <strong>Option</strong> </p>
</td>
<td>
<p> <strong>Default</strong> </p>
</td>
<td>
<p> <strong>Comment</strong> </p>
</td>
</tr>
<tr>
<td>
<p> url_prefix </p>
</td>
<td>
<p> '/wiki' </p>
</td>
<td>
<p> You should not change this, or images and css file will not be available to the wiki! </p>
</td>
</tr>
</table>
</div>

<h1 id="head-97336ff12bb113d4f2b55edf2d4c433001e6e54e">Starting the server</h2>

<p>Run <tt>moin.py</tt> from the command line: 
</p>
<pre>
$ ./moin.py
Serving on localhost:8000
</pre>
<p>Test your wiki at <a href="http://localhost:8000/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://localhost:8000/</a> </p>
<p>On Windows, you can double click <tt>moin.py</tt> to start the server. A new terminal window will be opened. Close the window or press <tt>Control&nbsp;+&nbsp;Pause</tt> to stop the server. </p>
<p>On Unix, interrupt the server with <tt>Control&nbsp;+&nbsp;C</tt> in order to shut it down. </p>

<h1 id="head-3da0e8e1ef007d5e29a21fda332f1982c4e7140b">Serving port 80 on Unix</h2>

<p>On GNU/Linux, Mac OS X or other Posix like OS, you can serve the standard port 80 used for web serving, but you must run as <tt>root</tt> for this. </p>
<p>Set <tt>port</tt> to 80, and verify that <tt>user</tt> and <tt>group</tt> exists on your system. If not, set them to an existing user, meant for web serving. If needed, <tt>chown</tt> your wiki dir to this user and group. </p>
<p>Run <tt>moin.py</tt> as root: 
</p>
<pre>
$ sudo moin.py
Password:
Serving on localhost:8000
Running as uid/gid 70/70
</pre>
<p>Test your wiki at <a href="http://localhost/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://localhost/</a> </p>

<h1 id="head-79336bdc41d8a5136baf30cad5a31b8c49b7c57b">Running as daemon</h2>

<p>If run on Unix, you can run moin.py as a background process: </p>
<ol type="1">
<li><p>Have a working <tt>moin.py</tt> as explained above </p>
</li>
<li><p>Copy the file <tt>prefix/share/moin/server/moin</tt> to your wiki directory. </p>
</li>
<li><p>Start moin server: </p>
</li>
</ol>

<pre>
./moin start
</pre>
<p>To stop the server: 
</p>
<pre>
./moin stop
</pre>
<p>For more info run <tt>moin</tt> with no arguments. </p>
<p>If you want to start moin from a system startup script, you may need to add the path to <tt>moin.py</tt> in the top of the script: 
</p>
<pre>
# Add the path to moin.py directory 
import sys
sys.path.insert(0, '/path/to/moin')
</pre>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> New in release 1.5 </p>
</li>
</ul>
<a id="bottom_Include_HelpOnInstalling/StandaloneServer"></a>
</div>
 </p>
<hr class="hr2">
<p> <a id="macosx-install"></a>
 
<h1>Mac OS X Installation using Apache</h1>

<div lang="en" id="Include_HelpOnInstalling/ApacheOnMacOsx" dir="ltr">
<a id="top_Include_HelpOnInstalling/ApacheOnMacOsx"></a><p>You must not be afraid to use the terminal. It is possible but much harder to install without using the terminal. </p>
<p>There are 2 step in the installation: </p>
<ol type="1">
<li><p>Install the <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> engine - once </p>
</li>
<li><p>Create wiki instance. You can create and serve as many wikis as you like. </p>
</li>
</ol>

<h1 id="head-c94edbb5fa226613bc614ed4817a423e49bfab74">Installing MoinMoin</h2>


<h2 id="head-fab7fde843537e1c43e51293df06cf230070066f">Download</h3>

<p>Download the source on the Desktop. You should see a <tt>moin-1.3.tar.gz</tt> file. Extract this file on the desktop with Stuffit Expander, or from the terminal (faster and safer): 
</p>
<pre>
cd ~/Desktop
tar -xzf moin-1.3.0.tar.gz
</pre>

<h2 id="head-fe44f2863565a3eaecef0a33bc1e9a1f4c96638f">Install procedure</h3>

<p>Use these commands in the terminal to install the MoinMoin wiki engine into the system. </p>
<p>First, open a shell as root. You will need this to install <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> and configure the wiki. When asked, enter your password. 
</p>
<pre>
sudo -s
... password:
</pre>
<p>Now you have root privileges in this shell. </p>
<p>Install: 
</p>
<pre>
cd moin-1.3.0
python setup.py install --install-data='/usr/local'
</pre>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> The --install-data='/usr/local' will put the shared data in the convenient <tt>'/usr/local/share/moin'</tt> folder. If you don't use it, your shared data will be at <tt>'/System/Library/Frameworks/Python.framework/Versions/2.3/share/moin'</tt>. On Mac OS X, '/usr' belong to Apple, and it is safer to install in '/usr/local'. </p>
<p><img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> The default Python used by Apache is the framework one supplied by Apple.  If you have added another Python version such as through <a class="nonexistent" href="http://moinmaster.wikiwikiweb.de/DarwinPorts">DarwinPorts</a> or Fink, then you should substitute "/usr/bin/python" for "python" above or you should substitute the specific path for the Python that will be used by Apache. </p>
</li>
</ul>
<p>Now the installation is finished. You will not have to repeat this step unless you upgrade moin. </p>

<h2 id="head-7cf05b3d73a21fa16eabfdced354c3e079182014">Optional Installs</h3>


<h3 id="head-223faa3a0e587eb269f79e3faf05d3851d778e8d">RSS</h4>

<p>If you want your wiki to support RSS and Mozilla Firefox Live Bookmarks features, you have to install PyXML. Get PyXML from <a href="http://sourceforge.net/projects/pyxml/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://sourceforge.net/projects/pyxml/</a> and install according to the instructions. </p>

<h1 id="head-0cd30234950a8438af556cb7a93ef4dd346358a3">Creating a wiki</h2>

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

<h2 id="head-df71f35b5f6ca32f75dd1e1d9c71a7113906c308">Copying a template wiki</h3>

<p>Copy a template wiki from the <tt>/usr/local/share/moin</tt>. Do not try to run the wiki from <tt>/usr/local/share/moin/data</tt> because your wiki will be overwritten when you install a new version of moin. </p>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/attention.png" alt="&lt;!&gt;" height="15" width="15"> <strong>Security warning: do not put your wiki folder where the web server can access it! Your wiki should not be at the "Sites" folder in your home folder.</strong> </p>
</li>
</ul>
<p>The following instructions will create a wiki called "mywiki". You can choose any name you like, except the reserved name "wiki". </p>
<p>Do these commands: 
</p>
<pre>
cd /usr/local/share/moin
mkdir mywiki
cp -r data mywiki
cp -r underlay mywiki
cp server/moin.cgi mywiki
cp config/wikiconfig.py mywiki
</pre>

<h2 id="head-49456651956c5f3bbba97c6917e54be2420fbf14">Setting Permissions</h3>

<p>You have to make the web server the owner of the files in your wiki. Unless you changed the default configuration, both are 'www'. 
</p>
<pre>
chown -R www:www mywiki
chmod -R ug+rwX mywiki
chmod -R o-rwx mywiki
</pre>

<h2 id="head-31a82db9b85a63663e1b46abf203b3c0abdb5fad">Configure Apache</h3>

<p>We'll use the pico editor: 
</p>
<pre>
pico /etc/httpd/httpd.conf
</pre>
<p>Go to the end of the Aliases section and edit like the example below: 
</p>
<pre>
    Alias /wiki/ "/usr/local/share/moin/htdocs/"      
    ScriptAlias /mywiki "/usr/local/share/moin/mywiki/moin.cgi"       
</pre>
<p>Use Control+O to save the file and Control+X to exit pico. </p>
<p>Restart Apache - open System Preferences, go to the Sharing page, select "Personal Web Sharing" and click "Stop" then "Start". Or just type this instead: 
</p>
<pre>
apachectl graceful
... /usr/sbin/apachectl graceful: httpd gracefully restarted
</pre>
<p>Instance creation finished - exit from the shell with the root privileges - working as root is dangerous. 
</p>
<pre>
exit
</pre>
<p>Now you are running again safely. </p>

<h2 id="head-eb585ff24f9cd4b445a74b848cd1c5ec2b10706a">Testing Your New Wiki</h3>

<p>In a web-browser surf to the site: <a href="http://localhost/mywiki"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://localhost/mywiki</a> </p>
<p>You should see the FrontPage of your new wiki. </p>
<p>Now run the unit tests, to make sure everything is fine. Go to this address: <a href="http://localhost/mywiki?action=test"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://localhost/mywiki?action=test</a> </p>
<p>You should see a report on the wiki and tests results for the <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> engine. If some of the tests fail, please report the problem on <a class="external" href="http://moinmoin.wikiwikiweb.de/MoinMoinBugs"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> MoinMoinBugs</a>. </p>

<h2 id="head-14a0f4b701dc07823ca965841351a2bd3d021b8e">Configuring Your wiki</h3>

<p>The wiki you created is a new "Untitled Wiki", using the default configuration. You want to give a better name and setup some configuration values. Open <tt>wikiconfig.py</tt> and read the comments. You can edit the file with any text editor, like pico, emacs, or BBEdit.  </p>
<ul>
<li style="list-style-type:none"><p><img src="wiki/htdocs/modern/img/idea.png" alt="(!)" height="15" width="15"> Note that the file belongs to user and group www:www. You can edit the file as root, or change the group of the file to yourself with <tt>chown&nbsp;www:username&nbsp;wikiconfig.py</tt>. </p>
</li>
</ul>
<p>For more help on configuration, see <a href="http://moinmaster.wikiwikiweb.de/HelpOnConfiguration">HelpOnConfiguration</a>. </p>
<a id="bottom_Include_HelpOnInstalling/ApacheOnMacOsx"></a>
</div>
 </p>
<hr class="hr1">
<p> <a id="win32apache-install"></a>
 
<h1>Windows Installation using Apache</h1>

<div lang="en" id="Include_HelpOnInstalling/ApacheOnWin32" dir="ltr">
<a id="top_Include_HelpOnInstalling/ApacheOnWin32"></a><p><strong>Index</strong> <ol>
<li><a href="#head-3c727e631e2668b26b0f23f76dfaca64e810648e">Requirements</a></li>
<li><a href="#head-18c7f9f6c7f20cad8a2598f80aba6a6b36bae585">Preparation</a><ol>
<li><a href="#head-ce3f1899eb42247cc89c79893ca80eb5da56d2d4">MSI Installer</a></li>
<li><a href="#head-b1287e95efcad1b36cc2c15f825e1de198ebfcf6">Installing Apache</a></li>
<li><a href="#head-55b68c00864e2a0be48f87115a45f6a17a76bcc0">Installing Python</a></li>
</ol>
<li><a href="#head-c76f9a659995f587c02878baf3877ab5bd08a5bd">Installing MoinMoin</a></li>
<li><a href="#head-ba9ed0d8dd27b7bc62472aa0d24e8102dd103deb">Creating a Wiki Instance</a></li>
<li><a href="#head-42c812a9d38d3af1de6c09ed952ac1858c5221b8">Integrating MoinMoin into Apache</a></li>
<li><a href="#head-82ba5417401e5b5cb78836b4f23ef160fbc80630">Troubleshooting</a><ol>
<li><a href="#head-01d84d7e6494dcee0bd2abfbb04f43f812c9bdd7">Internal Server Error</a></li>
<li><a href="#head-7a4c0881ccb7242b9857811b27dc07ad836889d0">Not Found</a></li>
<li><a href="#head-d9b4f0491158f7280b4bf1693d990336527ebf4d">The Page Cannot be found</a></li>
<li><a href="#head-d47936fa3c21c07d857b27fdb811e5836635a100">FrontPage Loads Without Icons</a></li>
</ol>
</li>
</ol>
 </p>

<h2 id="head-3c727e631e2668b26b0f23f76dfaca64e810648e">Requirements</h3>

<p>Before you install MoinMoin, you must have the necessary infrastructure in place. This procedure explains the steps necessary to install the infrastructure and provides detailed instructions for the installation of MoinMoin.  </p>
<p>Downloading and installing all of the required components will require almost 100 MB of disk space - shouldn't be a problem nowadays, right? </p>
<p>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 <strong>Reference</strong> name in the table below as the installed location for each product. Substitute your real installation location when editing configuration files and entering commands. </p>
<div>
<table>
<tr style="background-color: #EEDDAA;">
<td>
<p>Reference</p>
</td>
<td>
<p>Product</p>
</td>
<td>
<p>Installation Default or Typical Name</p>
</td>
</tr>
<tr>
<td>
<p><strong>C:\Apache</strong></p>
</td>
<td>
<p> Apache</p>
</td>
<td>
<p>C:\Program Files\Apache Group\Apache2</p>
</td>
</tr>
<tr>
<td>
<p><strong>C:\Python</strong></p>
</td>
<td>
<p>Python</p>
</td>
<td>
<p>C:\Python22</p>
</td>
</tr>
<tr>
<td>
<p><strong>C:\Moin</strong></p>
</td>
<td>
<p>wiki instances</p>
</td>
<td>
<p>C:\My Documents\Moin</p>
</td>
</tr>
</table>
</div>
<p>This installation procedure was tested with Apache 1.3.26 and Apache 2.0.44 for Windows running on Windows ME, and using Python 2.3. </p>

<h2 id="head-18c7f9f6c7f20cad8a2598f80aba6a6b36bae585">Preparation</h3>


<h3 id="head-ce3f1899eb42247cc89c79893ca80eb5da56d2d4">MSI Installer</h4>

<p>Installation of Apache and one alternative distribution of Python require the Microsoft <strong>MSI Installer</strong>.  The latest version, 2.0, was released in September of 2001. You will know you don't have the correct version if you receive errors after double-clicking on a file name ending in <strong>.msi</strong>. To get the latest version, go to <a href="http://www.microsoft.com/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://www.microsoft.com/</a>, search for <strong>msi installer</strong>, and follow the instructions.  There are two versions, one for Windows ME, 98, and 95; and another for Windows 2000 and NT. Windows XP has the 2.0 version and requires no update. </p>

<h3 id="head-b1287e95efcad1b36cc2c15f825e1de198ebfcf6">Installing Apache</h4>

<p>To obtain the latest version of Apache, go to <a href="http://www.apache.org/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://www.apache.org/</a>, and click on the link to <strong>HTTP Server</strong>. Find the link to download the <strong>Win32 Binary (MSI Installer)</strong> version. Read the Apache documentation to determine the correct installation procedure for your situation.  Questions and problems with the Apache installation process should be resolved through use of the resources provided by the Apache organization. Be sure your webserver runs correctly before proceeding.  </p>
<p><strong>Warning:</strong> the procedure described above tends to trivialize the installation of the Apache web server. Apache can be installed and running on your PC in a very few minutes with only a cursory examination of the Apache documentation.  Before you undertake the installation of any web server that can be accessed through the internet, you should exercise a controlled level of paranoia and assess the potential damage that may be caused by hackers accessing or destroying sensitive data. This should include not only the all data which resides on the PC which will host the Apache web server, but all other PCs on the local LAN which participate in any form of file sharing.   </p>
<p>Windows ME, 98SE, 98, 95, and probably NT should be considered inappropriate hosts for any Apache web server that can be accessed via the internet.  Use either Windows 2000 or XP and install all security patches available for your operating system. </p>
<p>Do not let the above discourage you from installing MoinMoin.  Most of the internet activity probing your system for weaknesses will be from virus infected Windows NT systems running IIS whose owners have neglected to apply available security patches. The starting Apache configuration is secure and you will not have a problem provided you: </p>
<ul>
<li><p> Regularly review and apply security patches for your installed software. </p>
</li>
<li><p> Understand the ramifications of any changes you make to the Apache config files. </p>
</li>
<li><p> Regularly review the Apache logs for suspicious activity. </p>
</li>
<li><p> Regularly take backups of your data. </p>
</li>
</ul>

<h3 id="head-55b68c00864e2a0be48f87115a45f6a17a76bcc0">Installing Python</h4>

<p>There are currently two different distributions of Python available for Windows. The normal Python distribution is available from <a href="http://www.python.org"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://www.python.org</a>. This is distributed as a windows executable (.exe) file. </p>
<p>An alternative distribution called <strong>ActivePython</strong> is available from <a href="http://www.activestate.com/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://www.activestate.com/</a>. This distribution uses the MSI Installer and contains some tools specific to the Windows operating system and a popular Windows IDE called Pythonwin.  ActivePython is available for free; an email address is requested (but not required) before downloading. </p>
<p>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. </p>

<h2 id="head-c76f9a659995f587c02878baf3877ab5bd08a5bd">Installing MoinMoin</h3>

<p>Download the current version of MoinMoin from <a href="http://moinmoin.wikiwikiweb.de/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://moinmoin.wikiwikiweb.de/</a> into <tt>C:\TEMP</tt> or an alternative location. To extract the <em>.tar.gz</em>-format archive, you may use WinZip. </p>
<p>You should then have a folder such as <tt>C:\TEMP\moin-x.x</tt> where "x.x" is the current release number. This folder will contain a <tt>setup.py</tt> file in addition to several other files and subfolders. </p>
<p>Open an MS-DOS or console window and enter the commands: 
</p>
<pre>
C:
cd \TEMP\moin-x.x
C:\Python\python setup.py install --record=install.log
</pre>
<p>The above commands will add MoinMoin to your <tt>C:\Python</tt> installation and create an <tt>install.log</tt> file in <tt>C:\temp\moin-x.x</tt> listing all the copied files. You may use Windows Explorer to examine the newly created folders within <tt>C:\Python</tt>. You should find a <tt>C:\Python\share\moin</tt> folder. With Python 2.3 and later you will also find a <tt>C:\Python\Lib\site-packages\MoinMoin</tt> folder. The <tt>MoinMoin</tt> folder contains many Python scripts and several subfolders. </p>
<p>You are now ready to create a wiki instance. </p>

<h2 id="head-ba9ed0d8dd27b7bc62472aa0d24e8102dd103deb">Creating a Wiki Instance</h3>

<p>It is a good practice to try to keep all of your personal or site specific data under a few root folders. This way you can easily backup your important data on a regular basis without having to waste time either backing up static files or picking out dozens of important folders scattered throughout your folder structure.  You should avoid placing your wiki data under the <tt>C:\Python</tt> 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 <tt>C:\Apache</tt> folder. The default personal folder under many Windows versions is called <tt>C:\My&nbsp;Documents</tt>.   </p>
<p>Choose a location appropriate for you; the following instructions assume you will be creating one or more wiki instances in <tt>C:\Moin\</tt> and the first wiki instance will be named <tt>mywiki</tt>. </p>
<p>You may replace the name <tt>mywiki</tt> with almost any name you wish, but do not use <tt>wiki</tt> because that is used by MoinMoin for loading standard images and style sheets. Although this can be changed later, the plan is that the name you choose for <tt>mywiki</tt> will become part of the url used to access your site, e.g. <tt>http://myorganization.org/mywiki/FrontPage</tt>. </p>
<p>Start an MS-DOS or console window and enter the commands below. This will create a clone of the MoinMoin wiki in the mywiki folder.  </p>

<pre>
cd C:\ 
md Moin
md Moin\mywiki
md Moin\mywiki\data
md Moin\mywiki\underlay
cd \Python\share\moin
xcopy data        C:\Moin\mywiki\data /E
xcopy underlay    C:\Moin\mywiki\underlay /E
copy  config\*.* C:\Moin\mywiki\*.*
copy  server\*.* C:\Moin\mywiki\*.*
</pre>
<p>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. </p>
<p>Edit <tt>C:\Moin\mywiki\wikiconfig.py</tt> and at least change <tt>sitename</tt> to the name of your wiki: 
</p>
<pre>
    sitename = 'My Wiki'
</pre>
<p>Additionally, set <tt>data_dir</tt> and <tt>data_underlay_dir</tt> to the absolute paths of the particular directories. Like here: 
</p>
<pre>
    data_dir = r'C:\Moin\mywiki\data'
    data_underlay_dir = r'C:\Moin\mywiki\underlay'
</pre>
<p>For a personal or intranet installation, you'll normally also add this line to <tt>wikiconfig.py</tt>: 
</p>
<pre>
    allowed_actions = ['DeletePage', 'AttachFile', 'RenamePage', ]
</pre>
<p>If you will <em><strong>not</strong></em> be running a Wiki farm (if you're not sure what this means, then you probably won't be), make sure to delete the <tt>farmconfig.py</tt> file from the <tt>C:\Moin\mywiki</tt> directory, or else <tt>moin.cgi</tt> 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. </p>
<p>Additional configuration details can be found in <a href="http://moinmaster.wikiwikiweb.de/HelpOnConfiguration">HelpOnConfiguration</a>. </p>

<h2 id="head-42c812a9d38d3af1de6c09ed952ac1858c5221b8">Integrating MoinMoin into Apache</h3>

<p>Use your editor to edit the file <tt>C:\Moin\mywiki\moin.cgi</tt>.  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 <tt>moin.cgi</tt> file is an executable script that will be interpreted by a program to be loaded from <tt>C:/Python/python</tt>. </p>
<pre>

#! C:/Python/python
</pre>
<p>After that, you may need to activate the lines which add a folder to the sys.path and enter your path to <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> there if you have <strong>not</strong> installed <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> to the site-packages dir: 
</p>
<div lang="en" class="codearea" dir="ltr">
<script type="text/JavaScript">
function isnumbered(obj) {
  return obj.childNodes.length && obj.firstChild.childNodes.length && obj.firstChild.firstChild.className == 'LineNumber';
}
function nformat(num,chrs,add) {
  var nlen = Math.max(0,chrs-(''+num).length), res = '';
  while (nlen>0) { res += ' '; nlen-- }
  return res+num+add;
}
function addnumber(did, nstart, nstep) {
  var c = document.getElementById(did), l = c.firstChild, n = 1;
  if (!isnumbered(c))
    if (typeof nstart == 'undefined') nstart = 1;
    if (typeof nstep  == 'undefined') nstep = 1;
    n = nstart;
    while (l != null) {
      if (l.tagName == 'SPAN') {
        var s = document.createElement('SPAN');
        s.className = 'LineNumber'
        s.appendChild(document.createTextNode(nformat(n,4,' ')));
        n += nstep;
        if (l.childNodes.length)
          l.insertBefore(s, l.firstChild)
        else
          l.appendChild(s)
      }
      l = l.nextSibling;
    }
  return false;
}
function remnumber(did) {
  var c = document.getElementById(did), l = c.firstChild;
  if (isnumbered(c))
    while (l != null) {
      if (l.tagName == 'SPAN' && l.firstChild.className == 'LineNumber') l.removeChild(l.firstChild);
      l = l.nextSibling;
    }
  return false;
}
function togglenumber(did, nstart, nstep) {
  var c = document.getElementById(did);
  if (isnumbered(c)) {
    remnumber(did);
  } else {
    addnumber(did,nstart,nstep);
  }
  return false;
}
</script>

<script type="text/javascript">
document.write('<a href="#" onClick="return togglenumber(\'CA-ae7207ce08c12f42f82f00c644b7aa0c244223a5_000\', 1, 1);" \
                class="codenumbers">Toggle line numbers<\/a>');
</script>
<pre lang="en" id="CA-ae7207ce08c12f42f82f00c644b7aa0c244223a5_000" dir="ltr">
<span class="line"><span class="LineNumber">   1 </span><span class="ResWord">import</span> <span class="ID">sys</span></span>
<span class="line"><span class="LineNumber">   2 </span><span class="ID">sys</span><span class="Operator">.</span><span class="ID">path</span><span class="Operator">.</span><span class="ID">insert</span><span class="Operator">(</span><span class="Number">0</span><span class="Operator">,</span> <span class="String">r'C:\Moin\...'</span><span class="Operator">)</span><span class="Text"></span></span>
</pre>
</div>
<p>The next step is to tell Apache that is has more work to do. Use your editor to append the following lines to <tt>C:\Apache\conf\httpd.conf</tt>. Note the presence and absence of trailing slashes, it is important to enter the lines exactly as shown below. 
</p>
<pre>
Alias       /wiki/     "C:/Python/share/moin/htdocs/"
ScriptAlias /mywiki    "C:/Moin/mywiki/moin.cgi"
</pre>
<p>The <strong>Alias</strong> lines for <tt>wiki</tt> above instructs Apache to serve images, style sheets, etc. from the specified folders and subfolders. The <strong>ScriptAlias</strong> 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. </p>
<p>Test your changes by restarting your Apache server and try to access your newborn wiki with the URL <tt>http://127.0.0.1/mywiki</tt>. You should see the FrontPage, try to edit and save it, and if that works, verify your edit is reflected on the RecentChanges page. </p>
<p>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 <img src="wiki/htdocs/modern/img/smile4.png" alt=";)" height="15" width="15"> ), and rewrite the FrontPage to introduce your wiki topic.  </p>

<h2 id="head-82ba5417401e5b5cb78836b4f23ef160fbc80630">Troubleshooting</h3>

<p>The first place to look for clues when the unexpected happens is to try changing your url to: <tt>http://127.0.0.1/mywiki?action=test</tt>. If Apache can find and execute the module <tt>C:/Moin/mywiki/moin.cgi</tt>, a page of diagnostics titled <strong>MoinMoin CGI Diagnosis</strong> will be displayed. Check the output for error messages. </p>
<p>The second place to look for is <tt>C:\Apache\logs\error.log</tt>. The following are common errors grouped by the message displayed by your browser. </p>

<h3 id="head-01d84d7e6494dcee0bd2abfbb04f43f812c9bdd7">Internal Server Error</h4>

<p>If the Apache log shows a message "The system cannot find the file specified." then a possibility is the shebang statement in <tt>moin.cgi</tt> is incorrect. </p>
<p>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 <tt>moin.cgi</tt> to <tt>moin.py</tt>, loading <tt>moin.py</tt> with the Python <strong>idle</strong> IDE and executing it to determine if there are any error messages. </p>

<h3 id="head-7a4c0881ccb7242b9857811b27dc07ad836889d0">Not Found</h4>

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

<h3 id="head-d9b4f0491158f7280b4bf1693d990336527ebf4d">The Page Cannot be found</h4>

<p>If the Apache error log shows the message "File does not exist: C:/Apache/htdocs/????", you may have mistyped the url "<a href="http://127.0.0.1/mywiki"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://127.0.0.1/mywiki</a>" into your browser. </p>

<h3 id="head-d47936fa3c21c07d857b27fdb811e5836635a100">FrontPage Loads Without Icons</h4>

<p>If the Apache Error log shows many error messages "File does not exist: C:/Apache/htdocs/wiki", then the <strong>Alias</strong> statement in <tt>httpd.conf</tt> may be incorrect. </p>
<a id="bottom_Include_HelpOnInstalling/ApacheOnWin32"></a>
</div>
 </p>
<hr class="hr2">
<p> <a id="win32iis-install"></a>
 
<h1>Windows Installation using IIS</h1>

<div lang="en" id="Include_HelpOnInstalling/InternetInformationServer" dir="ltr">
<a id="top_Include_HelpOnInstalling/InternetInformationServer"></a><p><strong>Index</strong> <ol>
<li><a href="#head-060b14babb0736cc50274d972342cb03248902b9">Requirements</a></li>
<li><a href="#head-5ba445062f460e5652dc22727c85420aeece6353">Preparation</a><ol>
<li><a href="#head-4f6e8cac8cfeabe2476189c3adfc5c9782ab423b">Installing IIS</a></li>
<li><a href="#head-124918b94fdd224ff1d6bfff86c7525168676c98">Installing Python</a></li>
<li><a href="#head-a1cff6121b8b9ce2a1b1d94e923ae54f0b89ce4c">Installing MoinMoin</a></li>
</ol>
<li><a href="#head-c5d24a8b08d751dc989c57e5ec58363b55bef1b3">Creating a Wiki Instance</a><ol>
<li><a href="#head-890abdbd0d21bf874ce794be87067abf433a51d7">IIS 6.0 (Windows Server 2003)</a></li>
</ol>
<li><a href="#head-086499a2b43629c3fef3b36dc435cff210e32faa">Troubleshooting</a></li>
</ol>
 </p>

<h2 id="head-060b14babb0736cc50274d972342cb03248902b9">Requirements</h3>

<p>Before you install <a class="interwiki" title="MoinMoin" href="http://moinmoin.wikiwikiweb.de/MoinMoin"><img src="wiki/htdocs/modern/img/moin-inter.png" alt="[MoinMoin]" height="16" width="16">MoinMoin</a>, make sure you have the necessary infra-structure in place, namely the <em>Internet Information Services</em> webserver (any version should be OK), and a <em>Python</em> installation (version 2.3 is required, the latest python release is recommended). </p>
<p>In the following description, we assume that you have installed or will install things to these locations: </p>
<ul>
<li><p> IIS to its default location </p>
</li>
<li><p> <tt>C:\Python</tt> - the Python interpreter </p>
</li>
<li><p> <tt>C:\Moin</tt> - MoinMoin itself </p>
</li>
</ul>
<p>Quite often, you might want to install things elsewhere, which is no problem at all; you just have to adapt any paths that appear in a command or config file to the locations you have chosen. </p>
<p>This installation procedure was tested with IIS 5.1 for Windows running on Windows XP SP2, using Python 2.4. </p>

<h2 id="head-5ba445062f460e5652dc22727c85420aeece6353">Preparation</h3>


<h3 id="head-4f6e8cac8cfeabe2476189c3adfc5c9782ab423b">Installing IIS</h4>

<p>You currently need an external webserver to run MoinMoin.  </p>
<p>From Microsoft: (<a href="http://www.microsoft.com/windows2000/en/server/iis/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> http://www.microsoft.com/windows2000/en/server/iis/</a>) </p>
<ul>
<li style="list-style-type:none"><p>To install IIS, add components, or remove components: </p>
<p>Click Start, point to Settings, click Control Panel and start the Add/Remove Programs application.  Select Configure Windows, click the Components button, and then follow the on-screen instructions  to install, remove, or add components to IIS.  </p>
</li>
</ul>
<p>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. </p>

<h3 id="head-124918b94fdd224ff1d6bfff86c7525168676c98">Installing Python</h4>

<p>Download <a class="external" href="http://www.python.org/ftp/python/2.3.4/Python-2.3.4.exe"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> Python 2.3.4</a> and install it. Python installation is done via a standard Windows installer program. </p>
<p>Alternatively, you may download the <a class="external" href="http://www.activestate.com/Products/ActivePython/"><img src="wiki/htdocs/modern/img/moin-www.png" alt="[WWW]" height="11" width="11"> ActivePython distribution</a> as a Microsoft Installer package. </p>

<h3 id="head-a1cff6121b8b9ce2a1b1d94e923ae54f0b89ce4c">Installing MoinMoin</h4>

<p>Before creating a wiki instance, you have to download and install the basic MoinMoin software. We assume you already have downloaded the distribution archive to the "<tt>C:\TEMP</tt>" directory. </p>
<p>Open a console window and enter the following commands: 
</p>
<pre>
C:
cd \temp
unzip moin-1.3.zip
cd moin-1.3
python setup.py install --prefix=C:\Moin --record=install.log
</pre>
<p>This will install all necessary files to the "<tt>C:\Moin</tt>" directory, and create a "<tt>install.log</tt>" file listing all the files that are created there. </p>
<p> </p>

<h2 id="head-c5d24a8b08d751dc989c57e5ec58363b55bef1b3">Creating a Wiki Instance</h3>

<p>Enter these commands in a console window from C:\Moin: 
</p>
<pre>
md mywiki
md mywiki\data
md mywiki\underlay
xcopy share\moin\data mywiki\data /E
xcopy share\moin\underlay mywiki\underlay /E
copy share\moin\server\moin.cgi mywiki\
copy share\moin\config\wikiconfig.py mywiki\
copy share\moin\htdocs\index.html mywiki\default.htm
</pre>
<p>"<tt>mywiki</tt>" 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 "<tt>wiki</tt>", because that would result in confusion and problems later on. </p>
<p>We have to make sure that <tt>moin.cgi</tt> can find the MoinMoin directory, so that "<tt>import&nbsp;MoinMoin</tt>" will work. The easiest way to make sure <tt>MoinMoin</tt> can be imported is to append to <tt>sys.path</tt> <em>within</em> <tt>moin.cgi</tt>. </p>
<p>You can change the first two lines of code in moin.cgi to something like this: 
</p>
<div lang="en" class="codearea" dir="ltr">
<script type="text/JavaScript">
function isnumbered(obj) {
  return obj.childNodes.length && obj.firstChild.childNodes.length && obj.firstChild.firstChild.className == 'LineNumber';
}
function nformat(num,chrs,add) {
  var nlen = Math.max(0,chrs-(''+num).length), res = '';
  while (nlen>0) { res += ' '; nlen-- }
  return res+num+add;
}
function addnumber(did, nstart, nstep) {
  var c = document.getElementById(did), l = c.firstChild, n = 1;
  if (!isnumbered(c))
    if (typeof nstart == 'undefined') nstart = 1;
    if (typeof nstep  == 'undefined') nstep = 1;
    n = nstart;
    while (l != null) {
      if (l.tagName == 'SPAN') {
        var s = document.createElement('SPAN');
        s.className = 'LineNumber'
        s.appendChild(document.createTextNode(nformat(n,4,' ')));
        n += nstep;
        if (l.childNodes.length)
          l.insertBefore(s, l.firstChild)
        else
          l.appendChild(s)
      }
      l = l.nextSibling;
    }
  return false;
}
function remnumber(did) {
  var c = document.getElementById(did), l = c.firstChild;
  if (isnumbered(c))
    while (l != null) {
      if (l.tagName == 'SPAN' && l.firstChild.className == 'LineNumber') l.removeChild(l.firstChild);
      l = l.nextSibling;
    }
  return false;
}
function togglenumber(did, nstart, nstep) {
  var c = document.getElementById(did);
  if (isnumbered(c)) {
    remnumber(did);
  } else {
    addnumber(did,nstart,nstep);
  }
  return false;
}
</script>

<script type="text/javascript">
document.write('<a href="#" onClick="return togglenumber(\'CA-acbc60d12efe38198c86305c09c3ae16aba7d8ee_000\', 1, 1);" \
                class="codenumbers">Toggle line numbers<\/a>');
</script>
<pre lang="en" id="CA-acbc60d12efe38198c86305c09c3ae16aba7d8ee_000" dir="ltr">
<span class="line"><span class="LineNumber">   1 </span><span class="Comment">#!python</span></span>
<span class="line"><span class="LineNumber">   2 </span><span class="Comment"></span><span class="ResWord">import</span> <span class="ID">sys</span></span>
<span class="line"><span class="LineNumber">   3 </span><span class="ID">sys</span><span class="Operator">.</span><span class="ID">path</span><span class="Operator">.</span><span class="ID">append</span><span class="Operator">(</span><span class="String">'C:/Moin/Lib/site-packages'</span><span class="Operator">)</span><span class="Text"></span></span>
</pre>
</div>
<p>Notice that we're pointing to the directory which contains the MoinMoin directory, not the directory itself. </p>
<p>Next, you'll need to create two virtual directories in IIS. One for the shared data, and one for this specific wiki instance.  </p>
<p>Go to <em>Control Panel =&gt; Administrative Tools =&gt; Internet Information Service</em>. Open up the tree to <em>Default Web Site</em>.  </p>
<p>Right click on <em>Default Web Site</em> and choose <em>New =&gt; Virtual directory</em>. This will bring up a wizard with the mandatory useless first screen, hit next. Enter "<tt>wiki</tt>" for the alias name and hit next. Browse to "<tt>C:\Moin\share\moin\htdocs</tt>" and hit next. Leave the <em>Access permissions</em> at their defaults and hit next. And now you're done, hit finish! </p>
<p>Now follow the same steps, but set the alias to "<tt>mywiki</tt>" and the path to "<tt>C:\Moin\mywiki</tt>".  </p>
<p>Use IIS Admin to remove permissions to read the data directory: expand the "<tt>mywiki</tt>" node, right click on <tt>data</tt>, select <tt>Properties</tt>, and uncheck <tt>Read</tt>. Repeat these steps with the <tt>underlay</tt> directory. </p>
<p>Now you need to setup the 'mywiki' alias so that it will run Python to interpret <tt>.cgi</tt> files. On Windows Server 2003, you will need to click the <em>Create</em> button under <em>Application Settings</em> to create an application space. Right click on your new 'mywiki' alias and choose <em>Properties</em>. On the first tab (<em>Virtual Directory</em>), click the <em>Configuration</em> button. The first tab is the <em>App Mappings</em> tab, which defines which programs to use for each file exetension. Click <em>Add</em>. Browse to your <tt>python.exe</tt> (probably something like <tt>c:\pythonXX\python.exe</tt>). Then add <tt>-u&nbsp;"%s"&nbsp;"%s"</tt> after the Python executable path. The <em>Executable</em> line will look something like this: <tt>"C:\Python22\python.exe"&nbsp;-u&nbsp;"%s"&nbsp;"%s"</tt>. In the <em>Extension</em> box enter <tt>.cgi</tt> with the begining period. Make sure that the <em>Check that file exists</em> 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 <em>OK</em> several times to get back out of all the dialog boxes. </p>
<p>If you add another wiki instance, you'll only need to setup the reference to its folder, they can safely share the "<tt>wiki</tt>" alias which points to static files only. </p>
<p>That is all, try to access your new-born wiki with the URL "<tt>http://127.0.0.1/mywiki/</tt>". 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. </p>
<p>Finally, edit "<tt>wikiconfig.py</tt>" and at least change "<tt>sitename</tt>" and "<tt>logo_url</tt>" to some personal values: 
</p>
<pre>
sitename = u'My Wiki'
logo_url = '/images/mywiki-logo.gif'
</pre>
<p>It is advised that you use "<tt>logo_string</tt>" for an image, string, or both instead of "<tt>logo_url</tt>": 
</p>
<pre>
logo_string = u'&lt;img src="/mywiki/images/mywiki-logo.gif" alt="MyWiki Logo"&gt;My Wiki'
</pre>
<p>Where "<tt>images</tt>" is a directory under your "<tt>mywiki</tt>" instance. </p>
<p>NOTE: The configuration variable "<tt>url_prefix</tt>" in "<tt>wikiconfig.py</tt>" should match the alias for "<tt>C:\Moin\share\moin\htdocs</tt>" or themes will not work ("<tt>/wiki</tt>" for the instructions above).  This way, any reference in "<tt>wikiconfig.py</tt>" to "<tt>/wiki/something</tt>" will look in the shared data directory and a reference to "<tt>/mywiki/something</tt>" will look in the wiki instance directory.  These are considered absolute paths because relative paths will not work correctly. </p>
<p>For a personal or intranet installation, you'll normally also add the line 
</p>
<pre>
allowed_actions = ['DeletePage', 'AttachFile', 'RenamePage', ]
</pre>
<p><strong>Starting with <a href="http://moinmaster.wikiwikiweb.de/MoinMoin">MoinMoin</a> 1.3.5</strong>, 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: </p>
<ol type="1">
<li><p>Go into the IIS Manager, right-click on 'mywiki' (or whatever your wiki instance directory is called), and select properties. </p>
</li>
<li class="gap"><p>Next, go to the Custom Errors tab and find the 404 entry, and click the Edit button. </p>
</li>
<li class="gap"><p>Set "Message type" to "Default" and click click click until you're out of all the dialogs. </p>
</li>
</ol>

<h3 id="head-890abdbd0d21bf874ce794be87067abf433a51d7">IIS 6.0 (Windows Server 2003)</h4>

<p>The instructions below also apply to IIS 6.0 but the more aggressive security settings in newer version of IIS disallow the usage of <em>unknown CGI extensions</em>.  That means you will always get a 404 error unless you do this: </p>
<ol type="1">
<li><p>Open IIS Manager by going to Start Menu-&gt;Programs-&gt;Administrative Tools-&gt;IIS Manager. </p>
</li>
<li class="gap"><p>Go the the <strong>Web Service Extensions</strong> folder. </p>
</li>
<li class="gap"><p>Under the <strong>Action</strong> menu, select <strong>Add a new Web service extension...</strong>. </p>
</li>
<li class="gap"><p>For Extension name, give it a name such as <em>.cgi</em> or <em>Python cgi</em> or something. </p>
</li>
<li class="gap"><p>Under <strong>Required files</strong> click the <strong>Add...</strong> button and type in the exact command-line string you used above. Eg: <em>c:\python24\python.exe -u "%s" "%s"</em>, then click the <strong>Ok</strong> button. </p>
</li>
<li class="gap"><p>Make sure the <strong>Set extension status to Allowed</strong> checkbox is checked and click the <strong>Ok</strong> button. </p>
</li>
</ol>
<p>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. </p>

<h2 id="head-086499a2b43629c3fef3b36dc435cff210e32faa">Troubleshooting</h3>

<p>If you see an error like "<tt>ImportError:&nbsp;No&nbsp;module&nbsp;named&nbsp;MoinMoin</tt>", it means that python cannot find MoinMoin. See above for how to add to <tt>sys.path</tt>. </p>
<p>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. </p>
<p>If the page never loads after hitting <tt>Save&nbsp;Changes</tt>, you should check the permissions of the <tt>data</tt> directory.  Make sure the IUSR_COMPUTERNAME user has modify permissions. </p>
<p>If some images like <a href="http://moinmaster.wikiwikiweb.de/InterWiki">InterWiki</a> and <a class="nonexistent" href="http://moinmaster.wikiwikiweb.de/WorldWideWeb">WorldWideWeb</a> don't show up, it could have been because of incorrect permissions or a bad "<tt>url_prefix</tt>" in "<tt>wikiconfig.py</tt>" or the cached pages need to be updated by an Edit or deleting them in the data folder. </p>
<p>If you see an error message like: 
</p>
<pre>
Check your URL regular expressions in the "wikis" list in "farmconfig.py". Content-type: text/html;charset=utf-8
MoinMoin Configuration Error
Could not find a match for url: "servername/wikiname/moin.cgi?
Check your URL regular expressions in the "wikis" list in "farmconfig.py".
</pre>
<p>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.  </p>
<a id="bottom_Include_HelpOnInstalling/InternetInformationServer"></a>
</div>
 </p>
<hr class="hr2">
<p> <a id="trouble-shooting"></a>
 
<h1>Trouble-shooting</h1>

<div lang="en" id="Include_HelpOnInstalling/TroubleShooting" dir="ltr">
<a id="top_Include_HelpOnInstalling/TroubleShooting"></a><p><strong>How to deal with common errors</strong> </p>

<h1 id="head-19c97c74376eccc15bf415113eb35925fb0600ef">First follow the instructions</h2>

<p>Moin 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 <tt>mywiki</tt> ... 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. </p>
<ul>
<li><p> First follow the instructions </p>
</li>
<li><p> Do not change any configuration option unless you must. </p>
</li>
<li><p> Play with a working wiki before you try to customize it. </p>
</li>
</ul>

<h1 id="head-d6d40372ac4a2b91da396f084ba3faaf3e6c3845">Change one thing at a time</h2>

<p>When 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.  </p>

<h1 id="head-1372c460df94281a98cdde429b2496bdfd6e2677">Check That Your Webserver Can Use Python</h2>

<p>This is also in <a href="http://moinmaster.wikiwikiweb.de/HelpOnInstalling/BasicInstallation">HelpOnInstalling/BasicInstallation</a>.  Use this script: </p>

<pre>
#!/bin/sh
echo Content-Type: text/plain
echo
echo "Your web server is running as:"
id
echo "CGI scripts work"
echo "Now we try to invoke Python interpreters and get their versions:"
python -V 2&gt;&amp;1
python2.3 -V 2&gt;&amp;1
python2.4 -V 2&gt;&amp;1
echo "Finished."
</pre>
<p>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. </p>

<h1 id="head-82d34035b28a82ec380913906a9c676a0c20ecf3">Built-in test</h2>

<p>There's a built-in diagnostic mode that's useful when doing an install; just append "<tt>?action=test</tt>" to the URL of your wiki: 
</p>
<pre>
lynx --dump http://`hostname`/mywiki?action=test
</pre>
<p>If you see an import error here, but  </p>

<pre>
python -c "import MoinMoin"
</pre>
<p>works, it's likely a result of missing file permissions or a wrong PYTHONPATH setting within the web server environment. </p>

<h1 id="head-68a88c328bf1907f03ed306eb15199cc98b2cd6a">Duelling Pythons</h2>

<p>The most common problem you might encounter is when you have an old Python version installed into "<tt>/usr</tt>", and a newer Python distribution into "<tt>/usr/local</tt>"; this is typical for GNU/Linux distributions that still come bundled with an old Python version. </p>
<p>In that case, if you enter "<tt>python</tt>" on your prompt, you will usually get the more recent Python interpreter, because "<tt>/usr/local/bin</tt>" is in your <tt>PATH</tt>. The situation is different in your webserver environment, and thus you might have to change the bang path of "<tt>moin.cgi</tt>", like this: 
</p>
<pre>
#!/usr/local/bin/python

"""
    MoinMoin - CGI Driver Script
...
"""
</pre>
<ul>
<li><p> Debian stable users might want to look for backport of newer Python, or download and build Python from source. </p>
</li>
<li class="gap"><p> When installing, make sure you install with the version of python you want to run moin with. <tt>python&nbsp;setup.py&nbsp;install</tt> will install with the first python in the path, which may be the version you expect or not! <tt>/usr/local/bin/python2.4</tt> will install in specific python. You will have to use the same path in the moin server script. </p>
</li>
</ul>

<h1 id="head-8e72ddd753a6ead652d17bd2c24324a9a0dc9512">Missing file permissions</h2>

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

<pre>
python -c "import sys; print '%s/lib/python%s/site-packages' % ( sys.prefix, sys.version[:3] )"
</pre>
<p>For the example below, we'll assume that the Python module directory is <tt>/usr/local/lib/python2.3/site-packages</tt>. Make the files world-readable using the following commands: 
</p>
<pre>
cd /usr/local
chmod -R a+rX lib/python2.3/site-packages/MoinMoin
</pre>

<h1 id="head-bf2856e568e384c1b4da0403cfee28297345e8a9">Set Your Variables Carefully</h2>

<p>Be especially careful when you retype instead of cut and paste. Quoting errors in <tt>wikiconfig.py</tt> 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 <tt>wikiconfig.py</tt> or <tt>farmconfig.py</tt>. </p>

<h2 id="head-b3137d96e505ef20d7cff55253012674ea4a5d10">moin.cgi found, Moin doesn't run</h3>

<p>If 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.   </p>

<h2 id="head-ecc94aa011a0d0de8cfa6123fcfd70164d85a139">CSS files do not work</h3>

<p>Very common error is missing CSS styles. Your wiki look bare and ugly, unlike this nice wiki. In most cases, you did broke the configuration by not reading the instructions, or by trying to customize the instructions because you are smarter then us. <img src="wiki/htdocs/modern/img/smile.png" alt=":-)" height="15" width="15"> </p>
<p>The fix is very easy: make sure your Apache Alias and <a class="nonexistent" href="http://moinmaster.wikiwikiweb.de/ScriptAlias">ScriptAlias</a> are NOT the same. This Apache setup will never work: 
</p>
<pre>
Alias /wiki/ "/prefix/share/moin/htdocs/"
ScriptAlias /wiki/ "/var/www/wiki/moin.cgi"
</pre>
<p>Alias is used to server static files: css, images etc. <a class="nonexistent" href="http://moinmaster.wikiwikiweb.de/ScriptAlias">ScriptAlias</a> is used to hide moin.cgi from the url. You must use different values! You can use anything you like for <a class="nonexistent" href="http://moinmaster.wikiwikiweb.de/ScriptAlias">ScriptAlias</a>, or Alias, but Alias must match the <tt>url_prefix</tt> configuration option. Here is an example that works (the default): 
</p>
<pre>
# Apache config
Alias /wiki/ "/prefix/share/moin/htdocs/"
</pre>

<pre>
# Wiki config
    url_prefix = '/wiki'
</pre>
<a id="bottom_Include_HelpOnInstalling/TroubleShooting"></a>
</div>
 </p>
<a id="bottom"></a>
</div>
<p id="pageinfo" class="info" lang="en" dir="ltr">last edited 2005-01-22 22:28:34 by <span title="??? @ 127.0.0.127[127.0.0.127]">127</span></p>
<div id="pagebottom"></div>
</div>
</body>
</html>