How to install MediaWiki on Debian Wheezy

mediawiki 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. Make sure your virtual server is up-to-date:

apt-get update
apt-get upgrade

‘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

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

Optionally,  install ImageMagick for image resizing:

apt-get install ImageMagick

Install the MediaWiki package:

apt-get install mediawiki mediawiki-extensions

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

Restart Apache for the changes to take effect:

service apache2 restart

Configure MediaWiki at:


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 do any of this if you use one of our Linux 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 please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

How to install Anchor CMS on a Debian 7 VPS
Securing your Ubuntu/Debian based VPS using IPTABLES/Netfilter firewall
How to Install MongoDB on Ubuntu 16.04
  • Tarcas


    Author Reply

    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)

    • admin


      Author Reply

      Make sure that you use the correct MySQL information.

Free Migration to RoseHosting. Award Winning Linux VPS Hosting with Fully Managed Support. Coupon RHBLOG50 for 50% offOrder Now