Having installed and configured LAMP on our Arch Linux box, we will now go further and migrate our existing Mediawiki wiki from a Debian server to the Pi.
General disclaimer applies, no liability will be accepted for any loss or damage, use at your own risk and do frequent backups!
Make sure you have a full database backup before restoring anything.
Install and Configure Mediawiki on Arch Linux Server
Navigate to Apache root directory:
# cd /srv/http
Download the installation file:
# wget http://dumps.wikimedia.org/mediawiki/1.21/mediawiki-1.21.2.tar.gz
At the time I write this, there’s already a newer version of Mediawiki released, v1.22. However, our Debian server is hosting Mediawiki v1.21.2, therefore we go for the same version here to avoid any compatibility issued that may arise after migration.
Extract files from the archive:
# tar xvfz ./mediawiki-1.21.2.tar.gz
Rename Mediawiki folder to something sensible:
# mv ./mediawiki-1.21.2 ./wiki
Remove the archive file as it is no longer needed:
# rm ./mediawiki-1.21.2.tar.gz
Go to http://localhost/wiki and finish the installation. Since we’re moving our Mediawiki wiki from another server, web installation options are not that important – all settings will be restored from a backup anyway. Just for the records, we chose “ENGINE=InnoDB” and “DEFAULT CHARSET=binary”.
Move Mediawiki Files from Debian Server to Arch Server
On a Debian server, we firstly need to backup the database:
# mysqldump -u sandy -p mediawiki_db > /root/wiki_backup.sql
Once finished, navigate to the Mediawiki installation folder:
# cd /var/www/wiki
And backup all Mediawiki extensions:
# tar cvfz ./extensions.tgz ./extensions
Plus backup all images:
# tar cvfz ./images.tgz ./images
Now, the next step is to transfer all files from Debian server to Arch server:
# scp -24 -P12 /root/wiki_backup.sql [email protected][arch-server-ip]:/home/sandy # scp -24 -P12 ./extensions.tgz [email protected][arch-server-ip]:/home/sandy # scp -24 -P12 ./images.tgz [email protected][arch-server-ip]:/home/sandy
Don’t forget to copy LocalSettings.php, favicon.ico and logo files ./skins/common/images/mylogo.png:
# scp -24 -P12 ./skins/common/images/mylogo.png [email protected][arch-server-ip]:/home/sandy # scp -24 -P12 ./LocalSettings.php [email protected][arch-server-ip]:/home/sandy # scp -24 -P12 ./favicon.ico [email protected][arch-server-ip]:/home/sandy
All the files we need are transferred, let’s go back to Arch server. First of all, import the database backup:
# mysql -u sandy -p mediawiki_db < /home/sandy/wiki_backup.sql
Extract extensions.tgz and images.tgz archives and move them to the Mediawiki installation folder:
# tar xvfz /home/sandy/extensions.tgz # tar xvfz /home/sandy/images.tgz # mv /home/sandy/extensions /srv/http/wiki # mv /home/sandy/images /srv/http/wiki
Also move LocalSettings.php, favicon.ico and logo files:
# mv /home/sandy/LocalSettings.php /srv/http/wiki # mv /home/sandy/favicon.icon /srv/http/wiki # mv /home/sandy/mylogo.png /srv/http/wiki/skins/common/images
Make cache directory writable:
# chmod 0777 /srv/http/wiki/cache
Run the update script:
# php /srv/http/wiki/maintenance/update.php --quick
The last thing left to do – open LocalSettings.php and change server attribute to our Arch’s IP:
$wgServer = "https://ARCH_SERVER_IP/wiki";