Install LEPP Stack on RHEL 8 Server

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

 

This Article Provides:

     

    Environment Specification:

    We have provisioned a RHEL 8 based 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.

    [root@rhel-8-lepp ~]# dnf install -y postgresql-server
    Updating Subscription Management repositories.
    Unable to read consumer identity
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    Last metadata expiration check: 0:18:49 ago on Sun 07 Jul 2019 09:57:50 PM PKT.
    Dependencies resolved.
    ================================================================================
    Package Arch Version Repository Size
    ================================================================================
    Installing:
    postgresql-server
    x86_64 10.6-1.module+el8+2469+5ecd5aae localyum_AppStream 5.1 M
    Installing dependencies:
    libpq x86_64 10.5-1.el8 localyum_AppStream 188 k
    postgresql x86_64 10.6-1.module+el8+2469+5ecd5aae localyum_AppStream 1.5 M
    Enabling module streams:
    postgresql 10

    Transaction Summary
    ================================================================================
    Install 3 Packages

    Total size: 6.7 M
    Installed size: 27 M
    Downloading Packages:
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
    Preparing : 1/1
    Installing : libpq-10.5-1.el8.x86_64 1/3
    Installing : postgresql-10.6-1.module+el8+2469+5ecd5aae.x86_64 2/3
    Running scriptlet: postgresql-server-10.6-1.module+el8+2469+5ecd5aae.x8 3/3
    Installing : postgresql-server-10.6-1.module+el8+2469+5ecd5aae.x8 3/3
    Running scriptlet: postgresql-server-10.6-1.module+el8+2469+5ecd5aae.x8 3/3
    Verifying : libpq-10.5-1.el8.x86_64 1/3
    Verifying : postgresql-10.6-1.module+el8+2469+5ecd5aae.x86_64 2/3
    Verifying : postgresql-server-10.6-1.module+el8+2469+5ecd5aae.x8 3/3
    Installed products updated.

    Installed:
    postgresql-server-10.6-1.module+el8+2469+5ecd5aae.x86_64
    libpq-10.5-1.el8.x86_64
    postgresql-10.6-1.module+el8+2469+5ecd5aae.x86_64

    Complete!

    Initialize PostgreSQL database instance with following command.

    [root@rhel-8-lepp ~]# 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.

    [root@rhel-8-lepp ~]# systemctl enable postgresql.service
    Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service â /usr/lib/systemd/system/postgresql.service.
    [root@rhel-8-lepp ~]# 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.

    [root@rhel-8-lepp ~]# su - postgres
    [postgres@rhel-8-lepp ~]$ 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.

    [root@rhel-8-lepp ~]# dnf install -y nginx
    ...
    Installed:
    nginx-1:1.14.1-8.module+el8+2505+fe936cef.x86_64
    gd-2.2.5-6.el8.x86_64
    jbigkit-libs-2.1-14.el8.x86_64
    libX11-1.6.7-1.el8.x86_64
    libX11-common-1.6.7-1.el8.noarch
    libXau-1.0.8-13.el8.x86_64
    libXpm-3.5.12-7.el8.x86_64
    libjpeg-turbo-1.5.3-7.el8.x86_64
    libtiff-4.0.9-13.el8.x86_64
    libwebp-1.0.0-1.el8.x86_64
    libxcb-1.13-5.el8.x86_64
    nginx-all-modules-1:1.14.1-8.module+el8+2505+fe936cef.noarch
    nginx-filesystem-1:1.14.1-8.module+el8+2505+fe936cef.noarch
    nginx-mod-http-image-filter-1:1.14.1-8.module+el8+2505+fe936cef.x86_64
    nginx-mod-http-perl-1:1.14.1-8.module+el8+2505+fe936cef.x86_64
    nginx-mod-http-xslt-filter-1:1.14.1-8.module+el8+2505+fe936cef.x86_64
    nginx-mod-mail-1:1.14.1-8.module+el8+2505+fe936cef.x86_64
    nginx-mod-stream-1:1.14.1-8.module+el8+2505+fe936cef.x86_64
    dejavu-fonts-common-2.35-6.el8.noarch
    dejavu-sans-fonts-2.35-6.el8.noarch
    fontconfig-2.13.1-3.el8.x86_64
    fontpackages-filesystem-1.44-22.el8.noarch
    perl-Carp-1.42-396.el8.noarch
    perl-Errno-1.28-416.el8.x86_64
    perl-Exporter-5.72-396.el8.noarch
    perl-File-Path-2.15-2.el8.noarch
    perl-IO-1.38-416.el8.x86_64
    perl-PathTools-3.74-1.el8.x86_64
    perl-Scalar-List-Utils-3:1.49-2.el8.x86_64
    perl-Socket-4:2.027-2.el8.x86_64
    perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch
    perl-Unicode-Normalize-1.25-396.el8.x86_64
    perl-constant-1.33-396.el8.noarch
    perl-interpreter-4:5.26.3-416.el8.x86_64
    perl-libs-4:5.26.3-416.el8.x86_64
    perl-macros-4:5.26.3-416.el8.x86_64
    perl-parent-1:0.237-1.el8.noarch
    perl-threads-1:2.21-2.el8.x86_64
    perl-threads-shared-1.58-2.el8.x86_64

    Complete!

    Enable and start Nginx service.

    [root@rhel-8-lepp ~]# systemctl enable nginx.service
    Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service â /usr/lib/systemd/system/nginx.service.
    [root@rhel-8-lepp ~]# systemctl start nginx.service

    Allow HTTP service in Linux firewall.

    [root@rhel-8-lepp ~]# firewall-cmd --permanent --add-service=http
    success
    [root@rhel-8-lepp ~]# 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.

    [root@rhel-8-lepp ~]# dnf install -y php php-mysqlnd php-pdo php-gd php-mbstring php-fpm php-pgsql
    ...
    Installed:
    php-7.2.11-1.module+el8+2561+1aca3413.x86_64
    php-fpm-7.2.11-1.module+el8+2561+1aca3413.x86_64
    php-gd-7.2.11-1.module+el8+2561+1aca3413.x86_64
    php-mbstring-7.2.11-1.module+el8+2561+1aca3413.x86_64
    php-mysqlnd-7.2.11-1.module+el8+2561+1aca3413.x86_64
    php-pdo-7.2.11-1.module+el8+2561+1aca3413.x86_64
    php-pgsql-7.2.11-1.module+el8+2561+1aca3413.x86_64
    apr-util-bdb-1.6.1-6.el8.x86_64
    apr-util-openssl-1.6.1-6.el8.x86_64
    apr-1.6.3-9.el8.x86_64
    apr-util-1.6.1-6.el8.x86_64
    httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64
    httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch
    httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_64
    mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64
    php-cli-7.2.11-1.module+el8+2561+1aca3413.x86_64
    php-common-7.2.11-1.module+el8+2561+1aca3413.x86_64
    mailcap-2.1.48-3.el8.noarch
    redhat-logos-httpd-80.7-1.el8.noarch

    Complete!

    Edit php-fpm configurations.

    [root@rhel-8-lepp ~]# 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.

    [root@rhel-8-lepp ~]# chgrp nginx /var/lib/php/{opcache,session,wsdlcache}

    Start and enable php-fpm service.

    [root@rhel-8-lepp ~]# systemctl enable php-fpm.service
    Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service â /usr/lib/systemd/system/php-fpm.service.
    [root@rhel-8-lepp ~]# systemctl start php-fpm.service

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

    [root@rhel-8-lepp ~]# systemctl restart nginx.service

    Create a PHP script to check PHP modules.

    [root@rhel-8-lepp ~]# 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.

    0 Comments