Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Installing a LEMP Stack on RHEL 8

Before anyone can start building a world-changing website or application on LEMP, they have to lay the foundation: the stack. In this Hands-On Lab, we will walk through the installation of the components that make up the LEMP stack on RHEL 8. We will also configure the Linux environment to host the LEMP stack. When we have completed this lab, we will have a running LEMP stack on RHEL 8. We will also have a better understanding of how a LEMP installation is configured on RHEL 8.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 45m
Published
Clock icon Jan 10, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Install NGINX Using the RHEL 8 Repositories

    Become the 'root' user.

    sudo su -
    

    Install the NGINX server.

    yum -y install nginx
    

    Enable the NGINX server to start at boot time.

    systemctl enable nginx
    

    Validate the NGINX configuration.

    nginx -t
    

    Start the NGINX server and check the status.

    systemctl start nginx
    
    systemctl status nginx
    

    The service should be 'enabled' and 'running'.

  2. Challenge

    Configure HTTP Access Through the Firewall

    Check the firewall configuration:

    firewall-cmd --info-zone=public
    

    HTTP traffic is not configured:

    services: cockpit dhcpv6-client ssh

    Allow HTTP traffic through:

    firewall-cmd --zone=public --add-service=http --permanent
    

    Reload the new firewall configuration to pick up the change:

    firewall-cmd --reload
    

    Recheck the firewall configuration:

    firewall-cmd --info-zone=public
    

    We should see HTTP listed:

    services: cockpit dhcpv6-client http ssh

  3. Challenge

    Verify Basic HTTP Functionality in NGINX

    Let's verify that we can load the default NGINX web page using curl:

    curl http://`curl v4.ifconfig.co`
    

    Now we'll use a web browser to go to the default NGINX web page at http://OUR_PUBLIC_IP_ADDRESS. We should see the default NGINX page. We can find the public IP address of the instance in the /home/cloud_user/server_info.txt file.

  4. Challenge

    Install the PHP Components

    Install the PHP components using YUM:

    yum -y install php php-pdo php-mysqlnd php-gd php-mbstring php-fpm
    

    We may notice that php and php-fpm are already installed. This is not an error, as php and php-fpm were installed during the creation of the lab environment.

  5. Challenge

    Verifying PHP Functionality in NGINX

    Load the 'phpinfo' page using 'curl'. Notice that we are specifying a header (using the -H option).

    curl -H "www.bigstatecollege.edu" http://www.bigstatecollege.edu/phpinfo.php
    

    We should see the 'phpinfo' page for this server. If you put your server's public IP address into your /etc/hosts file pointing to www.bigstatecollege.edu you should be able to access the 'phpinfo' page at http://www.bigstatecollege.edu/phpinfo.php using your web browser.

  6. Challenge

    Install MariaDB

    Install MariaDB using yum:

    yum -y install mariadb mariadb-server
    

    Enable and start MariaDB via systemctl:

    systemctl enable mariadb
    
    systemctl start mariadb
    

    Verify that MariaDB is installed, enabled, and running using systemctl:

    systemctl status mariadb
    
  7. Challenge

    Verify the Installed Version of MariaDB

    Verify the installed version of MariaDB using 'mysql'.

    mysql -V
    

    The exact version is not critical here, but we want to confirm it returns a result.

    [root@ip-10-0-1-205 ~]# mysql -V mysql Ver 15.1 Distrib 10.3.11-MariaDB, for Linux (x86_64) using readline 5.1

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans