April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

LEMP is an acronym for Linux, Nginx (pronounced Engine X), MariaDB / MySQL, and PHP. Centos 8.1

LEMP is a software stack that includes a set of free open source tools that are used to power high traffic and dynamic websites. LEMP is an acronym for Linux, Nginx (pronounced Engine X), MariaDB / MySQL, and PHP.

Nginx is an open source, powerful and high-performance web server that can also double as a reverse proxy. MariaDB is a database system for storing user data, while PHP is a server-side scripting language for developing and supporting dynamic web pages.

Related:

In this article, you will learn how to install a LEMP server on a CentOS 8 Linux distribution.

Step 1: Update the package on CentOS 8

First, update the repository and packages on CentOS 8 Linux by running the following dnf command.

dnf update

Step 2: Install Nginx web server on CentOS 8

After the package update is complete, install Nginx with a simple command.

dnf install nginx

Install Nginx on CentOS 8

The code snippet shows that the installation of Nginx went smoothly without any problems.

After the installation is complete, configure Nginx to start automatically at system startup, and verify that Nginx is running by executing a command.

systemctl enable nginx
systemctl start nginx
systemctl status nginx

nginx -v

Step 3: Install MariaDB on CentOS 8

MariaDB is a free and open source branch of MySQL and provides the latest features that make it a better alternative to MySQL. To install MariaDB, run the command.

dnf install mariadb-server mariadb -y

To make MariaDB start automatically at system startup, run.

systemctl start mariadb
systemctl enable mariadb

The MariaDB database engine is not secure and anyone can log in without credentials. To harden MariaDB and protect it to minimize the chance of unauthorized access, run the command.

mysql_secure_installation

Step 4: Install PHP 7 on CentOS 8

Finally, we will install the last LEMP component, PHP, which is a scripted web programming language that is usually used to develop dynamic web pages.

At the time of writing this guide, the latest version is PHP 7.4. We will install it using the Remi repository. The Remi database is a free database that comes with the latest cutting-edge software version and is not available on CentOS by default.

Run the following command to install the EPEL repository.

dnf install https://dl.Fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm

dnf module list php

CentOS-8 – AppStream
Name Stream Profiles Summary
php 7.2 [d][e] common [d], devel, minimal PHP scripting language
php 7.3 common, devel, minimal PHP scripting language

Remi’s Modular repository for Enterprise Linux 8 – x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language

dnf module reset php

dnf module enable php:remi-7.4

dnf install php php-opcache php-gd php-curl php-mysqlnd

php -v
PHP 7.4.3 (cli) (built: Feb 18 2020 11:53:05) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

systemctl start php-fpm
systemctl enable php-fpm

nano /etc/php-fpm.d/www.conf

user = apache
group = apache

user = nginx
group = nginx

systemctl restart nginx
systemctl restart php-fpm

cd /usr/share/nginx/html/
$echo “” > index.php

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>