The Easiest Way To Setup A LAMP Server

Share This:

In my opinion the easiest way to set up a LAMP server is to use Ubuntu Server. As of this writing Ubuntu Server is currently at version 12.04 LTS (Long Term Support). The ISO is a decent size only 682MB. And the documentations on burning the ISO image to a disk are very easy to follow.

Once you have burned the ISO image to a disk. You place the CD into a computer, restart the computer and boot off of the CD. If you can’t boot off of the CD you may need to adjust your BIOS settings.

Once your running off the CD you will follow the simple instructions. Such as what languange you prefer, what Keyboard you have. And if you don’t know the type of Keyboard you have Ubuntu will walk you threw figuring it out.

Ubuntu is one of the few Linux distros that doesn’t have Root enabled. Instead your forced to use sudo. Which really is okay and has it’s own set of advantages and disadvantages.

Near the end of the Installation it will ask you what type of server you want to setup. Some of the options are listed below.

  • Base System (No Server)
  • LAMP
  • Cloud
  • Samba (File Sharing and Print Server)
  • SSH Server
  • Mail Server
  • Add additional packages (Lets you install other packages from the Ubuntu Repos)

Obviously since your going to be setting up a LAMP server you will choose the LAMP option. You can do this by using your arrow keys. Once LAMP option is highlighted you will press the Spacebar to select it. Then you will press the Tab Key to navigate to the Next button. Then you press the Enter key.

Another thing you will be asked during the installation is how you want to deal with updates. I usually choose Automatic Updates.

Once you have made all of your choices Ubuntu will start to install. Before you know it you will have a LAMP server fully up and running.

Post Installation

Ubuntu Server by defualt uses DHCP for it’s IP addresses. We will want to change this to static. To do this we will first need to know the current IP address that our server is using. We achieve this by typing the following commands.


The above command should display an output similar to the following.

eth0 Link encap:Ethernet HWaddr A1:12:14:3D:17:64
inet addr: Bcast: Mask:
inet6 addr: fe80::216:17ff:fe3c:732/64 Scope:Link
RX packets:207461 errors:0 dropped:426 overruns:0 frame:0
TX packets:75959 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23444927 (22.3 MiB) TX bytes:17017756 (16.2 MiB)
lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:469 errors:0 dropped:0 overruns:0 frame:0
TX packets:469 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:36644 (35.7 KiB) TX bytes:36644 (35.7 KiB)

Here we see that the server is using as it’s IP Address. We also see the Broadcast IP address is and the Gateway is Our Netmask is So what we will need to do is edit the network configuration file. This file is called interfaces and it is stored in the /etc/network directory. So we will edit it using Nano by typing the following commands.

sudo nano /etc/network/interfaces

This will display the contents of the file which look similar to the following.

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

So what we will be changing in the above file is the last line that says iface eth0 inet dhcp and we will change the word dhcp to the word static. This will make the IP address static. However Ubuntu will no longer obtain an IP address itself we will have to tell it what information to use as it’s IP address. To do this we will add the following lines below the iface eth0 inet static.


Please note your configuration may be different depending on the output you got from the ifconfig command you issued earlier.

So the finished file should look similar to the following.

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static

If it looks similar to the above. You can save your changes and exit nano. You can do this by pressing CTRL + X. It will ask you if your sure you want to make these changes. Confirm that you do. And then press Enter twice.

Next we will need to edit a file /etc/resolv.conf file. So we will do this by using our Nano text editor. We will type the following.

sudo nano /etc/resolv.conf

We will edit it to look similar to the following.


Once /etc/resolv.conf looks like the above we can save it by pressing CTRL + X. And confirming that we a sure we want to save the changes. Then we will press Enter twice.

Now we will need to restart our network since we have just made changes to it. To restart our network we will need to type the following commands.

/etc/init.d/networking restart

We will now send a ping to website that we know is up and running to verify that we didn’t mess anything up with our network. To do this we will issue the following commands.

ping -c 4

If the ping works then your all good. I would also recommend removing the DHCP Client. Because this can set the server back to a dynamic IP address. Newer versions of Ubuntu use DHCP3 and older versions use DHCP. So depending on which version of Ubuntu your using we will use one of the following commands.

sudo apt-get remove dhcp-client


sudo apt-get remove dhcp3-client