Manual:Running MediaWiki on Debian GNU/Linux

This page describes how to install MediaWiki on Debian using the latest official MediaWiki code.

Using the Debian packages
MediaWiki is now in Debian's main archive. The main packages is mediawiki (which provides the latest packaged version of mediawiki). Using this package will allow you to receive upgrades and security fixes. It is easy to learn and will give you years of safe and trouble-free use.

To install MediaWiki using Debian's packages, just type as root: You will be asked to set a root MySQL password during the installation
 * 1) apt-get install mediawiki

You may also want to install the package mediawiki-extensions: NOTE: mediawiki-extensions is a large meta package containing mediawiki-extensions-base (Base package), mediawiki-extensions-collection (Collection extension), mediawiki-extensions-confirmedit (ConfirmEdit), mediawiki-extensions-fckeditor (FCKeditor), mediawiki-extensions-geshi (SyntaxHighlight_GeSHi extension), mediawiki-extensions-graphviz (GraphViz extension), mediawiki-extensions-ldapauth (LdapAuthentication extension), and mediawiki-extensions-openid (OpenID extension). Any of these extensions can be installed individually.
 * 1) apt-get install mediawiki-extensions

mediawiki will be installed in /var/lib/mediawiki. Create a symbolic link to the www root of your webserver.


 * 1) ln -s /var/lib/mediawiki /var/www

Open the installation script in your browser.

$ firefox localhost/wiki/config/index.php

After the installation script finishes, copy the given LocalSettings.php to /var/lib/mediawiki

Edit Local Settings to change $wgLogo:
 * 1) vi  /etc/mediawiki/LocalSettings.php

Possibly, set short URL.

Configure Apache
If you want to have MediaWiki run on a virtual host, you'll want to add a file in the /etc/apache2/sites_available directory. See the Debian documentation for more information.

Also be aware that if you have PHP configured in anything like a safe mode such that open_basedir is very restrictive then you'll need to add, in an appropriate place such as a  section, something like:

php_admin_value open_basedir ".:/var/lib/mediawiki1.7:/usr/share/mediawiki1.7:/etc/mediawiki1.7"

Configure PHP
Make sure your PHP configuration file (/etc/php4/apache/php.ini or /etc/php4/apache2/php.ini or the equivalent line if you have PHP5 which the MediaWiki 1.7 installation will have) has this line:

memory_limit = 20M

and the following lines uncommented:

extension=mysql.so extension=gd.so

restart Apache / Apache2

apachectl restart OR  apachectl graceful

apache2ctl restart OR  apache2ctl graceful

Get latest MediaWiki
Get the latest MediaWiki from Download page:

wget http://download.wikimedia.org/mediawiki//mediawiki-.tar.gz

Copy it and extract in apache root directory:

sudo mv mediawiki-.tar.gz /var/www cd /var/www sudo tar vxfz mediawiki-.tar.gz

rename the extracted directory name to wiki sudo mv mediawiki- wiki

Pay good attention for "Checking environment..." in MediaWiki installation script. This can solve a lot of problems for your MediaWiki successful installation. Fill out the configuration form and continue.

Once configuration is done you'll need to download the LocalSettings.php file and put it in your wiki directory.

For added safety you can then remove the config subdirectory entirely.

rm -r config

And navigate your browser to http://localhost/wiki to see your new wiki. Done!

If you want to setup a master Source of wiki, and multi-slave for different wiki sites. You can ...

get a auto. generate wiki slave script from create_slave_wiki

run the wiki init. install on web, then create the LocalSettings.php.

create a user, then change him/her to sysop.

TeX Support
You need these packages installed:
 * ocaml
 * imagemagick
 * gs
 * cjk-latex (now called latex-cjk-all)
 * tetex-extra (now in texlive-base, is installed by latex-cjk-all)
 * php4-imagick
 * binutils ("/usr/bin/as" is needed by make job)
 * gcc

apt-get install ocaml imagemagick gs cjk-latex tetex-extra php4-imagick binutils gcc

or you can just use the mediawiki-math package. There is all packages needed include its.: apt-get install mediawiki-math

After installation, enable inline LaTeX equations by uncommenting: in LocalSettings.php file.(by default in /etc/mediawiki)

It is not necessary to make texvc if you install the mediawiki-math package. However, /var/www/wiki/math/README does not specify what permissions are necessary for the math directory. I get this error under Ubuntu Breezy after installing the mediawiki-math package. Failed to parse (Can't write to or create math output directory):

If you get the above error, make sure that the '$wgUploadPath' and '$wgUploadDirectory' in LocalSettings.php point to an existing directory which is writable by the webserver. For the mediawiki1.5 1.5.8-1 package, you may have to edit LocalSettings.php to change the directory name from 'images' to 'upload' (check your /var/lib/mediawiki1.5 directory for this).

Make sure your php.ini contains the following row: extension=imagick.so Next compile texvc in your math directory: cd /var/www/wiki/math make You may have to manually create the directories for math temp and output directories: cd /var/www/wiki/images mkdir -m777 math tmp

Ocaml-fix
NOTE: This problem is only about missing gcc.

(Added 18/05/05)

Using make I got some errors using Debian stable (Sarge) (unfortunately they are not in my console any more, so i cant show them) but installing additional packages worked. The Error Messages are similar to those (reproduced on ubuntu) :

ocamlopt -c util.ml ocamlc -c render_info.mli ocamlc -c tex.mli ocamlyacc parser.mly ocamlc -c parser.mli ocamlopt -c parser.ml ocamlc -c html.mli ocamlopt -c html.ml ocamlc -c mathml.mli ocamlopt -c mathml.ml ocamlc -c texutil.mli ocamlopt -c texutil.ml ocamlopt -c render.ml ocamllex lexer.mll 188 states, 3222 transitions, table size 14016 bytes ocamlopt -c lexer.ml ocamlopt -c texvc.ml ocamlopt -o texvc unix.cmxa util.cmx parser.cmx html.cmx mathml.cmx texutil.cmx render.cmx lexer.cmx texvc.cmx sh: gcc: command not found Error during linking make: *** [texvc] Error 2 rm parser.ml lexer.ml

In order to fix the problems do the following install:

apt-get install ocaml-core gcc

NOTE: If you have run ocaml -i thinking this would help (as I did) the script may have removed some files. If you can, copy the contents of a backup /images/math directory to your new one after having deleted the old files and run make again.

Note that you have to change the LaTeX code to see if it works (purge the page.)

This worked on etch and mediawiki 1.11
If you do "sudo chmod -R 0777 images"(losing safety), the following setting works well:
 * 1) go to /wiki/math/
 * 2) apt-get install ocaml texlive imagemagick build-essential ocaml-core gcc
 * 3) add new folder math in wiki/images
 * 4) chmod 777 math
 * 5) chown www-data math
 * 6) in localsettings.php insert $wgTmpDirectory = "$IP/images/math";
 * 7) in localsettings.php change to $wgUseTeX           = true;
 * 8) test if it works - enter "* \int_a^x f(\alpha\,)\,dx " on a page and save it

The following LocalSetting.php settings works on Hardy and mediawiki 1.15

 * 1) $wgTexvc ="/usr/bin/texvc";
 * 2) $wgUseTeX          = true;
 * 3) $wgUploadPath = "images";
 * 4) $wgUploadDirectory = "images";
 * 5) $wgMathPath = "$wgScriptPath/images";
 * 6) $wgMathPath = "$wgScriptPath/images";
 * 7) $wgTmpDirectory = "$wgScriptPath/images";

Sufficient package combination for Etch and Mediawiki 1.12
apt-get install texlive imagemagick gs make ocaml
 * If you do not have texvc:
 * After build of texvc, you may remove every packages installed with "ocaml".

apt-get install texlive imagemagick gs
 * If you have texvc (you can build it on another Etch):

Links

 * MediaWiki installation in Debian and Windows XP (as part of Synarcher installation)