Help:Running MediaWiki on Debian GNU/Linux

From lensowiki
Jump to: navigation, search

  This page describes how to install mediawiki on debian using the latest official mediawiki code. if you wish to use the debian package (which essentially means you can only have one copy installed, you have an outdated version and debian forces the filesystem layout) see How to install Metawiki on Debian Sarge (skip the apt configuration stuff if you'r already running etch/sid) Remember that this installation may not be secure and ready for production purpose. It is meant to be "MediaWiki on Debian ASAP"

If you are still running woody an upgrade to sarge is strongly recommended. There seems to be a compression library issue on woody that causes mediawiki to crash with an out of memory error in some situations see bugzilla:1730 for details.

Mediawiki is now in debian's main archive. Packages are mediawiki for 1.4 releases, and mediawiki1.5 for 1.5 releases. Mediawiki1.5 package should soon be deprecated in favour of the 1.6 releases which is actually in its way to be included in main archive.

This guide documents an installation without those package. To install mediawiki using debian's package, juste type as root:

# apt-get install mediawiki1.5

Core Packages

Make sure apt's package index files are synchronized:

apt-get update

You can use either Apache 1.3 or the newer Apache 2. If you are using Apache 1.3, make sure you have the following packages installed

  • apache
  • php4
  • libapache-mod-php4
  • php4-gd
  • php4-imagick
  • php4-mysql
  • mysql-server
  • php4-cli (not needed to actually run mediawiki but required for maintinance scripts)
apt-get install apache php4 libapache-mod-php4 php4-gd php4-imagick\
                php4-mysql mysql-server php4-cli

If you are using Apache 2, you need the following packages instead

  • apache2-mpm-prefork
  • libapache2-mod-php4
  • php4-gd
  • php4-imagick
  • php4-mysql
  • mysql-server
  • php4-cli (not needed to actually run mediawiki but required for maintinance scripts)
apt-get install apache2-mpm-prefork libapache2-mod-php4 php4-gd\
                php4-imagick php4-mysql mysql-server php4-cli

The older specific version of apache2 2.0.53-3 is said to not work with MediaWiki, current 2.0.53-5 from stable (sarge) works.

Using Caudium instead of Apache

It is possible to use Caudium instead of apache. However, you must use caudium's "PHP support" module if possible. If you use Caudium, you should thus first try to install the caudium-php4 package.

If the caudium-php4 package is unusable, you can use the Universal Script Support module; however, you must then make sure to use "ugly URL's", otherwise MediaWiki will not work.

Configure Apache

Mediawiki uses the ServerName variable defined in your httpd.conf file. Make sure it is set to your website's name. If this isn't done you'll get an error that complains about not being able to connect to localhost or some other website. In apache2 add ServerName to apache2.conf (/etc/apache2/apache2.conf in Debian) file, not httpd.conf.


Configure MySQL

Most of all you need to apply mysql root password. Remember not to use same password for system root and mysql root

mysqladmin -u root password 'xxxx'

Warning: Setting the root password with the above command would allow somebody with access to your terminal to retrieve it by issuing:

history

...which may be cleared using...

history -c

Another way to set the password would be to log into mysql:

mysql -u root

Once logged into the mysql client, issue:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
exit

Once the root password is set, check if the password works:

mysql -u root

If you see:

ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)

Then mysql root account is now password protected.

Configure PHP

Make sure your php configuration file (/etc/php4/apache/php.ini or /etc/php4/apache2/php.ini) 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 MediaWiki SourceForge page example:

wget http://prdownloads.sourceforge.net/wikipedia/mediawiki-1.6.7.tar.gz

Copy it and extract in apache root directory:

sudo cp mediawiki-1.6.7.tar.gz /var/www
cd /var/www
sudo tar vxfz mediawiki-1.6.7.tar.gz

rename the extracted directory name to wik

sudo mv mediawiki-1.6.7 wiki

In order to configure the wiki you have to make the config subdirectory writable by the web server.

To make the directory writable on a Unix/Linux system:

cd /var/www/wiki
sudo chmod a+w config

Navigate your browser to http://localhost/wiki and continue with installation.

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 move the created LocalSettings.php to the parent directory.

cd /var/www/wiki/config/
chmod 640 LocalSettings.php
mv LocalSettings.php ..

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

rmdir 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 to sysop.

Installation with Debian-package

I just got it all working. What I did was to install a Debian-package with mediawiki1.5. After installation I pointed my browser to: http://localhost/mediawiki/setup and filled in the form there. After that I moved my LocalSettings.php from the folder where it was, to the suggested folder. I did a chmod 444 on all files in that folder. After that i did a "chmod 700 on the folder /etc/mediawiki1.5". Now I clicked on the URL in the installation results, and whamo, there it was, my wiki :) Did this twice on two different Debian installs today, so the procedure should work.

TeX Support

You need these packages installed:

  • ocaml
  • imagemagick
  • gs
  • cjk-latex
  • tetex-extra
  • php4-imagick
  • binutils ("/usr/bin/as" is needed by make job)
  • gcc

NOTE: Normally servers shouldn't have gcc installed (if not really necessary) for security reasons! If you run a server, don't forget to remove it after compiling.

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:

$wgUseTeX           = true;

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):

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. Normally servers shouldn't have gcc installed (if not really necessary) for security reasons, therefore it has to be installed first. I added gcc to the required packages list. If you run a server, don't forget to remove it after compiling.

(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.)

See also