Migrating TurnKey Mediawiki from v14.1 to v14.2

TurnKey Mediawiki v14.2 saw a change in how the Mediawiki software itself is installed. Since the Debian package is no longer present in jessie, the appliance now uses the upstream installation archive.

The migration from Mediawiki installed from Debian packages to the upstream Mediawiki now installed in the TurnKey Mediawiki appliance should be fairly straightforward. The paths containing various parts of the Mediawiki platform have changed.

Old folder New folder
/etc/mediawiki /var/www/mediawiki
/usr/share/mediawiki /var/www/mediawiki
/var/lib/mediawiki /var/www/mediawiki

 

 

 

 

As can be seen, the Mediawiki files are no longer scattered all over the filesystem but gathered in one place (the webroot, /var/www/mediawiki). While this is a bit of a hurdle, it allows one to use the upstream Mediawiki HOWTOs without adjusting them to the Debian paths. The process of migrating your old Mediawiki install to a new version should include moving over the file data, the database dump and the images.

Database

The database can be duplicated with the aid of mysqldump. The usual command looks like this:

# mysqldump -h localhost -u mediawiki -p mediawiki > backup.sql

Then upload the dump to the target machine using e. g. scp:

# scp backup.sql someuser@example.com:

Finally, load it to the target server's database:

# mysql < backup.sql

If your target machine is an already initialized instance of v14.2 TurnKey Mediawiki, it will have the needed user and database. The password however will be different; you can use the one in /var/www/mediawiki/LocalSettings.php on the target server.

Files

Mediawiki provides a script which makes obtaining "backups" of the file-based content easy.

# php /usr/share/mediawiki/maintenance/dumpBackup.php --current --report --output=bzip2:wikiexport.xml.bz2

Afterwards, copy the file to your new server using scp as already shown above. You can restore it with:

# bzip -d wikiexport.xml.bz2
# php /var/www/mediawiki/maintenance/importDump.php wikiexport.xml

Images

First, generate an archive of all images on the old server:

# tar cjf wikiimages.tar.bz2 /usr/share/mediawiki/images

Then, move it to the new location and import:

# tar xjf wikiimages.tar.bz2
# php /var/www/mediawiki/maintenance/importImages.php --overwrite --search-recursively images/

Finish

Finally, make sure that the permissions are set properly after you have performed the previous steps as root.

# chown -R www-data:www-data /var/www/mediawiki

If you are installing TurnKey Mediawiki v14.2 over an old installation, preparing a full backup (instead of just the Mediawiki data as detailed above) in advance of the migration is advised.

For additional pointers, please consult the Mediawiki manual on moving as well as backing up and restoring from a backup.