Moved

A couple of weeks ago I moved this blog from its old home on a Windows-based virtual server at EasyCGI to a dedicated Linux server running as a “micro instance” on the Amazon Web Services (AWS) platform. Herein some notes on the move.

Overall I’m pretty happy with the move. The EasyCGI hosting was cheap but painfully slow and seemingly getting slower. Although I have no illusions that many people read this blog (although it does get some incoming traffic from Google) I do object to paying for a poor service.  I also needed an excuse to play with AWS.

Since I have never used AWS before, and haven’t used Unix in any significant way for about fifteen years, I needed some help. I started with this tutorial [1]; which is a good idiot’s guide to signing-up for AWS, creating an EC2 micro instance, and installing WordPress and its dependencies. The article is a year old, though, and is out of date in several respects. The most important is that AWS no longer provides Fedora-based machine images. They do offer something called Amazon Linux, which did the job for me. There are some minor differences between this and the tutorial, but noting serious.

Signing up for AWS was as smooth as I expected – kind of like an extended Amazon checkout process.

After I had an instance built and launched, the first problem I encountered was that the default Amazon Linux EC2 image does not allow root user login. This is explained here [2]. The effect of this is that you login as “ec2-user” and is you want to use any privileged commands then you have to use the sudo command. At this point I discovered this [3] tutorial, which is a bit more up to date. Despite the title it is not specific to Apple Macs.

Installing Apache and MySQL was easy: just a few simple ‘sudo yum install’ commands. I still carry the scars of installing software in SunOS and Solaris back in the early nineties (only if you have to, plenty of coffee, allow a whole day), and this yum stuff impressed me a lot. (Must take a look at NuGet when I have the time). You can’t install phpMyAdmin using yum because its not in Amazon’s yum repository, but the tutorial [3] explains how to do this. There’s also an informative SuperUser Q&A about it here [4].

I installed a fresh copy of WordPress as described in the tutorials, then copied over the various config files and a database backup from my old site to the new one (via http using wget). No surprises there, but there are some instructions here [5] that might be useful (or at least reassuring). Make sure you have backups! Since I had installed WordPress in a subdirectory below /var/www/html I had to put a php redirection script in that directory. There is an example of how to do this here [6]. I found this [7] cheat-sheet useful throughout when driving the vim text editor.

Finally, I assigned a public “elastic IP address” to the instance and changed the DNS for the andrewjohnson.me.uk domain to point to it.

And that’s it really. It didn’t take long, I enjoyed it, and I learned some things. My thanks to those who took the time to write the various tutorials – it would have been much harder without them.

 

[1] http://www.2bit-coder.com/2010/9/wordpress-in-the-cloud-amazon-ec2

[2] http://imperialwicket.com/aws-default-root-password

[3] http://calebogden.com/wordpress-on-linux-in-the-amazon-cloud-with-mac/

[4] http://superuser.com/questions/291230/how-to-install-phpmyadmin-on-linux-ec2-instance

[5] http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_to_a_New_Server

[6] http://php.about.com/od/learnphp/ht/phpredirection.htm

[7] http://www.cs.colostate.edu/helpdocs/vi.html