fixing tpyos, adding note on PHP interpreter for Debian users
[lhc/web/wiklou.git] / INSTALL
1 ----
2 Installing Wikipedia Phase III Software
3 ----
4
5 The Wikipedia software was developed collaboratively by
6 many people, so it's something of a hodgepodge. The
7 main wiki software itself is written in PHP, and requires
8 the Apache web server and MySQL database. The optional
9 math rendering functions are written in Objective CAML,
10 which is required to compile them. The test suite is
11 written in Java, using several external libraries.
12
13 Recommended versions are: Apache 1.3.27 or later; MySQL
14 4.0.13 or later; PHP 4.3.2 or later. The installation at
15 wikipedia.org also uses PHP Accelerator software, but
16 that's entirely optional and doesn't affect anything else.
17
18 The math rendering functions are more complex, and will
19 probably only work on Linux. Objective CAML (probably
20 3.06 or later) is required to compile texvc, but produces
21 static binaries. TeTeX and ImageMagick are required at
22 runtime, and ImageMagick requires GhostScript. These are
23 present in most Linux distributions.
24
25 ----
26 Scripts install.php and update.php
27 ----
28
29 Before installing the software, you must copy the file
30 "LocalSettings.sample" to "LocalSettings.php", and
31 "AdminSettings.sample" to "AdminSettings.php", and
32 customize both of the php files to your local setup
33 (things like installation path, passwords, etc.) The
34 script install.php can then be run to install the
35 software. It must be run from the command line with
36 PHP: that is, type "php install.php" (you may need to
37 specify the path the php executable). You will probably
38 need to run as root.
39
40 Hint: If you are using Debian, the PHP interpreter is
41 not part of the "php4" package; you need to install
42 php4-cgi separately (the interpreter will be called
43 php4).
44
45 This script will copy all the necessary software over to
46 the directories you have specified in the settings files.
47 It will then warn you that it is about to create the
48 database and give you the chance to exit. If you are
49 installing the software to an existing database, you can
50 answer "no" here and it will be left alone. The software
51 installation will be otherwise complete. If you do choose
52 to create a new database, you will need te root password
53 to your MySQL installation.
54
55 If you are merely updating an existing installation, run
56 "php update.php" instead of install. This will copy all
57 the software, and also run any database updates that may
58 be necessary. These should give appropriate warnings if
59 there are any dangerous ones.
60
61 ----
62 Building from scratch
63 ----
64
65 Here are some more notes on building a system from scratch
66 the way it was done for the Wikipedia server:
67
68 Downloads:
69
70 gcc-2.95.3.tar.gz (only if you now have gcc 2.96)
71 mysql-4.0.13.tar.gz (or 3.23.57 should work)
72 libiconv-1.8.tar.gz
73 apache_1.3.27.tar.gz
74 php-4.3.2.tar.gz
75 apc-cvs.tar.gz
76
77 And for math support:
78 ocaml-3.06.tar.gz
79 (TeTeX, ImageMagick, and GhostScript come with most Linux distros)
80
81 1. MySQL strongly recommends using gcc 2.95 to compile MySQL.
82 RedHat Linux 7.x comes with 2.96 by default, so you'll have to install
83 2.95 first. Use "../gcc*/configure --enable-shared" If your Linux
84 installation doesn't use gcc 2.96, or has a more recent gcc 3.x,
85 you can skip this step.
86
87 2. Install MySQL source; add "mysql" user and group. Make sure the
88 directory into which you installed gcc 2.95 appears before the
89 directory of gcc 2.96 in your path. Configure with:
90
91 FLAGS="-O3 -mcpu=i686" CXX=gcc CXXFLAGS="-O3 -mcpu=i686 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charset=complex
92
93 Edit the file myisam/ftdefs.h, changing the define for minimum word
94 length for fulltext indexing: #define MIN_WORD_LEN 2. Update
95 $wgDBminWordLen in LocalSettings.php to reflect this. Build and
96 install according to instructions. Make root user as recommended;
97 the root password will be required for the wiki installation script.
98
99 3. Unpack the phase3.zip source distribution, or check out the "phase3"
100 module from CVS. Copy LocalSettings.sample to LocalSettings.php,
101 AdminSettings.sample to AdminSettings.php, and customize them for
102 things like local paths and passwords. If desired, update
103 FulltextStoplist.php from the MySQL sources if you have customized
104 MySQL's stop list.
105
106 If you are running anything other than Wikipedia itself you'll want
107 to make a lot of changes to the LanguageXX.php files so it talks about
108 _your_ site and _your_ license. :)
109
110 4. Optionally, install libiconv (http://www.gnu.org/software/libiconv/).
111 This will be used by some language packages for converting
112 native-charset URLs to and from UTF-8. If you're running an
113 English-only wiki, this probably won't be necessary. (Most Linux
114 distributions should come with libiconv anyway, but check for
115 a separate 'dev' package if on RedHat.)
116
117 5. Unpack Apache distribution and begin configuring, but don't finish
118 build yet. Configure with something like:
119
120 OPTIM='-O2 -mcpu=i686' ./configure --with-layout=Apache
121
122 6. If you'll want to use Apache's mod_rewrite to make page-viewing URLs
123 look like static links (as wikipedia.org does), install the included
124 patch "apache-ampersand.diff" which is needed to support page titles
125 with ampersands in them:
126
127 patch -p0 < /path/to/maintenance/apache-ampersand.diff
128
129 7. Unpack and configure PHP. Configure with something like:
130
131 ./configure --enable-apc --enable-shmop --with-zlib --with-zlib-dir=/usr/lib --with-mysql=/usr/local/mysql --with-iconv=/usr/local/lib --with-apache=/home/lee/src/apache_1.3.26
132
133 Or for Apache 2.0 module:
134 ./configure --enable-shmop --with-zlib --with-zlib-dir=/usr/lib --with-mysql=/usr/local/mysql --with-iconv --with-apxs2filter=/usr/local/apache/bin/apxs
135
136 (using your own local paths, of course). Build and install as
137 instructed. Set "register_globals" on in the config file, and
138 "warnings" to
139
140 8. Finish building Apache. Configure with something like:
141
142 OPTIM='-O2 -mcpu=i686' ./configure --with-layout=Apache --enable-module=rewrite --enable-module=mmap-static --enable-module=headers --enable-module=expires --activate-module=src/modules/php4/libphp4.a
143
144 Update httpd.conf as needed for your site. For example:
145
146 <IfModule mod_php4.c>
147 AddType application/x-httpd-php .php .php4 .phtml
148 AddType application/x-httpd-php-source .phps
149 </IfModule>
150 <IfModule mod_php4.c>
151 php_admin_flag engine off
152 </IfModule>
153 <Directory "DIRECTORY_OF_WIKI_SCRIPTS">
154 <IfModule mod_php4.c>
155 php_admin_flag engine on
156 </IfModule>
157 </Directory>
158 RewriteEngine On
159 RewriteMap ampescape int:ampescape
160 RewriteRule ^/wiki/(.*)$ /wiki.phtml?title=${ampescape:$1} [L]
161
162 It is *seriously* recommended that you configure the webserver
163 to disable running of PHP scripts except in the script directories
164 (the "php_admin_flag engine off/on" directives above) to prevent
165 the uploading and running of malicious scripts.
166
167 9. Optionally, install APC or another PHP cache plug-in, following
168 standard instructions for installing as a Zend extension.
169
170 10. If using embedded TeX support, be sure TeX and ImageMagick are
171 installed (they are common on most Linux distros and freely
172 downloadable). Also get and install OCaml according to its
173 instructions.
174
175 You'll need to compile the texvc helper script; enter the math
176 subdirectory of the source tree and run "make".
177
178 If you want embedded TeX support, enable it by setting
179
180 $wgUseTex = true;
181
182 in LocalSettings.php
183
184 11. You should now be able to run the install.php script. Use PHP in
185 command-line mode, i.e., type "php install.php". Should be run as
186 root, or as a user or group able to create files and directories
187 in the installation tree.
188
189 12. If you have Java installed and running, install the "ant" package
190 from Apache (http://ant.apache.org/) and run ant in the testsuite
191 directory to build the tests. Copy wikitest.prefs.sample to
192 wikitest.prefs, and edit to reflect your local settings. Then
193 "./run WikiSuite -o -b" will run the whole test suite and report.
194
195 ----
196
197 Don't forget that this is pre-release software under development!
198 Chances are good there's a crucial step that hasn't made it
199 into the documentation. You should probably sign up for the
200 Wikipedia developers' mailing list; you can ask for help (please
201 provide enough information to work with, and preferably be aware
202 of what you're doing!) and keep track of major changes to the
203 software, including performance improvements and security patches.
204
205 http://mail.wikipedia.org/mailman/listinfo/wikitech-l
206