AWS Amazon Linux 2 MediaWiki
Revision as of 09:35, 18 October 2018 by Michael.mast (talk | contribs)
Purpose
Migrate an old media wiki installation to Amazon Linux 2 on AWS.
What I wanted to accomplish was to move an internal wiki install from VMware esxi to AWS. This is to be made available from the internet the local LAN, but with ACLs on the internet facing side because of obvious reasons. Still thinking how I want to handle this...
Pre-configure Instance
This is a lightly used site, so I am using a the t2.medium instance type.
sudo yum update -y sudo amazon-linux-extras install lamp-mariadb10.2-php7.2 sudo yum -y install mod_ssl php-gd php-xml php-mbstring mariadb-server sudo rm -f /etc/httpd/conf.d/welcome.conf sudo sed -i 's/expose_php\ =\ On/expose_php\ =\ off/; s/upload_max_filesize\ =\ 2M/upload_max_filesize\ =\ 128M/; s/post_max_size\ =\ 8M/post_max_size\ =\ 64M/; s/max_execution_time\ =\ 30/max_execuion_time\ =\ 180/' /etc/php.ini
- Setup the database
sudo mysql_secure_installation Set root password? [Y/n] Y New password: Re-enter new password: Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y mysql -uroot -p
Migration
This is assuming you have made a backup of the database and the files.
Database
First I replicated the database settings from the existing installation.
create database wikidatabase; grant all privileges to wikidatabase.* to 'wiki'@'localhost' identified by 'password'; flush privileges; exit;
At this point I can import the database dump from the old system.
mysql -uroot -p wikidatabase < wiki.sql
Then verify that the import looks right.
mysql -uwiki -p wikidatabase MariaDB [wikidatabase]> show tables; +------------------------+ | Tables_in_wikidatabase | +------------------------+ | archive | | bot_passwords | | category | | categorylinks | | change_tag | | comment | | externallinks | | filearchive | | image | | image_comment_temp | | imagelinks | | interwiki | | ip_changes | | ipblocks | | iwlinks | | job | | l10n_cache | | langlinks | | log_search | | logging | | module_deps | | objectcache | | oldimage | | page | | page_props | | page_restrictions | | pagelinks | | protected_titles | | querycache | | querycache_info | | querycachetwo | | recentchanges | | redirect | | revision | | revision_comment_temp | | searchindex | | site_identifiers | | site_stats | | sites | | tag_summary | | templatelinks | | text | | transcache | | updatelog | | uploadstash | | user | | user_former_groups | | user_groups | | user_newtalk | | user_properties | | valid_tag | | watchlist | +------------------------+ 52 rows in set (0.00 sec)
Restore Files
Now we restore the files.
tar -xf wikibackup sudo cp -R var/www/html/wiki /var/www/html/wiki sudo chown -R apache:apache /var/www/html/wiki