/shabti/templates/moinmoin/data/moin/underlay/pages/HelpOnInstalling(2f)ApacheOnLinuxFtp/revisions/00000001
#! | 251 lines | 195 code | 56 blank | 0 comment | 0 complexity | c5577b115f9b558d122deeb82ed2609f MD5 | raw file
1## Please edit system and help pages ONLY in the master wiki!
2## For more information, please see MoinMoin:MoinDev/Translation.
3##master-page:Unknown-Page
4##master-date:Unknown-Date
5#acl -All:write Default
6#format wiki
7#language en
8
9HelpContents > HelpOnAdministration > HelpOnInstalling
10
11= Installing MoinMoin with Apache using ftp =
12
13This document describes how to install MoinMoin:MoinMoin on the webserver of your [[WikiPedia:Internet_service_provider|ISP]] if you only have FTP access.
14
15 /!\ Please be warned that installing just by FTP (and not having shell access) is the least comfortable and most work intensive method to do it. If you need to change a file, you will have to ftp it back and forth. If you need to change many files (like your complete data_dir like when having to run some migration script) you will have to ftp many files back and forth. So if you like to have it comfortable, better get some server with shell access.
16
17We will assume a few things:
18
19 * Your ISP supports Python (with the right version) via CGI.
20 * You have no telnet/ssh-access to the webserver, but ftp access.
21 * You are not allowed to write into Python's {{{site-packages}}} directory.
22 * You are not allowed to access apache's main config file.
23
24'''Follow these steps:'''
25<<TableOfContents(3)>>
26
27== Download the latest distribution of MoinMoin ==
28
29Download the latest distribution of Moin``Moin from MoinMoin:MoinMoinDownload. Unpack it into a local directory. We do not need to run the setup.py script, we just work with the source code!
30
31== Explore the webserver configuration ==
32Now it is time to find out how your ISP supports 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:
33 * 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/pythonX.X}}} (X.X means the version number of Python like 2.3, 2.4 or newer) 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.''
34 * 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:
35 * Use your favorite FTP-client and transfer your script to your webserver's {{{cgi-bin}}} directory, using the {{{.cgi}}} file extension. Try to call its URL via a web browser. If you don't have a {{{cgi-bin}}},
36 * copy the script into your favorite directory on your webserver, using the {{{.py}}} or {{{.cgi}}} file extension. Try to call its URL via a web browser.
37 * First check it using the {{{.cgi}}} extension, then try the {{{.py}}} extension if necessary.
38{{{#!python
39#!/usr/bin/python
40
41import os.path
42import os
43import sys
44
45try:
46 __file__
47except NameError:
48 __file__ = '?'
49
50print """Content-type: text/html
51
52<html>
53<head>
54 <title>Python Exploration</title>
55</head>
56<body>
57 <table border=1>
58 <tr><th colspan=2>1. System Information</th></tr>
59 <tr><td>Python</td><td>%s</td></tr>
60 <tr><td>Platform</td><td>%s</td></tr>
61 <tr><td>Absolute path of this script</td><td>%s</td></tr>
62 <tr><td>Filename</td><td>%s</td></tr>
63""" % (sys.version,
64 sys.platform,
65 os.path.abspath('.'),
66 __file__)
67print "<th colspan=2>2. Environment Variables</th>"
68for variable in os.environ:
69 print "<tr><td>%s</td><td>%s</td></tr>\n" % (variable, os.environ[variable])
70print """
71</table>
72</body>
73</html>
74"""
75}}}
76Download: [[attachment:explore.py]]
77
78Some of the following problems may show up:
79 * 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.
80 * If you encounter a {{{404 Not found}}} error, that probably means what it says: you have chosen the wrong URL.
81 * If you have errors in your script, apache usually reports an {{{Internal Server Error}}}.
82 * If your script has wrong file privileges, apache may report a {{{Premature End of Script Headers}}}. Set the file permission so as to allow execution of the script. Your FTP-client will do the job.
83
84If 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}}}'''.
85
86== Copy directories ==
87You have to transfer four directories in the moin directory to your webserver.
88 * {{{./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 'moin_static180'. Apache has to deliver them directly.
89 * {{{./wiki/underlay}}} contains wiki templates and help pages. Place this directory on your server outside the {{{DOCUMENT_ROOT}}}, if possible. Apache should not be able to deliver these files directly.
90 * {{{./wiki/data}}} is going to contain your wiki pages. Place this outside apache's {{{DOCUMENT_ROOT}}}.
91 * {{{./MoinMoin}}} contains python source code. Place this outside apache's {{{DOCUMENT_ROOT}}}.
92
93||<bgcolor="#FFAAAA">'''SECURITY WARNING''': If you have no choice but to place {{{MoinMoin}}}, {{{underlay}}} or {{{data}}} under apache's {{{DOCUMENT_ROOT}}}, it is very important to hinder apache from directly accessing them.||
94||1. Use your favorite editor to create a file named {{{.htaccess}}}.||
95||2. Insert into this file the text {{{deny from all}}}||
96||3. Copy it via FTP into the directory you want to protect. ||
97||4. Try to access the protected directory via your webbrowser. If protection does work, you should see {{{Access denied}}}.||
98||<bgcolor="#FFAAAA">5. '''If you cannot protect these directories, please delete them from your webserver immediately. Do not continue your installation.'''||
99
100== Configure ==
101There are two files that need fine tuning:
102 * {{{./wiki/server/moin.cgi}}} is going to be called by apache whenever a wiki page is requested.
103 * {{{./wiki/config/wikiconfig.py}}} contains configuration options for your wiki.
104Choose 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.#
105
106 * /!\ If you want to host more than one Wiki you need to work with farmconfig.py !
107
108=== moin.cgi ===
109Now open {{{./wiki/server/moin.cgi}}} in your favorite editor.
110
111'''(1) Adjust python path'''. First you have to adjust your python path in line 1. The new value depends on your ISPs setup.
112{{{#!
113#!/usr/bin/python
114}}}
115
116'''(2) Set the path to Moin``Moin.''' You will find a line
117{{{
118## sys.path.insert(0, 'PREFIX/lib/pythonX.X/site-packages')
119}}}
120Uncomment this line and replace the path information. If you have run [[attachment: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.
121
122'''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
123{{{
124sys.path.insert(0, '/home/nowhere.com') # REPLACED!
125}}}
126
127Of course a relative path will be allright, too. So, sticking to our example, you could also insert
128{{{
129sys.path.insert(0, '..')
130}}}
131'''(3) Set the path to wikiconfig.py.''' Now search for
132{{{
133sys.path.insert(0, '/path/to/wikiconfig')
134}}}
135Insert the path to {{{wikiconfig.py}}} on your webserver.
136
137'''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
138{{{
139# choose one:
140sys.path.insert(0, '/home/nowhere.com/config') # absolute path
141sys.path.insert(0, '../config') # path relative to moin.cgi
142}}}
143
144=== wikiconfig.py ===
145Open {{{./wiki/config/wikiconfig.py}}}.
146
147'''(1) Set the path to your {{{data}}} directory'''. Try to find
148{{{
149data_dir = './data/'
150}}}
151Replace {{{'./data/'}}} with whatever leads to your data directory.
152
153'''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
154{{{
155# choose one:
156data_dir = '/home/nowhere.com/data/' # absolute path
157data_dir = '../data/' # path relative to moin.cgi
158}}}
159
160'''(2) Set the path to your {{{underlay}}} directory'''. Try to find
161{{{
162data_underlay_dir = './underlay/'
163}}}
164Replace {{{'./underlay/'}}} with whatever leads to the {{{underlay}}} directory on your webserver.
165
166'''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
167{{{
168# choose one:
169data_underlay_dir = '/home/nowhere.com/underlay/' # absolute path
170data_underlay_dir = '../underlay/' # path relative to moin.cgi
171}}}
172
173'''(3) Set the URL of your static files.'''
174
175Static files like images and css files are served by Apache, not by moin. You install them in a location accessible by Apache, and tell moin what is the url of those files.
176
177{{{
178url_prefix = '/moin_static180' # depends on moin version
179}}}
180
181If you copied your {{{htdocs}}} directory to {{{/moin_static180}}} under your document root, you don't need to change this.
182
183 (!) Important: url_prefix_static must start with a slash
184
185'''Example:''' You placed {{{explore.py}}} under {{{/public_html}}} and called it with {{{http://www.your-domain.com/explore.py}}}. You placed {{{htdocs}}} as {{{/public_html/moin_static180}}}. So url_prefix is correct as it is, don't change it.
186
187'''(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.
188
189== Upload moin.cgi and wikiconfig.py ==
190You 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.
191
192= Summary =
193Here is a short summary of an example installation. Having read this document, I hope you see what I did and why I did it.
194{{{
195
196ftp ./wiki/data ==> /data
197ftp ./wiki/htdocs ==> /moin_static180
198ftp ./wiki/underlay ==> /underlay
199ftp ./MoinMoin ==> /MoinMoin
200
201ftp create directory /config
202
203create ./.htaccess insert content:
204deny from all
205
206ftp ./.htaccess ==> /data
207ftp ./.htaccess ==> /underlay
208ftp ./.htaccess ==> /MoinMoin
209ftp ./.htaccess ==> /config
210
211edit ./wiki/server/moin.cgi:
212
213 replace:
214 #!/usr/bin/env python
215 by:
216 #!/usr/bin/pythonX.X
217
218 replace:
219 ## sys.path.insert(0, 'PREFIX/lib/pythonX.X/site-packages')
220 by:
221 sys.path.insert(0, '.')
222
223 replace:
224 sys.path.insert(0, '/path/to/wikiconfig')
225 by:
226 sys.path.insert(0, './config')
227
228ftp ./wiki/server/moin.cgi ==> /moin.py
229
230edit ./wiki/config/wikiconfig.py:
231
232 set data_dir:
233 data_dir = './data/'
234
235 set data_underlay_dir:
236 data_underlay_dir = './underlay/'
237
238 set url_prefix:
239 url_prefix = '/moin_static180'
240
241ftp ./wiki/config/wikiconfig.py ==> /config/wikiconfig.py
242}}}
243
244= If your provider's python is stoneage ... =
245
246 * find out what Python version the server runs
247 * find another server that runs the same Python version and there:
248 * download and unpack the same version of Python from http://www.python.org
249 * install it on that server
250 * after that, you have a nice, fresh python in $PREFIX
251 * you can ftp it to your home directory at provider and use it from there