Setup MediaWiki on AWS
D. Thiebaut (talk) 16:44, 13 January 2018 (EST)
This page contains very sketchy steps for setting up (in my case moving) an existing mediawiki installation to AWS. This list is mostly for myself to remember what steps I have taken.
Contents
Mediawiki Installation/Upgrade
- Follow the steps from https://www.mediawiki.org/wiki/Manual:Upgrading
- Download the new mediawiki in a directory belonging to the Web server
- unzip/untar.
- Create new MySql user/password/database on localhost (same host as Web server)
- Verify that base directory of mediawiki installation is accessible from a browser by putting a phpinfo.php file in it and loading it up with browser.
- use browser and point to /mw-config in the mediawiki web directory. Enter database information.
- Update the LocalSettings.php file
- If migrating, copy the extensions, skins, images, media, Downloads directory from old wiki to new installed wiki.
- Install one extension at a time in extensions directory, and at the end of LocalSettings.php
Updated Extensions
I had to update several extensions to match the new format.
AWS
EC2
- Go for free-tier t2-micro with attached EBS drive (20GB)
- Set OS to Ubuntu Server 16.04.
-
...
- Install MediaWiki on it, without data
- Install emacs
- Make an AMI out of it
- Move the images, extensions, skins, etc to newly installed MW.
- Install ddclient.
...
S3
- Create a bucket for backups
...
Backups
- Install duplicity and duply
- In the process create a GnuPG key for encryption of backups on S3
- All information in /home/ubuntu/.duply/test/conf
- Duplicity conf file:
- create script in /usr/local/bin, called backupDftWiki3MySql.sh to do mysqldump of MW to an sql file, and store it:
#! /bin/bash
# This will be called from a root cron job
mysqldump --user=thiebaut --password=xxxxxxxxxx dftwiki3 > /data/html/dftwiki3/backups/dftwiki3.sql 2> /dev/null
cd /data/html/dftwiki3/backups
gzip -f dftwiki3.sql
Crontab
- Crontab runs as root
# ------------------------------------------------ # use mysqldump to dump mysql database for dftwiki3 # into a file called dftwiki3.sql in /data/html/dftwiki/backups 0 3 * * * /usr/local/bin/backupDftWiki3MySql.sh # ------------------------------------------------ # use duplicity (via duply) to backup /data/html/dftwiki3's main # directories to aws s3. The configuration and information about # which S3 bucket is in ~ubuntu/.duply/test/conf 0 4 * * * env HOME=/home/ubuntu duply test backup