Most of the websites in the internet are running on LAMP server which is a combination of Linux Apache MySQL and PHP. LAMP servers are very popular and it is easy setup. Let me explain here how to setup a LAMP server with default configuration in Ubuntu 16.04 .
Before we begin, let’s update package lists of Ubuntu 16.04 to the latest by running apt-get update
sudo apt-get update

Video Demonstration:
Please LIKE , COMMENT and SUBSCRIBE .
[do_widget id=custom_html-12]Step1. Install Apache for LAMP in Ubuntu 16.04:
Here is a little background of Apache . Apache is an open-source HTTP server for modern operating systems which is written C. The Apache HTTP Server (“httpd”) was launched in 1995 and it has been the most popular web server on the Internet since April 1996. Apache 2.4 is the latest stable version of Apache. If anybody still using Apache 2.2, it is time to upgrade it as Apache has discontinued all development and patch review of the 2.2.x series of releases.
Let’s install Apache 2.4 :
sudo apt-get install apache2
Give Y to the prompt for confirmation and wait for 2mins.

When It is done, make sure Apache is ‘running’ by executing command.
sudo systemctl status apache2

If Apache is in running state, you would see the Apache default page in the browser when searched with server IP address (http://your-server-ipaddress )

Let’s enable Apache in the boot so that apache start automatically when the system is rebooted
sudo systemctl enable apache2
So you got the apache running fine your Ubuntu 16.04 box, let’s setup php.
Step2. Install PHP for LAMP in Ubuntu 16.04:
Let’s install PHP7 along with few PHP modules and a module which is required to integrate PHP with Apache.
sudo apt-get install php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-cli php7.0-cgi php7.0-gd php7.0-curl php7.0-mbstring php7.0-mcrypt php7.0-xml php7.0-xmlrpc
Give Y to the prompt for confirmation and wait for 2 mins

When it is done, go to /var/www/html (This is the default document root where you store all your website content in order to serve via your website) and create a file info.php with content given below.
<?php phpinfo(); ?>
Now go to http://your_server_ip_address/info.php on the browser and you will see the PHP info page as shown below.

This means that your website is now serving PHP code. If you are a PHP developer, you can put your code here and check it in the browser.
Let’s tell Apache to look for index.php first by making following changes. open /etc/apache2/mods-enabled/dir.conf . Current content should be looking this.
<IfModule mod_dir.c> DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm </IfModule>
Change it to as below
<IfModule mod_dir.c> DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm </IfModule>
And then reload Apache.
sudo systemctl reload apache2
Now we have installed PHP in our Ubuntu 16.04 box. Let’s go for MySQL.
Step3. Install MySQL for LAMP in Ubuntu 16.04:
A database is required when you are building a robust and data driven website. Let’s install MySQL which can be used as a database for your website.
sudo apt-get install mysql-server

Give Y when prompted and also give root password for the database server when asked during installation.
When it is completed, check the status of the MySQL by running following command.
sudo systemctl status mysql

You should see something like this:
Let’s enable MySQL in the boot so that MySQL start automatically when the system is rebooted
sudo systemctl enable mysql
That’s it you have LAMP server up and running in our Ubuntu 16.04 box. Now you can start developing your PHP website or you setup web applications like WordPress, Joomla, Magento.
WordPress installation on a LAMP server is explained here >>
I will be filling this article with a lot useful information soon. Stay tuned by subscribing to the website (Checkout Right Sidebar for the Subscription Form).