Script to install LAMP (PHP 7) on Debian 8

by Daniel Pham
Published: Updated:

Today, I will introduce to you about the script to install LAMP (PHP 7) on Debian 8. The script will automatically install all the necessary packages for you. With just a few simple steps, you can have a fast LAMP server stack.

Server resource requirements

Server requirements are as follows:

  • OS: Debian 8.x (in my demo, i use 8.10) 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 8

About the script: script to install the LAMP stack on Debian 8 automatically.

Version of the package will install:

  • Apache 2.4.10
  • MariaDB 10.0.32
  • PHP 7.0.28-1~dotdeb+8.1

As for the PHP 7 installation package, I use the dotdeb repository, which is not an official repository. You may need to mention whether or not to use it, it all depends on you.

Step 1, you have to download the script that I uploaded to the public repository on Git.

wget -O /home/

Step 2, you move to /home directory and grant permission 700 to this script.

cd /home
chmod 700

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.


After about 10-15 minutes, depending on the status of your internet and server resources. When the installation is finished, if you receive a message like the image below, it means that the installation was successful without any errors.

Script to install LAMP (PHP 7) on Debian 8
Image finishes installation of LAMP stack.

Check the operation of the LAMP stack

To check whether the software package is fully installed and running, use the commands below.

1. Check service Apache2.

systemctl status apache2

2. Check service MySQL.

systemctl status mysql

3. Check PHP version.

php -v
Script to install LAMP (PHP 7) on Debian 8
Access info.php page to view information about PHP.

Or you can access the info.php link in the image above for more information on the current version, module, and configuration of PHP.

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