Saturday, February 19, 2011

MoinMoin in DreamHost


I have tested using moin-1.9.3.tar.gz in DreamHost.
You have to enable Passenger in your domain.

Download  MoinMoin from:
http://moinmo.in/

Documentation (specially check the Server Installation part):
http://master19.moinmo.in/InstallDocs


1. ssh to your server, and download moin using wget.

2. Extract it:
tar -zxvf moin-1.9.3.tar.gz

3. Run setup script
cd moin-1.9.3
python setup.py --quiet install --prefix=$HOME --record=install.log

4. Check the install.log using emacs or nano for the python version it is using.
emacs install.log 
...
/home/youraccount/lib/python2.5/site-packages/...
...

5. Edit the moin.cgi (it would be easy, if you start another ssh shell in the server)
find -name moin.cgi     //if you want to find it yourself.
$HOME/share/moin/server/moin.cgi

emacs $HOME/share/moin/server/moin.cgi

Make the following changes
# 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, 'PREFIX/lib/python2.3/site-packages')

# a2) Path of the directory where wikiconfig.py / farmconfig.py is located.
#     See wiki/config/... for some sample config files.
#sys.path.insert(0, '/path/to/wikiconfigdir')
===================================================

# 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, '/home/youraccount/lib/python2.5/site-packages')

# a2) Path of the directory where wikiconfig.py / farmconfig.py is located.
#     See wiki/config/... for some sample config files.
sys.path.insert(0, '/home/youraccount/moin/config')

you can verify this location using another shell while editing.


6. This example is designed for single wiki
create this directory $HOME/moin/config/
cd $HOME/moin/config
cp $HOME/share/moin/config/wikiconfig.py .
cp -r $HOME/share/moin/data/ .
cp -r $HOME/share/moin/underlay/ .

7. Edit wikiconfig.py in $HOME/moin/config/
emacs wikiconfig.py

maka the following changes
# If that's not true, feel free to just set instance_dir to the real path
# where data/ and underlay/ is located:
#instance_dir = '/where/ever/your/instance/is'
instance_dir = wikiconfig_dir

# If that's not true, feel free to just set instance_dir to the real path
# where data/ and underlay/ is located:
instance_dir = '/home/youraccount/moin/config'
#instance_dir = wikiconfig_dir

Change the sitename if you want to change your wiki name.

8. Copy /home/youraccount/share/moin/server/moin.cgi to your public folder, and rename it to wiki.cgi
or
create a file wiki.cgi in your public folder. Softlink did not work for me, so lets call the moin.cgi using another python script.
#!/usr/bin/python
import os
os.system('python /home/youraccount/share/moin/server/moin.cgi')

9. now you need to link the htdocs for css and images.
cd $HOME
find -name htdocs   //if you want to find it yourself
(I have found in the following location.)
./lib/python2.5/site-packages/MoinMoin/web/static/htdocs

change directory to your public folder.
create a symbolic link of htdocs in your public folder.
ln -s $HOME/lib/python2.5/site-packages/MoinMoin/web/static/htdocs .
mv htdocs moin_static193  //change the softlink name. This is important

You can always use your custom directory names, but in that case you have to edit the configuration file. This example is written for a simple installation of MoinMoin.

Using a browser open:
http://yourdomain.com/wiki.cgi

If you can see the wiki, you have successfully setup the MoinMoin.
Now, start customizing it by editing the config files.

To avoid the *.cgi you may add the following lines in your .htaccess file
ReWriteEngine on
ReWriteRule ^wiki$ wiki/
ReWriteRule ^wiki(/.*) wiki.cgi$1
RequestHeader set X-Moin-Location /wiki

Now use it as:
http://yourdomain.com/wiki/



10. Optional mail configuration:
emacs $HOME/moin/config/wikiconfig.py
# Mail --------------------------------------------------------------
...
    mail_smarthost = "mail.yourdomain.com"
    mail_from = u"Your Wiki <noreplay@yourdomain.com>"
    mail_login = "auth-email@yourdomain.com email-pass"
...
optionally you may add noreplay@yourdomain.com as "Garbage Email" from dreamhost panel. It will delete mail without bounce.

src:
http://wiki.dreamhost.com/MoinMoin
http://mitch.contlafamily.com/wiki/HOWTO/Install_MoinMoin_On_Dreamhost