Table of Contents
This article will give you a script to quickly install LEMP stack in Debian 9.
Test environment
The lab environment I use is a Linux machine with the following configuration, you can customize it according to your environment.
- OS: Debian GNU/Linux 9 (stretch) 64 bit.
- IP: 192.168.56.30.
- RAM: 1 GB.
- HDD: 10 GB.
- CPU: 1 vCPU.
- User: root.
LEMP version stack installed
This script will install the LEMP stack in Debian 9 with the following packages.
- Nginx: 1.14.2 Stable.
- MariaDB: Ver 15.1 Distrib 10.3.13-MariaDB.
- PHP: 7.3.3-1+0~20190307202245.32+stretch~1.gbp32ebb2 (cli).
Recommended Reading: Script to install LEMP on Debian 8
Steps to use the script
First, download the script using the command below.
wget https://gitlab.com/Danny_Pham/WriteBash.com/raw/master/Install/10-Script_install_LEMP_PHP_7.3_on_Debian_9.sh -O install_lemp.shNext, you grant the script permission.
chmod 700 install_lemp.shAnd finally, you execute the script to install the LEMP stack.
./install_lemp.shUnlike installing LEMP in Ubuntu 16, when installing on Debian 9, it only requires you to set mysql root password. There is no requirement to select a geographic area …
Recommended Reading: Script to install LEMP stack in Ubuntu 16
Configuring mariadb-server-10.3
-------------------------------
While not mandatory, it is highly recommended that you set a password for the MariaDB administrative "root" user.
If this field is left blank, the password will not be changed.
New password for the MariaDB "root" user:Installation will take about 10 minutes. After installation is complete, type the following commands to check the LEMP stack version.

Check Nginx.
nginx -vCheck MariaDB.
mysql -VAnd check PHP.
php -vConclusion
Simple script but can save you some time. The source code is completely public, so you can view and edit it as you like.
(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).