LAMP stands for Linux, Apache, PHP and MySQL . It is actually a set of open source software packages which allows us to run dynamic web pages using PHP. In this post , we’ll learn how to set up LAMP on local ubuntu machine.

First open the terminal and run the following command

sudo apt-get update
sudo apt-get install apache2 mysql-server php libapache2-mod-php php-mcrypt php-mysql curl phpmyadmin php-mbstring php-gettext
sudo a2enmod mcrypt mbstring rewrite

You can simply copy paste the code to avoid any error. You can go with the default settings for the installation.

Open apache2.conf file in Gedit using the following command

sudo -H gedit /etc/apache2/apache2.conf

Add following line to the end of the apache2.conf file

Include /etc/phpmyadmin/apache.conf

and update

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>

to

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride all
	Require all granted
</Directory>

Now , run the following command

sudo chown $USER /var/www/html
sudo chmod 755 -R /var/www/html
sudo systemctl restart apache2

Now open http://localhost/ on your browser. You will see a page like this.

Apache default page

We have successfully installed LAMP on Ubuntu. If you faced any problem , feel free to comment below.