Home » Ubuntu » Install LAMP – Apache, PHP, Mysql on Ubuntu 12.04

Install LAMP – Apache, PHP, Mysql on Ubuntu 12.04

The LAMP stands for Linux, Apache, Mysql, PHP or Pearl etc.. Installing the LAMP Server in Ubuntu 12.04 is very easy now. Just run one or two commands on sudo mode will solve the problem. With PHP you probably need some additional packages to manage your web applicaiton. Some libraries like mcrypt, mbstring, gd, imagemagic,curl etc..

Install LAMP on Ubuntu 12.04

For install LAMP on Ubuntu 12.04 you need a command line application called tasksel. It is an integrated installer in Denian and it works on Ubuntu Linux too. Tasksel groups some packages by tasks and offers the user an easy way to install the packages for that task. It provides the same functionality as using conventional meta-packages.

The following command will work on almost all ubuntu versions from 10.04

Open the terminal -> Press Ctrl+Alt+T

Install tasksel in Ubuntu 12.04

sudo apt-get install tasksel

Now just start tasksel

sudo tasksel

It will come with a software installer selector. Just select LAMP Server then press enter to install the whole package. During the installation the root password of Mysql will be asked.

After the installation just restart the apache server

sudo /etc/init.d/apache2 restart

Then open your browser and go to http://localhost

Apache server will great you with It works

Then test the PHP installation and its components. Create a file in /var/www like info.php

 sudo gedit  /var /www /info.php

then call the info function in PHP for get the server information.


Now Just call the file in your web browser using the url : http://localhost/info.php. You will get the complete information of your current php installation.

Install PHPMyAdmin in Ubuntu 12.04

To Manage Mysql database you need a tool like phpmyadmin. You can manage the database from the command line but PhpMyadmin will help you to manage the database very effectively.

sudo apt-get install phpmyadmin

At the end of installation to verify that type functions from phpMyAdmin browser:


and enter as user “root” and the password that you entered for MySql during the installation process.


Chive is also another great programme to manage mysql database from a web browser. This is project is developed using YII PHP frame work. You can download chive from their website.

To install chive on ubuntu 12.04 just extract the zip file and copy the directory chive to /var/www . and then you can access chive mysql manager from web browser http://localhost/chive

You can also use libreoffice base to access and edit mysql database. There is a mysql query builder and entity relation manger in libreoffice base.

Install PHP Modules in Ubuntu 12.04

The following are not essential but they are things I almost always need as part of a LAMP install so I have included instructions on installing them.

sudo apt-get install php5-curl

Mod rewrite:

sudo a2enmod rewrite

GD2 Graphics Lib:

sudo apt-get install php5-gd

MB strng

sudo apt-get install php5-mbstring


sudo apt-get install php5-mcrypt

For more modules and step by step installation of Apache, Mysql, PHP independently just go to the other tutorial for Ubuntu 11.10. Most of the commands are the same in the ubuntu 12.04 itself

In Ubuntu 12.04 just apt-get lamp will not work.

Install PHP IDE Geany in Ubuntu 12.04

For developing PHP application you need a good IDE. Geany is a light weight fast ide developed using GTK library. You can install geany by using the command:

sudo apt-get install geany

There are other IDEs like PHP Eclipse, Komodo Edit, Netbeans, gPhpedit, bluefish etc for editing and developing php applications.

Also there are lot of php frameworks available for developing great applications in php like Codeigniter, Cake PHP, Fuel PHP, Kohana, Yii, Zend Framework, Symphony etc… You can try one.

php apache mysql phpmyadmin localhost is the development platform for php applications in ubuntu 12.04

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.