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.

 

 

Well, the first three builds were certainly educational. The initial OS install is straightforward enough if you follow Ahmed Kamal’s excellent blog post here, saving me the trouble of all those screenshots. Make sure you check out the comments first though for advice about which image to use. We need a web server so Apache it is, but what about SQL, and PHP? No problem, LAMP stack here we come. And phpmyadmin to add a bit if gui friendliness.

So next it’s WordPress, but hang on – that uses ftp to update and install plugins and there’s no ftp server by default. No problem, vsftpd it is. But now we need an ftp user which is locked in its user directory so we don’t have access to where the web sites live. Chmod, chown, I’m losing track of all the tweaks I’ve made to hack the thing together. WordPress still won’t update and I have no idea whether the changes I’m making as possibilities occur to me are helping or making things worse. And I can’t install a plugin to fix this either …

Drupal won’t install properly either. There comes a time when it’s best to stop digging, and that time is now. A deep breath, a little bit of planning and next time – we’ll do it properly.

Exciting, isn’t it?

Some time ago Amazon released their ‘cloud‘ environment to enable people – normally businesses – to spin up virtual instances of servers on the fly to do with what they will. This is very tempting for all sorts of reasons that I won’t go in to now, but what’s not to like about a full internet facing server with full root access via ssh? The main cause for reticence was the surreal pricing model (per instance per hour, per volume data transfer between clouds …) that meant that there was no real way of predicting the cost,  but when they announced a free micro instance for one year I was weak and signed up straight away. Of course it was primarily to play, but a medium term goal would be to host various domains I seem to have hanging around in a secure, consistent manner. A pencilled in shopping list was:

  • Linux OS, probably Ubuntu
  • Apache web server
  • Multiple sites
  • MySQL
  • At least one WordPress blog
  • Other sites I’m kind enough to host
  • Some other CMS – Drupal, maybe?

And whatever else came along.

How hard could it be?

Oh dear.


  • Almost human after moving house while proper fevered. Staring at boxes hoping I’m not the one that will have to unpack them. Except the beer #
  • Jesus Christ Superstar on TV at Christmas? I can see where they’re coming from but they didn’t think if through, did they? #
  • Christmas wrapping finished for another year. Goodnight. #
  • Merry Christmas, all. #
  • Soon to embark on the annual Playmobil build. I may be some time … #
  • Bugger. Just ran out of hdmi connections on the TV. #
  • Asda pizza department – officially slower than Burger King. #
  • Just seeing if my Twitter password's OK. #
  • Yes, it is. #
  • Taken possession of and therefore cleaning the new house. It was clearly vacated by men. #
  • Just met Santa in the toilet. That seems very wrong. #



Those fucking packing fairies are hardly living up to their reputation.


I could forgive CiF, but really …


© 2012 moorjoy Suffusion theme by Sayontan Sinha