Upgrading MediaWiki

From SubSurfWiki
Jump to navigation Jump to search

Upgrading MediaWiki is not too bad. The basic method is here.

  • First, back up.
  1. Get the DB user and password, and the DB name, from LocalSettings.php
  2. Back up the database with mysqldump -u user --password=password database_name > file.txt and mysqldump -u user --password=password --xml database_name > file.xml
  3. Compress and download these files for safe keeping
  4. Grab a backup of LocalSettings.php, plus the images, skins, and extensions directories
  • Next, grab the new installation and unpack it alongside the existing one.
  • Then copy LocalSettings.php, plus the images, skins, and extensions directories across from the old to the new.
  • Check to see if there are new things to go in LocalSettings.php, based on the README.
  • Put the old database in read-only mode with $wgReadOnly (is already in the LocalSettings.php file, commented out).
  • Make LocalSettings.php temporarily readable, then run maintenance/update.php in the new install. Do this with
sudo php update.php
  • The script has to be able to read LocalSettings and complains if it can't. This updates the database with new tables etc.
  • After this (not sure why then), copy the images directory across.
  • Finally, swap the directories.

Big upgrade

Sometimes it will prove necessary to upgrade the entire stack — LAMP and MediaWiki (e.g. if a new version of PHP is required, as for the MediaWiki 1.20 upgrade). The easiest way to do is:

  • I think the best idea is to cause an outage, because otherwise the new install will use new ports for Apache and MySQL and, well, I got stuck when I did that.
/opt/<package>/.ctlscript.sh stop
  • Grab the software, e.g.
sudo wget http://bitnami.org/files/stacks/mediawiki/1.20.3-0/bitnami-mediawiki-1.20.3-0-linux-installer.run
sudo chmod +x bitnami-mediawiki-1.20.3-0-linux-installer.run 
sudo ./bitnami-mediawiki-1.20.3-0-linux-installer.run
  • Follow the instructions and put it in the default location. It will install with a new MySQL password and put this in LocalSettings.php
  • Rename LocalSettings.php
  • Copy images, math, extensions, skins/common/images/your_logo.png, favicon.ico, and LocalSettings.php from your old installation
  • Put the MySQL password in LocalSettings.php, and sort out permissions, ownership, etc.
  • Restore the database from your text back
mysql --silent --local --password=password --user=bitnami bitnami_mediawiki < file.txt
  • Run update.php
sudo php maintenance/update.php
  • Copy anything you need from httpd.conf over from your old install — probably just your short path rewrite rules (don't just copy the file because it contains all your paths, which have changed)
  • Restart everything with .ctlscript.sh restart
  • It works! Right? Right??