Improved table markup security fix
[mediawiki.git] / INSTALL
blob469f3b8551aa66d904091060a895a9a10f9f90b0
1 ----
2 Installing Wikipedia Phase III Software
3 ----
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.
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.
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.
25 ----
26 Scripts install.php and update.php
27 ----
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.
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).
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.
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.
61 ----
62 Building from scratch
63 ----
65 Here are some more notes on building a system from scratch
66 the way it was done for the Wikipedia server:
68 Downloads:
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
77 And for math support:
78   ocaml-3.06.tar.gz
79   (TeTeX, ImageMagick, and GhostScript come with most Linux distros)
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.
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:
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
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.
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.
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. :)
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.)
117 5. Unpack Apache distribution and begin configuring, but don't finish
118   build yet. Configure with something like:
120    OPTIM='-O2 -mcpu=i686' ./configure --with-layout=Apache
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:
127    patch -p0 < /path/to/maintenance/apache-ampersand.diff
129 7. Unpack and configure PHP. Configure with something like:
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
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
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 
140 8. Finish building Apache. Configure with something like:
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
144   Update httpd.conf as needed for your site.  For example:
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]
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.
167 9. Optionally, install APC or another PHP cache plug-in, following
168   standard instructions for installing as a Zend extension.
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.
175   You'll need to compile the texvc helper script; enter the math
176   subdirectory of the source tree and run "make".
178   If you want embedded TeX support, enable it by setting
180    $wgUseTex = true;
182   in LocalSettings.php
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.
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.
195 ----
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.
205 http://mail.wikipedia.org/mailman/listinfo/wikitech-l