I googled for this but found no revelvant links. I've also looked at the moinmoin wiki site but this case is not covered.
Generally, the moinmoin setup seems to work best when using DNS to differentiate between wiki sites but I'd prefer to cut out the overhead of creating multiple DNS entries and configuring apache with each wiki--it's extra work that should not be needed. The files are all the same that run the site. Only the data and some part of the url needs to be different.
Of course you'll need to install moinmoin. Debian/Ubuntu is extremely easy with apt. CentOS and Redhat are not much more difficult by downloading a tarball. After install on Redhat/CentOS i create a symlink in /etc to make the configuration files easily accessible. I am installing 1.8.0 on CentOS.
ln -s /usr/local/share/moin/config/wikifarm /etc/moin
Next I got the single and farm sites working as virtual hosts then I started changing things. I started with the example apache config that is installed with the package. You don't need to get anything working before following these steps. Just install moinmoin.
Apache virtual hosts are dealt with inconsistenly on different distros. My experience with the Apache virtual host GUI on redhat was horrible so I configure it all by hand.
I usually create a directory called /var/www/vhosts to hold the virtual hosts.
Debian doesn't really expect you to put virtual hosts anywhere AFAIK. I usually change the default debian apache configs so that /var/www becomes /var/www/html and create /var/www/vhosts to hold the virtual host sites.
I am using an apache virtual host with this configuration
<VirtualHost *>
ServerName wiki.kahalacorp.com
DocumentRoot /var/www/vhosts/wiki.kahalacorp.com/
AddHandler cgi-script .cgi
# Use default themes
Alias /moin_static180/ /usr/share/moin/htdocs/
# or /usr/local/share/moin/htdocs
<Directory "/var/www/vhosts/wiki.kahalacorp.com">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Redhat/CentOS
I create a configuration file in /etc/httpd/conf.d/moinmoin.conf.
Debian/Ubuntu
I put the configuration file in /etc/apache2/conf.d/moinmoin.conf
Copy moin.cgi from /usr/share/moin or (/usr/local/share/moin) to /var/www/vhosts/wiki-dev.domain.com. Since we used a prefix on install we need to modify the cgi script to tell it where to look for libraries. Edit moin.cgi and change these lines
# a1) Path of the directory where the MoinMoin code package is located.
# Needed if you installed with --prefix=PREFIX or you didn't use setup.py.
sys.path.insert(0, '/usr/local/lib/python2.4/site-packages')
# a2) Path of the directory where wikiconfig.py / farmconfig.py is located.
sys.path.insert(0, '/usr/local/share/moin/config/wikifarm')
Create a symlink in that folder for the sites we want to differentiate from each other.
mkdir -p /var/www/vhosts/wiki-dev.domain.com
cp /usr/share/moin/server/moin.cgi /var/www/vhosts/wiki-dev.domain.com/
cd /var/www/vhosts/wiki-dev.domain.com/
ln -s moin.cgi a.cgi
ln -s moin.cgi b.cgi
ln -s moin.cgi c.cgi
Tell farmconfig.py how to get to the sites
# for multiple wikis, do something like this:
("a", r".*/a.cgi"),
("b", r".*/b.cgi"),
("c", r".*/c.cgi"),
farmconfig.py may be in /etc/moin/ or in /usr/local/share/moin/config/wikifarm.
You have to decide where you will put the data stores for the wikis. The web user/process will need to be able to write to this location. (SELinux may give you trouble if you put it outside of /var/www.) I am using /var/moin on Debian and /var/www/moin on Redhat. You will need to create the folders and set permmissions. Make sure to use the correct ownership (apache for redhat, www-data for debian).
cp -r /usr/local/share/moin/data /var/moin/a
chmod -R ug+rw /var/moin
chown -R apache:apache /var/moin
Configure each site's .py file and set the data directory. You may also want to edit this file to change the sitename and other options.
sed 's|/org/mywiki/data/|/var/moin/a|g' /etc/moin/mywiki.py > /etc/moin/a.py
I had to create a custom selinux module to allow python to write to the data directories on CentOS with the data in /var/www/moin. I was getting an error about incorrect permissions on my data directories even though I had set them properly.
data_dir "/var/moin/a" does not exist, or has incorrect ownership or permissions.
Make sure the directory and the subdirectory "pages" are owned by the web server and are readable, writable and executable by the web server user and group.
The selinux rules for Redhat with moinmoin 1.8.0 combined with moinmoin 1.5 rules are below. Theoretically these would allow both versions to run.
module pythonhttpd 1.0;
require {
class dir add_name;
class dir add_name;
class dir create;
class dir create;
class dir { read write };
class dir remove_name;
class dir remove_name;
class dir { remove_name create };
class dir write;
class file append;
class file append;
class file create;
class file create;
class file getattr;
class file read;
class file { rename unlink };
class file { rename unlink };
class file { write create setattr };
class file { write rename unlink setattr };
class file { write setattr };
class lnk_file create;
type httpd_log_t;
type httpd_sys_script_t;
type httpd_sys_script_t;
type httpd_t;
type usr_t;
type var_t;
}
#============= httpd_t ==============
allow httpd_t httpd_log_t:lnk_file create;
#============= httpd_sys_script_t ==============
allow httpd_sys_script_t usr_t:dir add_name;
allow httpd_sys_script_t usr_t:dir create;
allow httpd_sys_script_t usr_t:dir remove_name;
allow httpd_sys_script_t usr_t:dir { remove_name create };
allow httpd_sys_script_t usr_t:dir write;
allow httpd_sys_script_t usr_t:file append;
allow httpd_sys_script_t usr_t:file create;
allow httpd_sys_script_t usr_t:file { rename unlink };
allow httpd_sys_script_t usr_t:file { write create setattr };
allow httpd_sys_script_t usr_t:file { write rename unlink setattr };
allow httpd_sys_script_t var_t:dir add_name;
allow httpd_sys_script_t var_t:dir create;
allow httpd_sys_script_t var_t:dir { read write };
allow httpd_sys_script_t var_t:dir remove_name;
allow httpd_sys_script_t var_t:file append;
allow httpd_sys_script_t var_t:file create;
allow httpd_sys_script_t var_t:file getattr;
allow httpd_sys_script_t var_t:file read;
allow httpd_sys_script_t var_t:file { rename unlink };
allow httpd_sys_script_t var_t:file { write setattr };
I had to set some custom options in /etc/moin/farmconfig.py. You can also set them in the individual .py configs for each site.
data_underlay_dir
I had problems with the data_underlay_dir so I set it to a readwrite folder next to the data
mkdir /var/moin/_underlay
chmod ug+w /var/moin/_underlay
chown www-data:www-data /var/moin/_underlay
sed -i 's|./underlay|/var/moin/_underlay|g' farmconfig.py
url_prefix_static
If you use an alias other than the moin default in the apache config you will have to set url_prefix_static = '/alias'. I used the default moin_static180
MoinMoin using Active Directory through mod_auth_pam in Apache
Since I am using apache to authenticate users against Active Directory I only need moinmoin to use the information provided by apache. To facilitate this change in moinmoin behavior I have added a few lines to the config. This can be added to the farmconfig.py to enable it for all wikis in the farm or to individual configs. If using the method detailed on this page to host all the wikis out of the same site it makes the most sense to tack these lines onto the end of farmconfig.py.
MOINMOIN 1.5
from MoinMoin.auth import http
user_autocreate = True
auth = [http]
show_login = 0
MOINMOIN 1.8
from MoinMoin.auth.http import HTTPAuth
auth = [HTTPAuth(autocreate=True)]
show_login = 0