LAMP is short name of Linux, Apache, MySQL and Php. Firstly we are starting with install Apache on Ubuntu Terminal.


sudo apt-get install apache2

It will install Apache web server on your computer. After installation you can test it by trying to go to http://localhost/ on your browser. You will show web page that include It works! text. Its default configuration, your root directory is /var/www/. You should get ownership this directory to work without problem. You can run code below on Ubuntu Terminal to take ownership of it.

sudo chown username:username -R /var/www/

After complete these stage we will continue with installation of php. We run code below on Ubuntu Terminal

sudo apt-get install php5

It will install Php on your computer. After installation you can test by trying to go to any php file that you created on /var/www/ directory.

The next installation is MySQL server installation and Php driver of it. We run code below on Ubuntu Terminal. On installation process, it will ask you root password of MySQL server. You should note password that you enter there to use then.

sudo apt-get install mysql-server
sudo apt-get install php5-mysql

After these stage we will be completed installation of LAMP. You maybe need phpMyAdmin to manage your MySQL. You can download phpMyAdmin script from http://www.phpmyadmin.net/

You should extract it to /var/www/ directory. It requires mcrypt extension to work. You can install by runing code below on Ubuntu terminal

sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt

Don’t forget to restart apache server after install some extension by runing on Ubuntu Terminal.

sudo service apache2 restart