Script to install LEMP stack in Debian 9

Share this post to your friends !

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

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 …

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.

script-to-install-lemp-stack-in-debian-9 Script to 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.

If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.

Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

single post bottom banner
«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.