CentLinux | Learn How to Install CentOS/Rocky Linux Servers

Wednesday, July 10, 2019

How to Install LEPP Stack on CentOS/RHEL 8

Install LEPP Stack on RHEL 8 Server

LEPP Stack is a high performance and robust software service stack, used in large systems where data read and write speeds are crucial. It is a variation of  LAMP stack. In this variation, the Apache web server is replaced by Nginx and MySQL database is replaced by PostgreSQL.

In this article, we are installing LEPP Stack on Red Hat Enterprise Linux (RHEL) 8. We are using following LEPP stack components.

  • L - Red Hat Enterprise Linux (RHEL) 8
  • E - Nginx 1.14 Web Server
  • P - PostgreSQL 10.6 Database Server
  • P - PHP 7.2 Language Support

 

Table of Contents:

Install LEPP Stack on RHEL 8 Server

Environment Specification:

We have provisioned a RHEL 8 minimal installed virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - Red Hat Enterprise Linux (RHEL) 8
  • Hostname - rhel-8-lepp.example.com
  • IP Address - 192.168.116.165/24

A Local YUM/DNF repository is also configured, so we can install required packages without having an active Red Hat subscription.

 

Installing PostgreSQL 10.6 on RHEL 8 Server:

Connect with rhel-8-lepp.example.com using ssh as root user.

PostgreSQL Database Server 10.6 is available in our local AppStream repository. Therefore, we can install it using dnf command.

# dnf install -y postgresql-server

Initialize PostgreSQL database instance with following command.

# postgresql-setup --initdb --unit postgresql
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

Enable and start PostgreSQL service.

# systemctl enable postgresql.service
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service â /usr/lib/systemd/system/postgresql.service.
# systemctl start postgresql.service

Verify version of PostgreSQL database.

Due to security, the execution of PostgreSQL commands by root user is not permitted. Therefore, we have to switch user to postgres user to execute PostgreSQL commands.

# su - postgres
$ postgres --version
postgres (PostgreSQL) 10.6

PostgreSQL has been installed on Red Hat Enterprise Linux (RHEL) 8.

 

Installing Nginx 1.14 on RHEL 8:

Nginx 1.14 is available in local AppStream repository. Therefore, we are installing it using dnf command.

# dnf install -y nginx

Enable and start Nginx service.

# systemctl enable nginx.service
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service â /usr/lib/systemd/system/nginx.service.
# systemctl start nginx.service

Allow HTTP service in Linux firewall.

# firewall-cmd --permanent --add-service=http
success
# firewall-cmd --reload
success

Browse URL http://rhel-8-lepp.example.com in a client's browser.

01-rhel-8-lemp-nginx-default-homepage

Nginx web server has been installed on Red Hat Enterprise Linux (RHEL) 8.

 

Installing PHP 7.2 on RHEL 8:

PHP 7.2 is available in local AppStream repository. Therefore, we can install php and relevant packages using dnf command.

# dnf install -y php php-mysqlnd php-pdo php-gd php-mbstring php-fpm php-pgsql

Edit php-fpm configurations.

# vi /etc/php-fpm.d/www.conf

Find and set following directives therein.

user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx

Adjust permissions on PHP directories.

# chgrp nginx /var/lib/php/{opcache,session,wsdlcache}

Start and enable php-fpm service.

# systemctl enable php-fpm.service
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service â /usr/lib/systemd/system/php-fpm.service.
# systemctl start php-fpm.service

Restart httpd.service to integrate PHP with Nginx web server.

# systemctl restart nginx.service

Create a PHP script to check PHP modules.

# echo "<?php phpinfo() ?>" > /usr/share/nginx/html/info.php

Browse URL http://rhel-8-lemp.example.com/info.php in a client's browser.

02-rhel-8-lepp-phpinfo

PHP 7.2 has been installed and running on Red Hat Enterprise Linux (RHEL) 8.

We have successfully installed LEPP stack on RHEL 8 server.

If you find this article useful? Consider supporting us by Buy Me A Coffee


2 comments:

  1. Notice that you don't have to change www.conf, keept it running on "apache" is perfectly fine, default configuration is designed to work out if the box with Apache or Nginx.

    Additional package (e.g. in EPEL, such as phpMyAdmin, Wordpress, ...) will rely on this settings

    More, if you change default user, you also need to change used state directory (see php_value directive at the end of the www.conf file).

    ReplyDelete

© 2023 CentLinux. All Rights Reserved.