I wanted to implement a Personal Wiki, and considered using MediaWiki since it's offered by Dreamhost as a 'One-Click Install', but after investigating wiki software, I decided to use MoinMoin. I found the installation instructions spread out among several different wiki pages, and a little bit difficult to grok. After searching the web for some Dreamhost specific installation instructions, I found a couple sites that offered some helpful information, but still no complete picture.
My goal was to write a concise HOWTO that would allow a moderately experienced user to setup a simple wiki on a Dreamhost account with as little pain as possible. The steps below should provide enough detail to configure MoinMoin on both a standard CGI site and FastCGI enabled site. Also included are instructions for using Apache mod_rewrite to serve cruft-free URLs.
Feedback is welcome. WEB/IM/IRC Info
Contents
Download
This tutorial assumes you have enabled shell access to your Dreamhost shared-hosting account. If you are not sure how to do that, see this link.
Use your favorite SSH Client to login to your shell account and download the latest release to your home directory.
wget http://prdownloads.sourceforge.net/moin/moin-1.5.8.tar.gz?download
Now, unpack the archive, and change to the directory that contains the MoinMoin files.
tar -xzvf moin-1.5.8.tar.gz cd moin-1.5.8
Setup and install
Install MoinMoin in your home directory by running setup.py.
python setup.py --quiet install --prefix=$HOME --record=install.log
This creates (if they don't already exist) and populates the following directories:
MoinMoin directory, usually $HOME/lib/pythonX.Y/site-packages/MoinMoin -- this is where the MoinMoin source code is located
share directory, usually $HOME/share/moin - this is where the templates are located
data directory (wiki pages, users, etc.) - only MoinMoin should access this
underlay directory (wiki pages) - only MoinMoin should access this
htdocs directory with html support files (images for the various themes, etc.)
server - MoinMoin example startup files
config - MoinMoin example configuration files (like wikiconfig.py)
bin directory with some scripts that help you use the MoinMoin shell commands
Create a wiki instance
A wiki 'instance' is a directory that contains all of the data and templates for your wiki.
Set up some shell variables to make following steps easier.
export MOIN=$HOME/share/moin export WIKI=$MOIN/mywiki # the name of your wiki instance, don't use 'wiki' export SITE=$HOME/<www.example.com> # replace <www.example.com> with your domain
Change to the MoinMoin 'templates' directory
cd $MOIN
Create a directory to hold your wiki 'instance' and copy the required template files.
mkdir $WIKI cp -R $MOIN/data $MOIN/underlay $MOIN/config/wikiconfig.py $WIKI/
Set the appropriate permissions.
chmod -R ug+rwX $WIKI chmod -R o-rwx $WIKI
Configuration
Wiki instance (wikiconfig.py)
Configure your wiki instance by editing $WIKI/wikiconfig.py
Start with the "Wiki Identity" section.
sitename = u'Untiled Wiki' # Name your wiki logo_string = u'<img src="/htdocs/common/moinmoin.png" alt="MoinMoin Logo">'
Uncomment (remove the leading '#') one of the following:
#page_front_page = u"MyStartingPage" OR #page_front_page = u"FrontPage"
Now set options in the "Critical Configuration" section.
data_dir = '/home/<username>/share/moin/mywiki/data/' # Replace <username> with your account data_underlay_dir = '/home/<username>/share/moin/mywiki/underlay/' # Replace <username> with your account url_prefix = '/htdocs'
Web site (domain)
Change to your 'domain' folder, and create a cgi-bin directory.
cd $SITE mkdir $SITE/cgi-bin # if it doesn't already exist cp $MOIN/server/moin.cgi $MOIN/server/moin.fcg $SITE/cgi-bin/ chmod -R a+rx $SITE/cgi-bin
Do one of the following:
Make a symlink to the htdocs directory.
ln -s $MOIN/htdocs $SITE/htdocs
Copy the entire htdocs directory to your 'domain' directory.
cp -R $MOIN/htdocs $SITE/
MoinMoin Application (moin.fcg or moin.cgi)
If your domain is configured to support FastCGI, configure moin.fcg, if not (or you don't know), configure moin.cgi instead.
Edit $SITE/cgi-bin/moin.fcg (or moin.cgi).
# Path to MoinMoin package, needed if you installed with --prefix=PREFIX # or if you did not use setup.py. sys.path.insert(0, '/home/<username>/lib/python2.3/site-packages') # Replace <username> with your account # Path of the directory where wikiconfig.py is located. # YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP. sys.path.insert(0, '/home/<username>/share/moin/mywiki') # Replace <username> with your account
Test Your Wiki
Open a web browser and type one of the following URLs in the address bar (replace <www.example.com> with your domain URL):
For FastCGI sites: http://<www.example.com>/cgi-bin/moin.fcg
For standard CGI sites: http://<www.example.com>/cgi-bin/moin.cgi
Troubleshooting
- Carefully double check each step of the configuration instructions.
Make sure the cgi-bin directory, and scripts have execute permission set.
chmod -R a+rx $SITE/cgi-bin
If you made changes to moin.[fcg|cgi], try restarting the moin (python) process.
killall python
Check the MoinMoin Troubleshooting page.
CSS Does Not Load
Wiki loads, but appear 'ugly':
Check the url_prefix in $HOME/share/moin/mywiki/wikiconfig.py. This should correspond to the htdocs directory.
If you symlinked htdocs, Add the following line at the top of .htaccess in the root of your domain:
Options +FollowSymLinks
Cruft-free URLs
I prefer simple addresses on my site, so the thought of URLs like http://<www.example.com>/cgi-bin/moin.fcg?FrontPage didn't thrill me. I wanted something like http://<www.example.com>/wiki/FrontPage. This is possible with MoinMoin, but takes a little bit of reconfiguration, and some Apache Voodoo.
Edit $WIKI/wikiconfig.py and change the url_prefix.
url_prefix = '/_static'
For FastCGI enabled sites, edit $SITE/cgi-bin/moin.fcg:
- Find the method (section) that reads:
def handle_request(req, env, form): request = RequestFastCGI(req, env, form, properties = {'script_name': '/wiki'}) request.run()
Change request = RequestFastCGI(req, env, form) to:
request = RequestFastCGI(req, env, form, properties = {'script_name': '/wiki'})
For standard CGI sites, edit $SITE/cgi-bin/moin.cgi:
- Find the method (section) that reads:
from MoinMoin.request import RequestCGI request = RequestCGI() request.run()
Change request = RequestCGI() to:
request = RequestCGI(properties={'script_name': '/wiki'})
Edit $SITE/.htaccess, and add the following lines before any other mod_rewrite sections:
Make sure the last RewriteRule references the correct moin script based on your configuration (moin.fcg or moin.cgi)
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^_static(.*)$ htdocs$1 RewriteRule ^wiki/(.*)$ cgi-bin/moin.fcg/$1 [L] # OR cgi-bin/moin.cgi/$1 </IfModule>
NOTE: mod_rewrite can be a little tricky. This configuration works correctly on my installation... YMMV.
You may need to restart the moin process.
killall python
Now, test your site using the following URL (replace <www.example.com> with your domain URL):
http://<www.example.com>/wiki
If all went well your wiki is available using a simple, cruft-free URL
References
Dreamhost Wiki: http://wiki.dreamhost.com/MoinMoin
Installing MoinMoin at Dreamhost: http://www.wombatnation.com/misc/installMoinMoinDreamHost.html
MoinMoinBugs/RewritingAndCookieUrl: http://moinmoin.wikiwikiweb.de/MoinMoinBugs/RewritingAndCookieUrl
