How To Install LAMP on Ubuntu 16.04 VPS / Dedicated Server : LAMP Stands for Linux, Apache, MySQL & PHP. So in this tutorial guide we will install LAMP Stack on Ubuntu 16.04 VPS. It is very tough to install LAMP on Ubuntu 16.04 Just follow the simple steps given below to install LAMP on Ubuntu 16.04
• Basic Setup : Before installing LAMP Stack on Ubuntu 16.04 VPS, you need to make root login & do the initial and basic setup in Ubuntu 16.04
How To Install LAMP on Ubuntu 16.04 VPS
So now we are going to install LAMP Stack on Ubuntu 16.04
First we will install Apache Web server on our Ubuntu 16.04 VPS. To install apache on VPS, just run the following command line:
sudo apt-get update sudo apt-get install apache2
This will install apache2 web-server on your Ubuntu 16.04.
Now test you Apache Installation by opening your web browser and navigate to http://your_Server_ip/ in my case this is “http://220.127.116.11/” replace this ip with your server IP
You will get see something like this:
so apache installation done here
Now we will install MySQL on our Ubuntu 16.04 VPS, to install MySQL on our Ubuntu 16.04 VPS run the following command line:
sudo apt-get install mysql-server mysql-client
During installation, you’ll be asked to setup the MySQL “root” user password. So you should enter a secure password and click Ok
So MySQL has now been installed on our Ubuntu 16.04 VPS.
You can verify the MySQL server status by running the following command line:
sudo systemctl status mysql
You will get following output:
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2016-11-08 19:09:23 UTC; 12s ago Main PID: 5566 (mysqld) CGroup: /system.slice/mysql.service └─5566 /usr/sbin/mysqld Nov 08 19:09:21 fknubuntu systemd: Starting MySQL Community Server... Nov 08 19:09:23 fknubuntu systemd: Started MySQL Community Server.
We have installed MySQL on our server, now we will install PHP 7, the PHP Extension and Application Repository, Apache support, and MySQL support on our Ubuntu 16.04 VPS by running the following command:
sudo apt-get update sudo apt-get install php7.0 php-pear libapache2-mod-php7.0 php7.0-mysql
Now Optionally, install additional curl, JSON, and CGI support by running following command:
sudo apt-get install php7.0-curl php7.0-json php7.0-cgi
Test PHP Version by running following command:
sudo php -v
Now create a sample php file “phptest.php” in the Apache root folder
sudo nano /var/www/html/phptest.php
Now Add the following lines:
<?php phpinfo(); ?>
Now you need to restart apache service by running the following command
sudo service apache2 restart
Now open web-browser and type following to test php installation is successful or not
If installation will be successful then you will see something like this:
So you have Successfully installed Apache, MySQL & PHP7 (LAMP Stack) on Ubuntu 16.04. So this tutorial guide was all about “How To Install LAMP on Ubuntu 16.04 VPS / Dedicated Server – Linux, Apache, MySQL, PHP 7 ”. If this article was helpful for you then you can vote & share this article.