Table of Contents
Today, I will show you how to use the script to install LAMP (PHP 7) on Ubuntu 16. Installing LAMP stack on Ubuntu is pretty much used, this script will save you time. Installed quickly and successfully tested.
Server resource requirements
Server requirements are as follows:
- OS: Ubuntu 16.04.4 LTS 64bit.
- RAM: over 1GB memory.
- HDD: Minimum 1-2 GB of free space.
- IP: static IP, for example: 192.168.56.20
- User: root
Script to install LAMP on Ubuntu 16
Script will install the package in the LAMP stack as follows:
- Apache 2.4.18
- MariaDB 10.0.34
- PHP 7.0.25-0ubuntu0.16.04.1
The packages installed in this script are loaded from the official Ubuntu repository, without using any external repositories. You install the LAMP stack according to the following steps.

First, you download the script.
wget https://gitlab.com/Danny_Pham/WriteBash.com/raw/master/Install/04-Script_install_LAMP_PHP_7.0_on_Ubuntu_16.sh -O /home/install.shNext, you grant permission for the script.
chmod 700 /home/install.shAnd finally, execute the script using the following command.
bash /home/install.shScript will install in about 15 minutes, you can stand up to take a cup of coffee and come back.
Check the operation of LAMP
You can now open the browser and go to the page info.php for informations about PHP.

Next, type the following commands to check the status of the services.
To check Apache service, you type the below command.
systemctl status apache2Check MariaDB service, you type the below command.
systemctl status mysqlTo check the version of the installed software, you have the following commands.
Check Apache version.
apache2 -vTo check MariaDB version.
mysql --versionAnd check PHP version.
php -vSo you have successfully installed LAMP stack on Ubuntu 16 quickly, now you can set up virtualhost for your website.
(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).