How to Upgrade MediaWiki to Latest Version

It is important to keep on upgrading your MediaWiki installation to the latest stable release. New releases not only offer you the new features but also provide with security patches. MediaWiki upgrade is also important for better performance of the website. The newbie admins of MediaWiki, however, sometimes find updating MediaWiki a bit intriguing. For them, here is a list of simple steps to update MediaWiki.

Prepare Before MediaWiki Upgrade

Before you begin the process, you should put your wiki on read-only mode by making a setting in LocalSettings.php:

$wgReadOnly = 'Maintenance is underway. Website is on read-only mode';
Backup

Now, first make a backup of all the important files and mysql database. Take backup of the following items

  • Database. This can be accomplished through phpMyAdmin. Using SSH access, backup of Mysql database can also be done by dumping
  • extensions directory
  • skins directory
  • images directory: If you lots of images –it would consume a lot of time to download the entire directory via FTP. The better idea is to copy the images directory to a temporary folder on server via SSH access
  • If you have changed the interface messages –then the corresponding file from languages/messages directory
  • LocalSettings.php
  • AdminSetting.php

Do not be lazy or complacent! It is easy to backup these things. It is better to be on the safer side in case of computers :-)

Download MediaWiki

Now Download latest MediaWiki package from www.mediawiki.org/wiki/Download

Make sure your server environment supports the version of MediaWiki that you are planning to install. Give special attention to PHP and mysql versions. If your server does not support, you should first ask your host to upgrade server to required PHP and mysql versions.

Install MediaWiki

Upload the new MediaWiki package on your server using an FTP client (like FileZilla).

Now open an SSH connection with your server using putty.

Unpack the package and copy the its content to your wiki directory. The new files should overwrite the existing files. For this you may use the following command:

$ tar xvzf PACKAGE_FILE_NAME -C PATH_TO_WIKI --strip-components=1

Now run the update.php file available in maintenance directory

$ php update.php

That’s it! This unzipping and overwriting of files will update MediaWiki to the latest version.

Test New Installation

Upload backed up message file and replace the new message file (only if you had made changes in the interface messages)

Check your website and see if it is running fine.

Check Special:Version page to see if it is showing the latest MediaWiki version.

Also try editing a page and upload a file to see if all is going on as it should.

If any extension is now working, download the latest version of the extension and install it.

In this process of MediaWiki upgrade, you might find the following Linux commands useful:

find total size of a directory: du -h | tail -n 1
copy entire directory: cp -r images/* ../temporary

Detailed Instructions

Detailed procedure of how to upgrade MediaWiki is available on MediaWiki website: http://www.mediawiki.org/wiki/Manual:Upgrading

I hope these steps were of use for you and saved you some time! Please let me know if you have any questions.

6 thoughts on “How to Upgrade MediaWiki to Latest Version”

  1. Hi,
    This was already given on upgrade page on mediawiki but right now removed and added a classic way. Why is actually removed from mediawiki maintainer?

    Regards

  2. This is a useful post, I followed it when upgrading from MW 1.26 to 1.28.

    After running update.php all seemed ok but the site was not running properly – e.g. Special:Preferences remained stuck on the first tab.

    My solution: I recommend to upgrade all used extensions to 1.28 first before running update.php!

  3. Hi Lalith,
    Found it very use full.
    Currently I’m using MediaWiki 1.18 version, What are the major advantage of upgrading it to >1.27 version. I need to put a business case/value to make this request.

    1. Biggest advantage is that higher versions are more secure. Also, you might find more useful extensions that are not available for lower versions of MW.

Leave a Comment

Your email address will not be published. Required fields are marked *