A LEMP Stack is a collection of applications that, when installed on the same machine, allow your server to host web applications, dynamic websites and more. The term LEMP is an acronym:
Nginx (pronounced “engine-x” — hence the E)
The difference between a LEMP Stack and a LAMP Stack is in the web server used. In a LEMP Stack, you install Nginx. In a LAMP Stack, that application is replaced by Apache. Although the installation of a LEMP Stack itself is relatively straightforward, we still recommend that only advanced users tackle the task. This process requires the installation of several different pieces of software that can all be added via the command line, and the stack itself should be up and running in around 15 minutes.
In order to install perform this task, you’ll need an active Linux server, as well as an SSH client such as PuTTY (for Windows) or Terminal (Mac). We recommend a GoDaddy Virtual Private Server if you’re just getting started, or a full dedicated server if you’re ready to take total control.
Installing a LEMP Stack on CentOS7
For the LEMP Stack to work properly, all software must be installed in the following order.
1. Install Nginx.
Because the Nginx web server is not a part of the standard CentOS repository, you’ll have to execute the following command to add it. This also will ensure that you have access to the latest version:
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
Once you've installed the repository, you can complete the installation of Nginx itself with the following command:
sudo yum install nginx
2. Install the database.
The database component of a LEMP Stack allows you to access and organize the databases that will be stored on your server. To download and install all packages necessary to operate with MariaDB, execute the following command:
sudo yum install mariadb-server mariadb
3. Install PHP
The PHP component of a LEMP Stack is arguably the most important, as it allows for both the processing of code and the display of dynamic content. Run the following three commands in order to download both the core PHP functionality, along with additional packages that will help PHP communicate with the other components in the LEMP Stack:
sudo yum install php
sudo yum install php-mysql
sudo yum install php-fpm
Once PHP has been installed on your system, the LEMP Stack will be available. You now have the ability to install virtually any type of software or content that you need on your system to take advantage of it.