Category Archives: Hardware

Prepare a LAMP web development server on Amazon EC2

Here is a quick checklist for setting up LAMP development server on Amazon EC2. I used a standard Amazon Linux AMI on a T2.micro instance, which costs about $9/month at the time of writing this.

  1. Edit the DNS zone for your domain to add an A record for a sub-domain to point to the public IP of the instance. I recommend setting the TTL to 60 for fastest updates of IP later if necessary.
  2. Use putty or ssh to log in to the instance.
  3. Follow the instructions at https://gist.github.com/aronwoost/1105007
  4. Test the server by visiting it on your browser using either the public IP or the url.
  5. Prepare web directory: A useful guide for permissions. The Apache user is “apache”, member of group “apache”.
  6. Prepare HTTPS: for Amazon Linux, this is already set up … but for more info, see http://wiki.centos.org/HowTos/Https
  7. Install Codiad (an online code editor/IDE — this enables you to write your code anywhere rather than being bound to your workstation and your desk):
  8. Browse to servername/edit to set up Codiad. Once done, it’s now ready to use. from that same location.

Tip: need to set up multiple virtual hosts on the server? Amazon Linux is based on CentOS. Here is a step-by-step guide on setting up virtual hosts on CentOS. A similar guide for SSL virtual hosts.

Raspberry PI adventures

I managed finally to have some time to play with the an RPi Model B I received from a friend of mine for experimentation. I prepared all the peripherals as below:

raspberry-pi-preparation

  • An HDMI cable
  • A micro USB 700 mA+ charger (I used my Samsung Galaxy Nexus 1A charger)
  • An Ethernet cable
  • An 8GB class 4 SD card
  • A USB keyboard
  • A USB mouse
  • An LCD TV with HDMI input (not shown above :))

Woo! A long list!

To prepare the OS, I downloaded a Raspbian Wheezy image, a Debian-based distro for RPi. I used Win32DiskImager to dump the image to the SD card. I connected everything, inserted the SD card to the RPi, and powered it on. Within a few moments, I saw a setup screen, where I chose to expand the rootfs to the whole SD card so that it uses all the empty space for storage. I also enabled the SSH server. There was an option to specify the amount of memory reserved for display. I left the default of 64MB for display and 192MB for RAM to run the GUI smoothly, but I’ll probably need to modify this later if I use it as a server.

After that there was a beautiful GUI with some sample applications, including some simple yet enjoyable Python games. The web browser is a basic one and doesn’t run Flash nor HTML5. I didn’t yet try running videos but should do that soon.

I then switched the RPi off, removed all cables except network. Then re-powered it on. I then connected to it via SSH, installed VNC server (via apt-get install tightvncserver). This allowed me to connect remotely to the GUI. I created a script for starting the VNC (~/vnc.sh).

I then tried installing a LAMP stack (apache2, mysql-server-5.5, php5, php5-mysql) .. all installed and worked smoothly. The document root is /var/www.

Next things that I plan to check later:

  • Can Firefox or Chrome be installed for a better web experience?
  • Running videos and checking which formats are supported.
  • Using the RPi as a network storage, possibly implementing some RAID via USB for redundancy.
  • Measuring MySQL performance for a possible dedicated database server (though I guess this won’t work due to the very low RAM that comes with RPi).
  • Installing some Podcast subscription software or so for using it as an internet radio.
  • Trying to connect to the internet via a 3G USB modem.
  • Trying to connect a USB webcam.
  • Trying to connect a USB printer (so the RPi becomes a print server).

Related links to check: