Script to install LAMP (PHP 7) on Ubuntu 16

by Daniel Pham
Published: Updated:

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:
  • 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.

Script to install LAMP (PHP 7) on Ubuntu 16
Using script to install LAMP stack (PHP 7) on Ubuntu 16.

First, you download the script.

wget -O /home/

Next, you grant permission for the script.

chmod 700 /home/

And finally, execute the script using the following command.

bash /home/

Script 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.

Script to install LAMP (PHP 7) on Ubuntu 16
Display PHP informations.

Next, type the following commands to check the status of the services.

To check Apache service, you type the below command.

systemctl status apache2

Check MariaDB service, you type the below command.

systemctl status mysql

To check the version of the installed software, you have the following commands.

Check Apache version.

apache2 -v

To check MariaDB version.

mysql --version

And check PHP version.

php -v

So 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).

0 0 votes
Article Rating

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.