1f1577b212da81b7a2474ed9fc71f6849a68409b
[openafs-wiki.git] / TWiki / TWikiInstallationGuide.mdwn
1 <div>
2   <ul>
3     <li><a href="#TWiki Installation Guide"> TWiki Installation Guide</a><ul>
4         <li><a href="#Standard Installation Steps"> Standard Installation Steps</a></li>
5         <li><a href="#Adding Variables  Rendering Rule"> Adding Variables &amp; Rendering Rules </a></li>
6         <li><a href="#Enabling Basic Authentication (."> Enabling Basic Authentication (.htaccess)</a></li>
7         <li><a href="#Generating Site Usage Statistics"> Generating Site Usage Statistics</a></li>
8         <li><a href="#Creating a New Web"> Creating a New Web</a></li>
9         <li><a href="#TWiki File System Snapshot"> TWiki File System Snapshot</a></li>
10       </ul>
11     </li>
12   </ul>
13 </div>
14
15 ## <a name="TWiki Installation Guide"></a> TWiki Installation Guide
16
17 These installation steps use the Apache web server on Linux as an example. TWiki should run on other web servers and Unix systems as well. (TWiki on Windows is possible, but has not been documented well. More on that at <http://TWiki.org/cgi-bin/view/Codev/TWikiOnWindows> )
18
19 **_Note:_** Below installation steps assume user `nobody` for all files manupulated by the cgi scripts (executed by the web server), and user `twiki` for all other files. You need to replace user `nobody` with an other user in case the web server executes the script with a different user ( default for Debian is `www-data` ). Also, you can substitute user `twiki` with your own user name.
20
21 **_Note:_** Below installation steps assume that you have control over the web server configuraton files. In case you don't (i.e. if you are installing it on a hosted server) follow the steps but use these directories instead:
22
23 <table border="1" cellpadding="0" cellspacing="0">
24   <tr>
25     <th bgcolor="#99CCCC"><strong> TWiki dir: </strong></th>
26     <th bgcolor="#99CCCC"><strong> What it is: </strong></th>
27     <th bgcolor="#99CCCC"><strong> Where to copy: </strong></th>
28     <th bgcolor="#99CCCC"><strong> Example: </strong></th>
29   </tr>
30   <tr>
31     <td><code>twiki/bin</code></td>
32     <td> CGI bin </td>
33     <td> cgi-bin enabled dir </td>
34     <td><code>/home/smith/public_html/cgi-bin/twiki</code></td>
35   </tr>
36   <tr>
37     <td><code>twiki/pub</code></td>
38     <td> public files </td>
39     <td> htdoc enabled dir </td>
40     <td><code>/home/smith/public_html/pub</code></td>
41   </tr>
42   <tr>
43     <td><code>twiki/data</code></td>
44     <td> topic data </td>
45     <td> outside of htdoc tree (for security) </td>
46     <td><code>/home/smith/twiki/data</code></td>
47   </tr>
48   <tr>
49     <td><code>twiki/templates</code></td>
50     <td> web templates </td>
51     <td> outside of htdoc tree (for security) </td>
52     <td><code>/home/smith/twiki/templates</code></td>
53   </tr>
54 </table>
55
56 Read <http://TWiki.org/cgi-bin/view/Codev/SourceForgeHowTo> in case you want to install TWiki on SourceForge.
57
58 ### <a name="Standard Installation Steps"></a> Standard Installation Steps
59
60 - Request the TWiki distribution (in Unix ZIP format) from <http://TWiki.org/download.html> .
61 - Create directory `/home/httpd/twiki` and unzip the TWiki distribution into this directory.
62 - The `twiki/bin` directory of TWiki must be set as a cgi-bin directory. Add `/home/httpd/twiki/bin` to file `/etc/httpd/httpd.conf` with only `ExecCGI` option.
63 - The `twiki/pub` directory of TWiki must be set so that it is visible as a URL. Add `/home/httpd/twiki` to file `httpd.conf` with normal access options (copy from `/home/httpd/html` ).
64 - Now add `ScriptAlias` for `/twiki/bin` and `Alias` for `/twiki` to file `httpd.conf` . <br />**_Note:_** The `ScriptAlias` **must** come before the `Alias` in Apache, otherwise it will fail to correctly set up `/twiki/bin/` , due to the fact that it sees that as being just another subdirectory of the `/twiki/` alias. <br />
65 - Here are example `httpd.conf` entries:      ScriptAlias /twiki/bin/ "/home/httpd/twiki/bin/"
66      Alias /twiki/ "/home/httpd/twiki/"
67      <Directory "/home/httpd/twiki/bin">
68          Options +ExecCGI
69          SetHandler cgi-script
70          Allow from all
71      </Directory>
72      <Directory "/home/httpd/twiki/pub">
73          Options FollowSymLinks +Includes
74          AllowOverride None
75          Allow from all
76      </Directory>
77 - Restart Apache by `/etc/rc.d/rc5.d/S85httpd restart` .
78 - Test if the `twiki/bin` directory is cgi-enabled:
79   - Enter the URL of that directory into your browser ( `http://your.domain.com/twiki/bin` ). It is not set correctly as cgi-bin in case you get something like `"Index of /twiki/bin"` . It is OK if you get a message like `"Forbidden. You don't have permission to access /twiki/bin/ on this server."`
80   - Execute the `testenv` script from your browser ( `http://your.domain.com/twiki/bin/testenv` ). It shows a table with all CGI environment variables and tests the settings in your `twiki/bin/wikicfg.pm` configuration file.
81 - Make sure PERL 5 and the PERL CGI library is installed on your system. Default location of PERL executable is `/usr/bin/perl` . In case PERL is installed in a different location, the first line of all perl scripts in the `twiki/bin` directory need to be changed (alternatively you can create a symbolic link from `/usr/bin/perl` ).
82 - To be able to edit the perl scripts and .tmpl files it is necessary to `chown` and `chgrp -R twiki` so all the files have the owner you want.
83 - The scripts execute as `nobody` . Set the file permission of all Perl scripts in the `twiki/bin` directory as executable to `-rwxr-xr-x` .
84 - Set the permission of all files below `twiki/data` so that they are writable by user `nobody`. A simple way is to chmod them to 666 ( `-rw-rw-rw-` ).
85 - Set the permission of the `twiki/data` directory and all its subdirectories so that files in there are writable by user `nobody`. A simple way is to chmod them to 777 ( `drwxrwxrwx` ).
86 - Set the permission of the `twiki/pub` directory and all its subdirectories so that files in there are writable by user `nobody`. A simple way is to chmod them to 777 ( `drwxrwxrwx` ).
87 - Edit the file `twiki/bin/wikicfg.pm` and set the variables at the beginning of the file to your needs.
88 - Make sure RCS is installed. Set `$rcsDir` in `twiki/bin/wikicfg.pm` to mach the location of your RCS binaries.
89 - Point your browser at <http://your.domain.com/twiki/bin/view> and start TWiki-ing away!
90 - Using your browser, edit the [[TWikiPreferences]] topic in the TWiki.TWiki web to set the WIKIWEBMASTER email address, the WEBCOPYRIGHT message and other preferences.
91 - Note in case the cgi scripts must have a file extension like `.pl` or `.cgi`:
92   - Add the extension to all the scripts (except for the `.pm` ones) in `twiki/bin`
93   - Edit `wikicfg.pm` and set the file extension in the `$scriptSuffix` variable.
94   - If you use `.htaccess`, edit the file and add the file extension to `edit`, `view`, `preview`, etc.
95 - Note in case the cgi scripts are **_not_** running as user `nobody`: The `*,v` RCS repository files delivered with the installation package are locked by user `nobody` . In case the user is different (e.g. `www-data` ), it is not possible to check in files, this has the effect that the topic version number does not increase when saving a topic. In this case you need to unlock all repository files and lock them as user `www-data` (check the rcs man pages), or simply delete all the repository files. A simple way to switch the locker of the RCS files is to use sed: <br />`for f in *,v; do sed 's/nobody\:/www-data\:/' $f > x; mv x $f; done`
96 - Security issue: Directories `twiki/data` , `twiki/templates` and all its subdirectories should be set so that they are **not** visible as a URL. (Alternatively, move the directries to a place where they are not visible, and change the variables in `twiki/bin/wikicfg.pm` accordingly)
97 - Enable email notification of topic changes, [[Notification of Changes|Main/TWikiDocumentation#TWiki_Notification_of_Changes]] has more. Using your browser, edit also the [[WebNotify]] topic in all webs and set the users you want to notify.
98 - Add the [TWiki:Main.PoweredByTWikiLogo](http://TWiki.org/cgi-bin/view/Main/PoweredByTWikiLogo) to your [[WebHome]] topic.
99
100 ### <a name="Adding Variables  Rendering Rule"></a> Adding Variables &amp; Rendering Rules
101
102 - Optional: You can add new rendering rules or new %VARIABLES%. To insure an easy upgrade of TWiki it is recommended to do this customization in `twiki/bin/wikicfg.pm` , not `twiki/bin/wiki.pm` .
103
104 ### <a name="Enabling Basic Authentication (."></a> Enabling Basic Authentication (.htaccess)
105
106 - Optional: If you are on a non authenticated server (i.e. not using SSL) and you would like to authenticate users:
107   - Rename file `.htaccess.txt` in the `twiki/bin` directory to `.htaccess` and change it to your needs. For details consult the HTTP server documentation (for Apache server: [[1]](http://www.apache.org/docs/mod/directives.html), [[2]](http://www.mcs.kent.edu/system/web_help/htaccess/introduction.html)). In particular, the following <font>red</font> part needs to be configured correctly: <br /><code>Redirect <font>/urlpath/to/TWiki/index.html</font> http://<font>your.domain.com/urlpath/to/TWiki/bin/</font>view</code><br /><code>AuthUserFile <font>/filepath/to/TWiki/data/</font>.htpasswd</code><br /><code>ErrorDocument 401 <font>/urlpath/to/TWiki/bin/</font>oops/TWiki/TWikiRegistration?template=oopsauth</code>
108     - **_Note:_** The browser should ask for login name and password when you click on the <u>Edit</u> link. In case `.htaccess` does not have the desired effect you need to enable it: Add "AllowOverride All" to the Directory section of `access.conf` for your `twiki/bin` directory.
109   - Copy the [[TWikiRegistrationPub]] topic to [[TWikiRegistration]]. Do that by either editing the topics in theTWiki web, or by renaming the `.txt` and `.txt,v` files in the `twiki/data/TWiki` directory.
110     - **_Note:_** You can customize the registration form if needed, like deleting or adding input tags. The `name=""` parameter of the input tags must start with: `"Twk0..."` (if this is an optional entry), or `"Twk1..."` (if this is a required entry). This will ensure that the fields are processed correctly.
111   - A new line containing user name and encrypted password gets added to the `data/.htpasswd` file when a users registers. The file that comes with the TWiki installation contains a few user accounts of TWiki core team members (needed for testing). You can edit the file and delete those lines.
112
113 ### <a name="Generating Site Usage Statistics"></a> Generating Site Usage Statistics
114
115 - Optional: You can automatically generate usage statistics for all webs. To enable this:
116   - Make sure variable `$doLogTopicView, $doLogTopicSave and $doLogTopicUpload` in `wikicfg.pm` are set. This will generate log entries in file `twiki/data/log<date>.txt` .
117   - Topic [[WebStatistics]] must be present in all webs where you want to have statistics. You can use the topic in the Main web as a template.
118   - Call the `twiki/bin/statistics` script from a cron job, once a day is recommended. This will update the [[WebStatistics]] topics in all webs.
119   - **_Attention:_** The script must run as the same user as the CGI scripts are running, which is user `nobody` on most systems. Example crontab entry: <br />`0 0 * * * (cd /path/to/TWiki/bin; ./statistics >/dev/null 2>&1)`
120   - There is a workaround in case you can't run the script as user `nobody` : Run the utility `twiki/bin/geturl` in your cron job and specify the URL of the `twiki/bin/statistics` script as a parameter. Example: <br />`0 0 * * * (cd /path/to/TWiki/bin; ./geturl mydomain.com /urlpath/to/TWiki/bin/statistics >/dev/null 2>&1)`
121   - The `twiki/bin/statistics` script can also be executed as a CGI script, just enter the URL in your browser. Examples:
122     - Update current month for all webs: <br />`http://mydomain.com/twiki/bin/statistics`
123     - Update current month for Main web only: <br />`http://mydomain.com/twiki/bin/statistics/Main`
124     - Update January 2000 for Main web: <br />`http://mydomain.com/twiki/bin/statistics/Main?logdate=200001`
125
126 <a name="CreateWeb"></a>
127
128 ### <a name="Creating a New Web"></a> Creating a New Web
129
130 - To create a new web:
131   - Use a name for the web consisting of characters `A..Z` , `a..z` but **not** in [[WikiNotation]].
132   - Create a new template directory under `twiki/templates` .
133   - Create a new data directory under `twiki/data` and check the file permission of the directory.
134   - Copy the `Web*.txt` files from the `twiki/data/Main` directory to the new data directory, preserving the original files' owner, group and permissions ( on Unix use `cp -p` ). The data files must be writable by the owner the CGI scripts are running on ( usually `nobody` ). Hint: You can set permissions of `.txt` and `.txt,v` files to `-rw-rw-rw-` and then edit the topic using your browser, RCS will restore the file permission correctly when saving the topic.
135   - Add the new web to the web list (visible in the upper right corner of each topic) by editing the site-level preferences [[TWikiPreferences]]:
136     - Add the new web to the WIKIWEBLIST variable.
137   - Add the new web to the web table (at the bottom of each [[WebHome]] topic) by editing the [[TWikiWebsTable]] topic.
138   - Change the web preferences by editing the WebPreferences topic of the new web:
139     - Set the WEBBGCOLOR variable to a color of your taste. The number represents the unique color for the web (consult an HTML book for colors.)
140     - Customize the WEBTOPICLIST variable to contain the web specific links you prefer.
141     - Optional: Set the WEBCOPYRIGHT variable to have a web-specific copyright text (at the bottom of each topic).
142   - If needed, create customized templates in the new templates directory. (Non existing templates are inherited from `twiki/templates` )
143   - If you want to use form templates - see [[FormTemplateSystem]]
144   - In case you want usage statistics for this web: Copy file `WebStatistics.txt` from the `twiki/data/Main` directory to the new data directory. Edit topic WebStatistics in the new web and delete old usage entries.
145   - Note that user home topics are only located in the %WIKITOOLNAME%.Main web, so don't try to move them or create them in other webs. From any web you can refer to users located in the %WIKITOOLNAME%.Main web like `Main.UserName` or `%MAINWEB%.UserName`.
146
147 ### <a name="TWiki File System Snapshot"></a> TWiki File System Snapshot
148
149 Here are partial directory listings showing typical file permissions and ownership. This is provided for general debugging use only and isn't an exact representation of the current distribution. There is also a complete file [[listing by directory|TWiki/TWikiImplementationNotes]], with individual file descriptions, for the current TWiki release.
150
151 Directory `twiki/bin` :
152
153     drwxrwxr-x  2 twiki twiki   4096 Jun 17 16:34 .
154     drwxrwxr-x  3 twiki twiki   4096 Jun 17 16:34 ..
155     -rw-rw-r--  1 twiki twiki    650 Feb 10  2000 .htaccess
156     -rwxrwxr-x  1 twiki twiki   4322 Mar 12 00:31 attach
157     -rwxrwxr-x  1 twiki twiki   1426 Jun 20 19:52 delete
158     -rwxrwxr-x  1 twiki twiki   9001 Jul 28 11:03 edit
159     -rwxrwxr-x  1 twiki twiki   1811 Mar 11 02:27 geturl
160     -rwxrwxr-x  1 twiki twiki   5006 Mar 11 02:41 mailnotify
161     -rwxrwxr-x  1 twiki twiki   1769 Mar 11 03:07 oops
162     -rwxrwxr-x  1 twiki twiki   6890 Jun 21 19:58 preview
163     -rwxrwxr-x  1 twiki twiki   7606 Mar 31 18:30 rdiff
164     -rwxrwxr-x  1 twiki twiki   8349 Jun 21 18:12 register
165     -rwxrwxr-x  1 twiki twiki   2693 Jul  5 14:32 save
166     -rwxrwxr-x  1 twiki twiki   3831 Jul 20 12:13 search
167     -rwxrwxr-x  1 twiki twiki   9835 Jun 20 19:03 statistics
168     -rwxrwxr-x  1 twiki twiki    509 Feb  7  2000 testenv
169     -rwxrwxr-x  1 twiki twiki  14543 Jul 20 18:46 upload
170     -rwxrwxr-x  1 twiki twiki   4755 May 22 18:11 view
171     -rwxrwxr-x  1 twiki twiki   1689 Jun 20 20:10 viewfile
172
173 Directory `twiki/templates/` :
174
175     drwxrwxr-x  4 twiki twiki   4096 Aug  3 01:17 .
176     drwxrwxr-x  4 twiki twiki   4096 Aug 19 18:38 ..
177     drwxrwxr-x  2 twiki twiki   4096 Jun 17 16:35 Know
178     drwxrwxr-x  2 twiki twiki   4096 May  1 01:24 Main
179     -rw-rw-r--  1 twiki twiki   2688 Aug 15 18:15 attach.tmpl
180     -rw-rw-r--  1 twiki twiki   1283 Jul 20 15:56 attachtable.tmpl
181     -rw-rw-r--  1 twiki twiki   1907 Jul 28 16:41 changes.tmpl
182     -rw-rw-r--  1 twiki twiki   2265 Aug 15 17:57 edit.tmpl
183     -rw-rw-r--  1 twiki twiki    965 Feb  8  2000 mailnotify.tmpl
184     -rw-rw-r--  1 twiki twiki     30 Jan 13  1999 notedited.tmpl
185     -rw-rw-r--  1 twiki twiki    940 Jul 20 15:59 notext.tmpl
186     -rw-rw-r--  1 twiki twiki    907 Jul 20 16:01 notwiki.tmpl
187     -rw-rw-r--  1 twiki twiki    341 Mar  8 11:39 noweb.tmpl
188     -rw-rw-r--  1 twiki twiki   1000 Mar  8 11:40 oops.tmpl
189     -rw-rw-r--  1 twiki twiki   1043 Oct 23 19:17 oopsaccesschange.tmpl
190     -rw-rw-r--  1 twiki twiki   1036 Oct 23 19:17 oopsaccessview.tmpl
191     -rw-rw-r--  1 twiki twiki    914 Mar  8 11:40 oopsdel.tmpl
192     -rw-rw-r--  1 twiki twiki   1423 May 29 01:23 oopslocked.tmpl
193     -rw-rw-r--  1 twiki twiki   1067 Mar  8 11:41 oopsregexist.tmpl
194     -rw-rw-r--  1 twiki twiki    955 Mar  8 11:41 oopsregpasswd.tmpl
195
196 Directory `twiki/data/` :
197
198     drwxrwxrwx  6 nobody  nobody  4096 Aug  3 01:09 .
199     drwxrwxr-x  4 twiki twiki   4096 Aug 19 18:38 ..
200     -rw-rw-r--  1 nobody  nobody         51 Apr 21 16:48 .htpasswd
201     drwxrwxrwx  2 nobody  nobody  4096 Aug 20 17:18 Know
202     drwxrwxrwx  2 nobody  nobody  4096 Aug 19 04:15 Main
203     drwxrwxrwx  2 nobody  nobody  4096 Aug 20 17:56 TWiki
204     -rw-rw-rw-  1 twiki twiki           1 Mar 11 04:19 debug.txt
205     -rw-r--r--  1 nobody  nobody  1516 Aug 20 17:56 log200008.txt
206
207 Partial file list for `twiki/data/Main` :
208
209     drwxrwxrwx  2 nobody  nobody  4096 Aug 19 04:15 .
210     drwxrwxrwx  6 nobody  nobody  4096 Aug  3 01:09 ..
211     -rw-rw-rw-  1 twiki twiki     3716 Aug 19 02:19 .changes
212     -rw-rw-rw-  1 twiki twiki             9 Aug 19 02:45 .mailnotify
213     -rw-r--r--  1 nobody  nobody        358 Aug 18 17:22 OfficeLocations.txt
214     -r--r--r--  1 nobody  nobody        878 Aug 18 17:22 OfficeLocations.txt,v
215     -rw-r--r--  1 nobody  nobody        680 Aug 18 17:36 TWikiGuest.txt
216     -r--r--r--  1 nobody  nobody  1989 Aug 18 17:36 TWikiGuest.txt,v
217     -rw-r--r--  1 nobody  nobody        459 Aug 18 17:19 TWikiUsers.txt
218     -r--r--r--  1 nobody  nobody  3840 Aug 18 17:19 TWikiUsers.txt,v
219     -rw-r--r--  1 nobody  nobody         95 Aug 19 03:06 WebChanges.txt
220     -r--r--r--  1 nobody  nobody        284 Aug 19 03:06 WebChanges.txt,v
221     -rw-r--r--  1 nobody  nobody  1853 Aug 18 18:08 WebHome.txt
222     -r--r--r--  1 nobody  nobody  6523 Aug 18 18:08 WebHome.txt,v
223
224 Directory `twiki/pub/` :
225
226     drwxrwxrwx  6 nobody  nobody  4096 Aug  3 01:21 .
227     drwxrwxr-x  3 twiki twiki   4096 Jun 17 16:35 ..
228     drwxrwxrwx  3 nobody  nobody  4096 Jun 17 16:35 Know
229     drwxrwxrwx  2 nobody  nobody  4096 Aug  3 01:21 Main
230     drwxrwxrwx  3 nobody  nobody  4096 Aug  3 01:21 TWiki
231     -rw-rw-r--  1 twiki twiki   1078 Jan 14  2000 favicon.ico
232     drwxrwxr-x  2 twiki twiki   4096 Jun 17 16:35 icn
233     -rw-rw-r--  1 twiki twiki   3016 Oct  5  1999 twikilogo.gif
234     -rw-rw-r--  1 twiki twiki   5320 Oct  5  1999 twikilogo1.gif
235     -rw-rw-r--  1 twiki twiki   6125 Oct  5  1999 twikilogo2.gif
236     -rw-rw-r--  1 twiki twiki   7218 Oct  5  1999 twikilogo3.gif
237     -rw-rw-r--  1 twiki twiki   6710 Oct  5  1999 twikilogo4.gif
238     -rw-rw-r--  1 twiki twiki   2877 Jun  7  1999 wikiHome.gif
239
240 Partial file list for `twiki/pub/icn/` :
241
242     drwxrwxr-x  2 twiki twiki   4096 Jun 17 16:35 .
243     drwxrwxrwx  6 nobody  nobody  4096 Aug  3 01:21 ..
244     -rw-rw-r--  1 twiki twiki    801 Mar 26  1999 _filetypes.txt
245     -rw-rw-r--  1 twiki twiki    143 Mar  9  1999 bat.gif
246     -rw-rw-r--  1 twiki twiki    926 Mar  9  1999 bmp.gif
247     -rw-rw-r--  1 twiki twiki    141 Mar 25  1999 c.gif
248     -rw-rw-r--  1 twiki twiki    144 Mar  9  1999 dll.gif
249     -rw-rw-r--  1 twiki twiki    152 Mar  9  1999 doc.gif
250
251 -- [[PeterThoeny]] - 16 Mar 2001 <br />