Ubuntu LAMP Step-by-Step
We recently published a new guide to setting up Ubuntu Server for WordPress development. The article below offers a simpler approach for non-WordPress development, but some of the information is out of date.
As a web developer, we need a server on our LAN to test our work before we put it online. Testing on a standalone machine is both more realistic and less intrusive than running a web server on one of our work computers. Until recently our testing server was running OpenSolaris 2009.06, but Oracle has pulled the plug on OpenSolaris. I decided to take a look at Ubuntu Linux and found setup to be straightforward. Using Ubuntu 10.04.1 Lucid Lynx, a lot of the work has been done for you, with just a couple of gotchas along the way.
You will be required to choose passwords at various points during this procedure. Since our server will live behind a firewall on our LAN and is only for testing purposes, I used the same password throughout for simplicity. This is not recommended for a server that will see live deployment.
Click on any of the images in this article to zoom in.
- Download the 32-bit or 64-bit disk image, depending on your hardware, and burn it to a CD. Our server is an old Dell Dimension 3000 so we’re running the 32-bit release.
- Boot your server from the CD. Select your language, then choose the first menu option, “Install Ubuntu Server”.
- Proceed through the installation until you reach this screen:
- Select “LAMP server” to install the Linux Apache/MySQL/PHP combo. I also selected “OpenSSH server” so I could administer the server from anywhere on our LAN, without having to walk up to the machine.
- When the installation is complete the server will reboot. Login and make a note of the IP address assigned to the machine. This is the address you’ll use for transferring files using FTP, testing websites, and remote admin (if you installed OpenSSH).
- Execute the following command to install phpMyAdmin, for easy management of your MySQL databases:
sudo apt-get install phpmyadmin - At this screen select apache2:
- At this screen select “Yes”:
- When the phpMyAdmin installation is done, complete the following four steps to stop phpMyAdmin from complaining that “The additional features for working with linked tables have been deactivated…”
- Execute the following command:
sudo nano /etc/phpmyadmin/config.inc.php - Scroll down until you see this:
- Add the following line:
$cfg[‘Servers’][$i][‘tracking’] = ‘pma_tracking’; - Press Control-o to save the file, Enter to confirm the filename, then Control-x to quit the editor.
- Complete the following three steps to stop apache2 from complaining that it “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName”.
- Execute the following command:
sudo nano /etc/apache2/conf.d/fqdn - Enter the following text:
ServerName localhost - Press Control-o to save the file, Enter to confirm the filename, then Control-x to quit the editor.
- To install an FTP server for file transfer using DreamWeaver or similar, execute the following command:
sudo apt-get install vsftpd - Enter the following command to edit the vsftpd configuration file:
sudo nano /etc/vsftpd.conf - Scroll down until you see this:
- Uncomment the write_enable and local_umask lines to look like this:
- Press Control-o to save the file, Enter to confirm the filename, then Control-x to quit the editor.
- Take ownership of the web hosting directory by entering the following command (replacing <your user name> with the user name you created during the Ubuntu installation):
sudo chown <your user name> /var/www - Restart your server by entering the following command:
sudo reboot - Test your web server by entering the IP address you noted earlier into your browser. If it’s working you will see a message like this:
- Test phpMyAdmin by appending “/phpmyadmin” to the IP address.
- If you’re in an environment that supports Bonjour (aka Zeroconf), e.g. if you’re running Mac OS, execute the following command:
sudo apt-get install avahi-daemon - Now you will be able to access your testing server by name instead of IP address. Just append “.local” to the name that you gave your server during installation (“ubuntu” by default).
If you find this guide useful I’d love to hear from you.
Excellent guide! I've recently setup a LAMP server on Ubuntu 10.10 via VMware running on an XP host (boooo I know.) It's working wonderfully so far! Thank you!