LAMP Server

This is my quick guide for building yourself a LAMP server. If you don't know what a LAMP server is then you don't need to read on as you won't need it! For the sake of clarity though, it is a Linux Apache MySQL PHP/Python Server. My recommendation is to use Ubuntu Server for this as they have a nice option during the install process for "LAMP Server", which is a big help, also I would recommend VirtualBox so that you are running this as a VM, which itself has numerous advantages. Anyway, on with the show....

First download and install Oracle's VirtualBox. This will make sure you can easily correct any mistakes you make and also snapshot your way back to a given point in time as well as duplicate etc. Get this installed but make sure you configure the networking correctly! If you are not sure about this check out Networking in VirtualBox

Second download Ubuntu Server from the Server Download site.

Then you need to install Ubuntu Server into a new Virtual Machine in VirtualBox. During the process there are various options you can select including "DNS Server", "Email Server" etc, make sure you check "LAMP Server". At this point you might be wondering, so if I just check these options what are all the extra steps for? Good question, the answer is that I wanted to make the standard LAMP server work more like my shared hosting server.

  • Start your VirtualBox Unbuntu Server
  • sudo vi /etc/hosts edit /etc/hosts so second line with reads " fully_qualified_domain_name host_name", this fixes Apache complaining about fqdn
  • sudo apt-get update to update your local package library
  • sudo apt-get upgrade to download and install the latest package updates
  • sudo apt-get install ntp this is useful for a VM that gets suspended
  • sudo ntpdate -s forces immediate sync
  • sudo apt-get install vsftpd this will install an FTP server
  • sudo vi /etc/vsftpd.conf then make the following changes:
    uncomment "write_enable=YES"
    uncomment "local_umask=022"
    uncomment "ftpd_banner" and add a suitable comment
  • sudo restart vsftpd
  • sudo apt-get install phpmyadmin (don't use dbconfig-common!)
  • sudo usermod -a -G www-data <username> add your username to the www-data group which Apache runs under
  • sudo chown -R <username>:www-data /var/www
  • sudo apt-get install imagemagick install graphics processing package (optional)
  • sudo apt-get install graphicsmagick install graphics processing package (optional)


I found when suspending a VM and bringing it back that the clock was wrong, even thoug NTP was installed and running. Not exactlt sure what is going on here but sudo /etc/init.d/ntp restart does seem to fix it but that feels like a sledgehammer. The command sudo ntpdate <ntp_server> does work but only if the NTP daemon is stopped. Oh and I need sudo too. There must be a simpler way of doing this as I would like something in my .profile file, although the restart does seem to work.