MediaWiki on Debian Linux

As added value to or small business Linux server, we install MediaWiki, which can be used as a document management / collaboration system, a 'groupware' like environment to create, store and share information, or a content management system for the intranet. Being a wiki, MediaWiki generates a dynamic site. If you're interested in (automatically) generating a static web site from given content, see Apache Forrest.


Create a LAMP server (Linux, Apache, MySQL, PHP). You need to meet the minimal requirements re. Apache, MySQL, PHP described by MediaWiki.

create the wiki database in mysql

run mysql a root to create a user account and a database for the wiki :

	mysql -u root -p mysql

	#do the folowing in the mysql client:
	mysql> grant select, insert, update, create, delete, lock tables on wiki.* 
		  to wiki@localhost identified by 'new_wiki_password_here';

	mysql> create database wikidb;
		Query OK, 1 row affected (0.04 sec)

	#tests to see if everything is OK : this should show at least a wiki database and a wiki user

	mysql> show databases;
	mysql> select user, password from user;

	mysql> \q


install MediaWiki

Once you have Apache, MySQL, PHP, and the wiki database and user, setting up MediaWiki is a piece of cake. You just have to download the required files (here with 'wget' -- change the url to a server near you and check for the most current version : MediaWiki Download page), unpack them somwhere where apache can find them (a subdirectory of /srv/http/), direct a browser to the setup script, and follow the instructions :

	# download files
	cd /tmp
	tar -xvzf mediawiki-*.tar.gz

	#copy the contents of the newly created /tmp/mediawiki-* to /srv/http/wiki
	mkdir /srv/http/wiki
	rm mediawiki-*.tar.gz
	cd /tmp/mediawiki-*
	cp -r * /srv/http/wiki/
	ls -al /srv/http/wiki |more

	# from the mediawiki setup instructions:
	# In order to configure the wiki you have to make the config subdirectory writable by the web server. 
	# Once configuration is done you'll move the created LocalSettings.php to the parent directory,
	# and for added safety you can then remove the config subdirectory entirely.

	# make wiki dir writable

	cd /srv/http/wiki
	chmod a+w config

now, browse to http://<your_web_server>/wiki/. This will direct you to the MediaWiki setup script at http://<your_web_server>/wiki/config/index.php as long as the configuration has not been completed.

While running the mediawiki setup script, make sure you enter the correct names for wiki database and wiki user, namely the ones you used during database setup. You then do not need to supply the root account and password in the web form : the wiki user account will be used to create the database because you've granted it the required priviliges to the database earlier on.

After the "installation succesful" message, copy LocalSettings.php to the parent directory and remove config, as instructed. Your wiki will then be at http://<your_web_server>/wiki. It may be interesting to put a link on the intranet index page.

	cd /srv/http/wiki/config
	cp LocalSettings.php ../LocalSettings.php
	cd ..
	rm -r config
	#important: protect localsettings.php
	chmod 700 LocalSettings.php

Configuring and managing mediawiki

When you've completed this installation, the wiki is ready for use : you can start reading whatever default content is present (mostly links to online help), and start editing and creating pages. However, you might want to customize the wiki and configure it to your specific needs first.

Koen Noens
June 2006