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
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.
sudo vi /etc/hostsedit /etc/hosts so second line with 127.0.1.1 reads "127.0.1.1 fully_qualified_domain_name host_name", this fixes Apache complaining about fqdn
sudo apt-get updateto update your local package library
sudo apt-get upgradeto download and install the latest package updates
sudo apt-get install ntpthis is useful for a VM that gets suspended
sudo ntpdate -s ntp.ubuntu.comforces immediate sync
sudo apt-get install vsftpdthis will install an FTP server
sudo vi /etc/vsftpd.confthen make the following changes:
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 imagemagickinstall graphics processing package (optional)
sudo apt-get install graphicsmagickinstall 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.