Table of Contents
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: 192.168.56.31
- 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.

Step 1, you download the script from my repository.
wget https://gitlab.com/Danny_Pham/WriteBash.com/raw/master/Install/03-Script_install_LAMP_PHP_7.0_on_Debian_9.sh -O /home/install.shStep 2, you have to grant permission 700 for this script.
chmod 700 /home/install.shAnd 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/install.shDepending on the speed of your internet connection, you may have to wait 10 to 15 minutes to complete the installation process.
Read more: Script to install LAMP on Debian 8.

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.

To check Apache service, you type the below command.
systemctl status apache2To check MariaDB service, you type the below command.
systemctl status mysqlAnd 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).