Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Installing a LEMP Stack on Ubuntu Linux

Before we can start building our world-changing website or application on LEMP, we have to lay the foundation for the stack. In this hands-on lab, we will walk through the installation of the components that make up the LEMP stack on Ubuntu Linux. We will also configure th eUbuntu Linux environment to host the LEMP stack. When we have completed this lab, we will have a running LEMP stack on Ubuntu. We will also have a better understanding of how a LEMP installation is configured on Ubuntu Linux.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Beginner
Last updated
Sep 01, 2025
Duration
45m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Install NGINX Using the Default Ubuntu Package Repositories

    Become the root user:

    sudo su -
    

    Install NGINX from the Ubuntu repositories using apt-get:

    apt-get -y install nginx
    

    Check the status of the NGINX service with systemctl:

    systemctl status nginx
    

    The NGINX service should be enabled and active.

  2. Challenge

    Configure HTTP Access Through the Firewall

    Check the initial status of the firewall:

    ufw status
    

    Open port 80 to allow inbound HTTP traffic:

    ufw allow 'Nginx HTTP'
    

    Recheck the status of the firewall:

    ufw status
    

    HTTP traffic is now allowed through the firewall.

  3. Challenge

    Verify Basic HTTP Functionality in NGINX

    Verify that we can load the default NGINX web page using curl:

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

    Use a web browser to go to the default NGINX web page at http://OUR_PUBLIC_IP_ADDRESS or http://OUR_PUBLIC_DNS. We should see the default NGINX page. We can find the public IP address and DNS of our instance in the /home/cloud_user/server_info.txt file.

  4. Challenge

    Install the PHP Components

    Install the PHP components using apt-get:

    apt-get -y install php-fpm php-mysql
    
  5. Challenge

    Activating the Virtual Host Configuration

    To make the bigstatecollege.edu virtual host active, we create a symlink to the appropriate configuration file in the sites-enabled directory:

    ln -s /etc/nginx/sites-available/bigstatecollege.edu.conf /etc/nginx/sites-enabled/bigstatecollege.edu.conf
    

    Validate the NGINX configuration before reloading the NGINX service:

    nginx -t
    
    systemctl reload nginx
    

    Restart the php-fpm service:

    systemctl restart php7.2-fpm.service
    
  6. Challenge

    Verifying PHP Functionality in NGINX

    Test PHP by loading the phpinfo page on bigstatecollege.edu. We are providing a header (via the -H switch) so NGINX knows to route the request to the www.bigstatecollege.edu virtual host:

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

    We can add our server's public IP address, pointing at www.bigstatecollege.edu, to our computer's hosts file if we want to access the phpinfo page at http://www.bigstatecollege.edu/phpinfo.php with a web browser.

  7. Challenge

    Install MariaDB

    Install MariaDB using apt-get:

    apt-get -y install mariadb-server
    

    Check the status of the MariaDB server using systemctl:

    systemctl status mariadb
    

    The server should be enabled and running.

  8. Challenge

    Verify the Installed Version of MariaDB

    Check the version of MariaDB:

    mysql -V
    

    root@ip-10-0-1-113:~# mysql -V mysql Ver 15.1 Distrib 10.1.41-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

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.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight