How To Install LAMP On Ubuntu 12.04

Here is a guide to install LAMP on Ubuntu 12.04. LAMP stands for Linux, Apache, MySQL, php (and/or Perl). When LAMP is installed you have all the needed packages on your system to run a web server on your system.

To install LAMP open a terminal window (press Ctrl+Alt+T) and copy the following line:

sudo apt-get install lamp-server^

During the installation you will be asked to set a password for the root user for MySQL. Enter the password you want to use for MySQL (don’t leave it blank). Enter the same pasword to confirm the used password and wait for the installer to finish installing the packages.

After installing the LAMP packages you need to test it, open your internet browser and enter the following address:


You should get a page with the following text:

It Works!

After testing the Apache web server works, you need to test your php installation. To do that you need to create a file in /var/www called testing.php. To create the file copy+paste the following line in your terminal window:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/testing.php

Go back to your web browser and enter the address http://localhost/testing.php/ and you should see a page displaying information about your php installation.

Now we are going to install phpMyAdmin which is an easy tool to create and/or edit your databases. To install phpMyAdmin copy+paste the following line into your terminal window:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

You will be asked if you want to continue and install the files press y key and then press Enter. In the next step you will be asked to configere phpMyAdmin, it’s not a difficult task all you have to do is to select apache2 and when asked if you want configure the database using the dbconfig-common select OK unless you want to configure the database manually.

In the next step you will be asked to provide the password from the administrative account to create a MySQL database and/or user. Use the same password you created when configuring the MySQL package.

Now you will be asked to create a new password for the database administrative user to connect to your phpmyadmin panel. Fill in a password and repeat it to confirm the password. Now you are done all you have to do now is restart Apache, in your Terminal window copy+paste the following line:

sudo /etc/init.d/apache2 restart

To create a database open your web browser and enter the following url:


Username is root and the password is the password you created to login to phpmyadmin now you can create or change a database.

When LAMP is installed and you want to login to http://localhost/phpmyadmin/ and you get this error message:

Not Found

The requested URL /phpmyadmin/ was not found on this server.
Apache/2.2.17 (Ubuntu) Server at localhost Port 80

Open a terminal window and use the following commands to fix the problem:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
sudo /etc/init.d/apache2 reload

Now you are finished with the installation of LAMP on your system and all there is to do is to download, drupal, joomla or wordpress and extract it to the /var/www/ folder, create a database and connect to the setup/installation page of your chosen cms. To connect to your LAMP server you need to enter:


If you are in a network with more than 1 system and you want to connect to the site you just installed you need to use the ip address of the system you installed LAMP on.

8 Responses to How To Install LAMP On Ubuntu 12.04

Leave a Reply

Your email address will not be published. Required fields are marked *

6 + eleven =