How to Install LAMP in Ubuntu 12.04 the fastest and simplest way

How to install LAMP server in Ubuntu 12.04 or older version using a few command lines.

Install LAMP in Ubuntu 12.04

LAMP is an open source Web development platform which is widely used on VPS and other server setups. LAMP (Linux, Apache, MySQL and PHP) uses Linux as operating system, Apache as the web service and MySQL as the database management system and PHP as the server-side scripting language which is widely used in web development. UbuntuLife.net is also hosted on LAMP server environment with additional scripts for speed and security.

Originally these four programs were not designed to work specifically with each other, but these tools were developed in close conjunction. LAMP has become popular because it is free, open-source, and easily customizable and because it integrates well with most current Linux distributions including Ubuntu 12.04.

While I was studying in the university we had to set up LAMP server software by software to understand how it works but I will show you the fastest way how to install LAMP server on Ubuntu 12.04.

This tutorial is tested on Ubuntu 10.04, 10.10, 11.04, 11.10, 12.04 and 12.10 and probably other Ubuntu versions as well but I would recommend using Ubuntu 10.04 or later version to install LAMP server.

Open terminal and type the fallowing command:

sudo apt-get install tasksel

One this installation is complete type the following command:

sudo  tasksel

And navigate with keyboard arrow keys and select “LAMP server” from the list using “space bar” and then hit “Enter”. See below

lamp in ubuntu 12.04

During the installation you will be asked to create a new MySQL root password. For security reasons, don’t use your Ubuntu password.

MySQL root password

Now you have Apache, MySQL and PHP installed on your Ubuntu 12.04 to make sure if Apache is working correctly open your web browser and type “localhost” in the address bar and hit enter. You will see a following message:

Apache installation in Ubuntu

I already modified index.html to show different method. index.html is located in /var/www/ folder of your system.

Testing LAMP installation

To make sure if PHP works you can create a create a tiny PHP file as described bellow:

Open terminal and type in the fallowing command:

sudo gedit /var/www/info.php

and write the fallowing code and hit save and exit:

<?php
phpinfo();
?>

info.php in ubuntu

Restart Apache server to apply the changes by using the fallowing command:

sudo service apache2 restart

Now open web browser and type:

localhost/info.php

And if PHP is installed properly you will see the page that looks like this

PHP in ubuntu 12.04

Now you have LAMP server installed on Ubuntu 12.04 but for better database management I would recommend to install phpMyAdmin. It will allow to configure you MySQL databases via simple graphical interface.

How to install phpMyAdmin in Ubuntu 12.04

Open the terminal if it’s not open already and type the following command:

sudo apt-get install phpmyadmin

You will be prompted with a screen like you can see bellow asking to select web server to configure to run phpMyAdmin. Choose “apache2” by pressing “space bar” and then hit Enter.

Install phpMyAdmin in Ubuntu 12.04

When the process is completed you can now open your web browser and type “localhost/phpmyadmin” in the address bar. You should see phpMyAdmin login screen. Use username “root” and password you chose during phpMyAdmin installation.

Install phpmyadmin in ubuntu 12.04

Now you have fully functional LAMP server + phpMyAdmin for better and easier management of MySQL database.

Let me know if you have any problems during installation and I will try to help.

, , , , , , , , , ,

7 Responses to How to Install LAMP in Ubuntu 12.04 the fastest and simplest way

  1. Prabu Siabuabu September 8, 2012 at 4:01 pm #

    hi, thx for ur tutorial.. and i want to ask something to u, i got some problem when installing phpmyadmin in my ubuntu 12.04.. this is the image http://i1193.photobucket.com/albums/aa344/hiatus1/Workspace1_001.png

    what should i do dude?? i hope u’ll quickly reply my comment, ty very much.

  2. Prabu Siabuabu September 8, 2012 at 4:01 pm #

    hi, thx for ur tutorial.. and i want to ask something to u, i got some problem when installing phpmyadmin in my ubuntu 12.04.. this is the image http://i1193.photobucket.com/albums/aa344/hiatus1/Workspace1_001.png

    what should i do dude?? i hope u’ll quickly reply my comment, ty very much.

  3. Prabu Siabuabu September 8, 2012 at 4:01 pm #

    hi, thx for ur tutorial.. and i want to ask something to u, i got some problem when installing phpmyadmin in my ubuntu 12.04.. this is the image http://i1193.photobucket.com/albums/aa344/hiatus1/Workspace1_001.png

    what should i do dude?? i hope u’ll quickly reply my comment, ty very much.

  4. Prabu Siabuabu September 8, 2012 at 4:01 pm #

    hi, thx for ur tutorial.. and i want to ask something to u, i got some problem when installing phpmyadmin in my ubuntu 12.04.. this is the image http://i1193.photobucket.com/albums/aa344/hiatus1/Workspace1_001.png

    what should i do dude?? i hope u’ll quickly reply my comment, ty very much.

    • James September 10, 2012 at 8:48 am #

      Hi,
      Sorry for late answer!
      You don’t have phpmyadmini installed properly. Make sure you have LAMP up and running before you proceed with phpmyadmin.

      If LAMP server is working try to reboot it before testing phpmyadmin

    • James September 10, 2012 at 8:48 am #

      Hi,
      Sorry for late answer!
      You don’t have phpmyadmini installed properly. Make sure you have LAMP up and running before you proceed with phpmyadmin.

      If LAMP server is working try to reboot it before testing phpmyadmin

  5. GetJef March 27, 2014 at 3:10 pm #

    Beautiful tutorial, excellent step-by-step explanations. I’m running Ubuntu 12.04 and installed LAMP easily. Thank you VERY much! =)

Leave a Reply

Powered by WordPress. Designed by Woo Themes