Script to install LAMP (PHP 7) on Debian 9

by Daniel Pham
Published: Updated:

In this article, I will guide you to use the script to install the LAMP on Debian 9. I have successfully tested this script on Debian 9.3 64bit. Just a few lines of code you can install the LAMP stack quickly.

Server resource requirements

Server requirements are as follows:

  • OS: Debian 9.x (in my demo, i use 9.3 Stretch) 64 bit.
  • RAM: over 1GB memory.
  • HDD: Minimum 1-2 GB of free space.
  • IP: static IP, for example:
  • User: root

Script to install LAMP on Debian 9

This script will automatically install the necessary software of the LAMP stack, the software version as follows:

  • Apache 2.4.25
  • MariaDB 10.1.26
  • PHP 7.0.27-0+deb9u1

Steps to use the script to install the LAMP stack are as follows.

Script to install LAMP (PHP 7) on Debian 9
Download the script to install LAMP stack on Debian 9.

Step 1, you download the script from my repository.

wget -O /home/

Step 2, you have to grant permission 700 for this script.

chmod 700 /home/

And the last step, execute the script, noting that the script must be executed by the root user. Script will automatically update, add the necessary repository and install the package.

bash /home/

Depending on the speed of your internet connection, you may have to wait 10 to 15 minutes to complete the installation process.

Read moreScript to install LAMP on Debian 8.

Script to install LAMP (PHP 7) on Debian 9
Finish the installation process.

Check the LAMP stack after installation

Now, you can open the browser up, visit the page http://your_server_ip/info.php. The result like image below.

Script to install LAMP (PHP 7) on Debian 9

To check Apache service, you type the below command.

systemctl status apache2

To check MariaDB service, you type the below command.

systemctl status mysql

And to see PHP version, please type command.

php -v

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