Site icon CentLinux

How to install LEPP Stack on RHEL 8

Share on Social Media

Learn how to install the LEPP Stack (Linux, Nginx, PostgreSQL, PHP) on RHEL 8 with our detailed guide. Follow step-by-step instructions to set up and configure your LEPP Stack efficiently on your RHEL 8 system. #centlinux #linux #nginx #postgres #php

What is LEPP Stack?

The LEPP Stack is a powerful and efficient software stack for building and deploying dynamic web applications. Each component of the LEPP Stack plays a crucial role:

  1. Linux: As the underlying operating system, Linux provides stability, security, and performance. It is widely used in server environments due to its robustness and flexibility.
  2. Nginx: Nginx serves as the web server and reverse proxy server. Known for its high performance, scalability, and low resource usage, Nginx is capable of handling a large number of concurrent connections, making it ideal for high-traffic websites and applications.
  3. PostgreSQL: PostgreSQL is an advanced, open-source relational database management system (RDBMS). It is renowned for its robustness, feature set, and standards compliance. PostgreSQL supports complex queries, foreign keys, triggers, and updatable views, among other features. Its ability to handle a wide variety of workloads, from single-machine applications to large internet-facing applications with many concurrent users, makes it a strong choice for database management.
  4. PHP: PHP is a widely-used server-side scripting language designed for web development. It is embedded into HTML and interacts with the database to create dynamic content. PHP’s ease of use, extensive documentation, and large community support make it a popular choice for developing web applications.

Advantages of Using the LEPP Stack

Use Cases for the LEPP Stack

The LEPP Stack is a reliable and powerful choice for developers looking to create dynamic and scalable web applications.

Recommended Online Training: Learn Bash Shell in Linux for Beginners

Environment Specification

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

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 Page

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.

If you are new to Linux and facing difficulty in working at Linux Bash prompt. We recommend that, you should read The Linux Command Line, 2nd Edition: A Complete Introduction by William Shotts.

Final Thoughts

If you found this guide on installing the LEPP Stack on RHEL 8 helpful and need further assistance with server setup or other technical support, consider hiring a professional. Visit my Fiverr profile for expert services in server configuration, database management, and more. Let’s make your project a success!

Exit mobile version