How to spin up Wikimedia with EC2 and Elastic Storage on Amazon AMI instance

image So, recently I spun up a Wikimedia instance on EC2.  More on that soon 🙂  In the meantime, just to leave a record for those also trying:

Spin up an EC2 instance and go to the console.  I spun up the Amazon AMI instance (default)

Use putty to connect (Amazon directions)

When connecting, connect as ec2-user

Follow https://gist.github.com/aronwoost/1105007 to install LAMP

phpmyadmin will then be at domain.com/phpmyadmin

set up

/etc/httpd/conf

to point to the right directory directory

restart apache:

httpd -k restart

Then move stuff over to elastic storage.  I used http://aws.amazon.com/articles/1663, but with some modifications.

Specifically: add elastic instance using the web console (same UI where you manage the EC2 instance)

Then

sudo yum install -y xfsprogs

Then mount:

grep -q xfs /proc/filesystems || sudo modprobe xfssudo mkfs.xfs /dev/sdh echo “/dev/sdh /vol xfs noatime 0 0” | sudo tee -a /etc/fstab sudo mkdir -m 000 /volsudo mount /vol

Then, stop the instance:

sudo /etc/init.d/mysqld stop

This is where a bit different:

sudo mkdir /vol/lib /vol/log

sudo mv /var/lib/mysql /vol/lib/sudo mv /var/log/mysqld.log /vol/log/ sudo mkdir /var/lib/mysql echo “/vol/lib/mysql /var/lib/mysql none bind” | sudo tee -a /etc/fstab sudo mount /var/lib/mysql

Then I modified /etc/my.conf:

log-error=/vol/log/mysqld.log

Spin it back up:

sudo /etc/init.d/mysqld start

And then it seems to be working. Now I just need to set up a backup.

OK, this is where I feel like a complete noob. So there were three different things:

/etc/mysql
/var/lib/mysql
/var/log/mysql

lib I moved, log was redirected, but what the hell happened to etc/mysql? Well, it looks like what happened is that etc is a settings directory.  So basically with both the log file and the settings directory, in this version of mysql there were no directories, but straight files.  So rather than move them, you need to adjust make sure that things are pointed correctly…  at least that’s what it seems like.

Anyway, thanks a lot to Ogan for his help on this.  Much appreciated!

P.S. If you want to get git:

sudo yum install git

And if you want to download stuff, you can use wget.

Leave a comment

Filed under Development, wiki-law.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s