How to Install MediaWiki on Debian

How to install MediaWiki on Debian

We’ll show you, How to install MediaWiki on Debian. MediaWiki is an open source PHP-based software application developed by the Wikimedia Foundation. MediaWiki requires Apache web server, PHP 5 and a database server (MySQL, PostgreSQL, or SQLite) installed and running on the server. This is a short tutorial on how to install MediaWiki on a virtual server with Debian Wheezy.

1. Update OS Packages

Make sure your virtual server is up-to-date:

apt-get update
apt-get upgrade

2. Install MySQL Server

‘apt-get update’ will refresh your package list so it’s all up to date, then the upgrade will upgrade any packages that have newer versions. Install MySQL using the following command:

apt-get install mysql-client mysql-common  mysql-server

3. Set Up Root Password

Set the mysql root password:

mysqladmin -u root password xxxxxxxx

where ‘xxxxxxxx’ will be your new mysql ‘root’ password. Set up a new user for the mediawiki database and create ‘mediawiki’ MySQL database using the MySQL command line client as follows:

#mysql -u root -p mysql
mysql > create database mediawiki;
mysql > grant index, create, select, insert, update, delete, alter, lock tables on mediawiki.* to 'your_wiki_user'@'localhost' identified by 'your_password';
mysql > flush privileges;

Do not forget to change ‘your_wiki_user’ and ‘your_password’ accordingly.

4. Install Apache and PHP

Install Apache and PHP using the following command:

apt-get install apache2 libapache2-mod-php5 php5 php5-common php5-cli php5-mysql php5-mcrypt php5-curl php5-gd php5-curl php5-intl php-pear

5. Install ImageMagick

Optionally,  install ImageMagick for image resizing:

apt-get install ImageMagick

6. Install MediaWiki

Install the MediaWiki package:

apt-get install mediawiki mediawiki-extensions

6. Configure PHP

Locate the php configuration file using the following command:

php -i | grep php.ini

By default it is /etc/php5/apache2/php.ini Edit the ‘php.ini’ file and add/modify the following lines:

max_execution_time = 300
max_input_time = 120
; Maximum amount of memory a script may consume (set 'memory_limit' to at least 20MB, recommended value is 128MB or higher)
memory_limit = 20M

7. Restart Apache

Restart Apache for the changes to take effect:

service apache2 restart

8. Configure MediaWiki

Configure MediaWiki at:


9. Continue the Installation via Web Browser

Open http://<your-IP-or-hostname>/mediawiki/ and follow the installation instructions (setup some settings, such as : wiki name, name and password for the wiki administrator, the name of the database, MySQL user and password). After everything is done, do not forget to delete the entire config directory for security reason.

Of course you don’t have to install MediaWiki on Debian, if you use one of our MediaWiki VPS hosting services, in which case you can simply ask our expert Linux admins to install MediaWiki for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to install MediaWiki on Debian,  please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

4 thoughts on “How to Install MediaWiki on Debian”

  1. This did not work for me. I have tried it three times, and each time I get the following when loading the wiki after putting the LocalSettings.php file in place.
    Sorry! This site is experiencing technical difficulties.
    Try waiting a few minutes and reloading.
    (Cannot access the database)


Leave a Comment

To prove you are human please solve the following *