Here’s a step-by-step guide to installing multiple sites on an Amazon cloud server. This is technology that I use every day at work but I doubt that I could have done it with Amazon’s documentation alone, so thanks to all the sites I visited on my travels to garner the information below, with a special shout out to Ahmed Kamal who saved me endless time by detailing exactly how to get a working server up quickly and easily. Contents of any links are obviously the property of their creators and if anyone really objects to their inclusion let me know, but this post is primarily a collection of notes on how I achieved what I was looking to do. Knowing me I’ll be repeating the process sooner rather than later …
So first off, hop on over to here and come back in about 15 minutes when you’ve established an ssh connection to an Ubuntu server. That was surprisingly easy, wasn’t it?
At this point you should have a working image, a private key and an ssh connection to a terminal. It’s probably also a good idea to have a static IP address (‘elastic’ in Amazon cloud parlance) assigned to the instance, and have that registered with a (free) DNS service forwarding that address to the new server. I used afraid.org, but there’s plenty out there.
Now the fun starts, with installation of the full LAMP stack – Linux, Apache, MySQL and PHP. We’re one down with three to go, but this will soon sort that out:
- sudo tasksel –section server
We don’t want to be entirely trapped on the command line though, so a little bit of phpmyadmin is called for, folow the instructions here:
- https://help.ubuntu.com/community/phpMyAdmin
We know that WordPress will need ftp for updates, so lets put vsftpd in place ready, like this:
- https://help.ubuntu.com/10.10/serverguide/C/ftp-server.html
Create the update user:
- sudo useradd -d /home/updateuser -m updateuser
- sudo passwd updateuser
Assuming that the home directory of all the sites is /home/www, we need to make sure the group owner is www-data:
- sudo chgrp www-data /home/www
Make ‘/home/www’ writable for the group:
- sudo chmod 775 /home/www
and set the GID for www-data for all sub-folders:
- sudo chmod g+s /home/www
‘ls -l’on /home/www should look like this:
- drwxrwsr-x
Last, add the update ftp user username to the www-data (secondary) group:
- sudo useradd -G www-data updateuser
- sudo chgrp -R www-data <home directory>
And a recursive ‘write’ ability:
- sudo chmod 775 -R /home/www
We can now FTP any updates to the site folders.
In summary, we now have:
- Ubuntu
- Multiple sites
- LAMP stack
- phpmyadmin
- vsftpd daemon running with an ftp user having recursive write access to /home/www
That’s probably enough to be going on with, time to put the kettle on I think.