How to install LEPP Stack on RHEL 8

Share on Social Media

In this guide, you will learn, how to install LEPP Stack on CentOS 8 or other Redhat based Linux OS. #centlinux #linux #nginx #postgres #php

What is LEPP Stack? :

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 will install LEPP Stack on 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

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 repository is also configured, so we can install required packages without having an active Red Hat subscription.

Install PostgreSQL on RHEL 8:

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.

Install Nginx 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.

Nginx Default Homepage

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

Install PHP 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.

PHPInfo Page

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

Conclusion:

In this guide, you have learned, how to install LEPP Stack on RHEL 8.