- Copy directories
- If your provider's python is stoneage ...
This document describes how to install MoinMoin on the webserver of your ISP. I will assume a few things:
Explore the webserver configuration
Now it is time to find out how your ISP supports python. Unfortunately, python is not as popular as PHP. Therefore, it is quite likely that your ISP does not support fancy python stuff like mod_python. If they support python at all, they probably support the Common Gateway Interface (CGI). As noted above, I describe only this installation option. Now there is some homework for you to do:
Find out where the python binary resides on your webserver. You should be able to find some hints in the ISPs online documentation, or you can ask their support team, or you can guess. Common locations are /usr/bin/python, /usr/bin/python2.3 or /usr/local/bin/python. Sometimes, an ISP chooses to support more than one python version, usually indicated by a version number in the search path. If possible, choose the latest version. Modify the first line of the explore script and the moin.cgi file to match the path of the python executable.
Try to find a place where python scripts can be executed. To help you with that task, I have written a small script. Upload it to your webserver and see whether it gets executed or not. Here are some hints:
1 #!/usr/bin/python2.3 2 3 import os.path 4 import os 5 import sys 6 7 try: 8 __file__ 9 except NameError: 10 __file__ = '?' 11 12 print """Content-type: text/html 13 14 <html><head><title>Python Exploration</title></head><body> 15 <table border=1> 16 <tr><th colspan=2>1. System Information</th></tr> 17 <tr><td>Python</td><td>%s</td></tr> 18 <tr><td>Platform</td><td>%s</td></tr> 19 <tr><td>Absolute path of this script</td><td>%s</td></tr> 20 <tr><td>Filename</td><td>%s</td></tr> 21 """ % (sys.version, 22 sys.platform, 23 os.path.abspath('.'), 24 __file__) 25 print "<th colspan=2>2. Environment Variables</th>\n" 26 for variable in os.environ: 27 print "<tr><td>%s</td><td>%s</td></tr>\n" % (variable, os.environ[variable]) 28 print "</table></body></html>"
If only the source code appears in your browser window, your file has not been processed by the CGI. Probably some kind of apache configuration is required to make things work. Consult your ISPs documentation.
If everything works, a table should appear on your screen. It gives you some basic information on your webserver. Later we will need python version, absolute path of this script, DOCUMENT_ROOT and SITE_URI.
moin-1.3.3/wiki/htdocs contains static files (e. g. css stylesheets and icons). Place this directory on your server somewhere under apache's DOCUMENT_ROOT and rename it to 'wiki'. Apache has to deliver them directly.
Choose a location for these files on your webserver. You are free to choose, but apache must be able to execute moin.cgi. If necessary, you can even rename moin.cgi, for example to moin.py. I would recommend placing wikiconfig.py in a separate config directory that is not accessible by apache. Do not start uploading, we are going to make some modifications first.
Uncomment this line and replace the path information. If you have run explore.py on your webserver, you may use your knowledge of absolute path of this script to guess the absolute path to the MoinMoin directory.
Example: You transfered explore.py with your FTP-client into /public_html on your webserver. Absolute path of this script reveals /home/nowhere.com/public_html. You transfered MoinMoin to /MoinMoin. You plan to place moin.cgi as /pubic_html/index.py on your webserver. You would have to insert
Example: You transfered explore.py with your FTP-client into /public_html on your webserver. Absolute path of this script reveals /home/nowhere.com/public_html. Your planned location for wikiconfig.py is /config. You plan to place moin.cgi as /pubic_html/index.py on your webserver. You would have to insert
# choose one: sys.path.insert(0, '/home/nowhere.com/config') # absolute path sys.path.insert(0, '../config') # path relative to moin.cgi
Example: You transfered explore.py with your FTP-client into /public_html on your webserver. Absolute path of this script reveals /home/nowhere.com/public_html. You transfered data to /data. You plan to place moin.cgi as /pubic_html/index.py on your webserver. You would have to insert
# choose one: data_dir = '/home/nowhere.com/data/' # absolute path data_dir = '../data/' # path relative to moin.cgi
Example: You transfered explore.py with your FTP-client into /public_html on your webserver. Absolute path of this script reveals /home/nowhere.com/public_html. You transfered underlay to /underlay. You plan to place moin.cgi as /pubic_html/index.py on your webserver. You would have to insert
# choose one: data_underlay_dir = '/home/nowhere.com/data/' # absolute path data_underlay_dir = '../data/' # path relative to moin.cgi
(4) Set configuration options. If you browse through wikiconfig.py, you will see a bunch of options. Set these options as you like. See HelpOnConfiguration for details.
Upload moin.cgi and wikiconfig.py
You are done! Upload moin.cgi and wikiconfig.py and test your wiki by calling moin.cgi through your webbrowser. You may have to set file permissions manually to allow the execution of moin.cgi. Be sure to upload both files to the directories described above.
ftp moin-1.3.3/wiki/data ==> /data ftp moin-1.3.3/wiki/htdocs ==> /wiki ftp moin-1.3.3/wiki/underlay ==> /underlay ftp moin-1.3.3/MoinMoin ==> /MoinMoin ftp create directory /config create moin-1.3.3/.htaccess insert content: deny from all ftp moin-1.3.3/.htaccess ==> /data ftp moin-1.3.3/.htaccess ==> /underlay ftp moin-1.3.3/.htaccess ==> /MoinMoin ftp moin-1.3.3/.htaccess ==> /config edit moin-1.3.3/wiki/server/moin.cgi: replace: #!/usr/bin/env python by: #!/usr/bin/python2.3 replace: ## sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages') by: sys.path.insert(0, '.') replace: sys.path.insert(0, '/path/to/wikiconfig') by: sys.path.insert(0, './config') ftp moin-1.3.3/wiki/server/moin.cgi ==> /moin.py edit moin-1.3.3/wiki/config/wikiconfig.py: set data_dir: data_dir = './data/' set data_underlay_dir: data_underlay_dir = './underlay/' set url_prefix: url_prefix = '/wiki' ftp moin-1.3.3/wiki/config/wikiconfig.py ==> /config/wikiconfig.py
If your provider's python is stoneage ...
wget http://python.org/ftp/python/2.4/Python-2.4.tar.bz2 tar xjf Python-2.4.tar.bz2 cd Python-2.4 ./configure --prefix=/your/home/dir/at/the/provider make make install # after that, you have a nice, fresh python in $PREFIX # you can ftp it to your home directory at provider and use it from there