Install LAMP on an Ubuntu Server Quickly and Easily

LAMP is a software stack for servers that refers to Linux Apache MySQL and PHP. It is still one of the most common configurations for servers and web applications, and it is very easy to install on Ubuntu servers. Simply follow these instructions:

The first part of LAMP, namely Linux, should already be installed, so your first step is to install tasksel, a program that provides a base for easy software setup.

$ sudo apt-get install tasksel

Next, all you have to do is tell tasksel to install LAMP:

$ sudo tasksel install lamp-server

That is all it takes. You may get prompted with a couple of questions, such as if you want to create a MySQL password, which you should definitely do, but you will not need to install any items separately to have a working LAMP stack.

You should now test to make sure Apache is up and running. Open a web browser and point it to your domain or ip address, or if you are on the local machine, go to http://localhost.

You should also test PHP. An easy way is to create a phpinfo.php file with this code:


// Show all information, defaults to INFO_ALL



Save it to your /var/www directory and then access it from your web browser (http://ipaddress/phpinfo.php)

It should display complete PHP information about your server. For more information about LAMP on Ubuntu, see the Ubuntu wiki.