Script to install LEMP stack in Debian 9

by Daniel Pham
Published: Updated:

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.

  1. OS: Debian GNU/Linux 9 (stretch) 64 bit.
  2. IP:
  3. RAM: 1 GB.
  4. HDD: 10 GB.
  5. CPU: 1 vCPU.
  6. 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 -O

Next, you grant the script permission.

chmod 700

And finally, you execute the script to install the LEMP stack.


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

install lemp stack in debian 9
Install LEMP stack in Debian 9.

Check Nginx.

nginx -v

Check MariaDB.

mysql -V

And check PHP.

php -v


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

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.