FedoraRHEL Based

How To Install LEMP Stack on Fedora 38

How To Install LEMP Stack on Fedora 38: A Step-by-Step Guide

Install LEMP Stack on Fedora 38

In this tutorial, we will show you how to install the LEMP stack on Fedora 38. LEMP stands for Linux, Nginx, MySQL, and PHP. This means that we are going to install and configure these software packages on our server to set up a fully functional web server. We will start by installing Nginx, a lightweight and high-performance web server widely known for its stability and speed. Then, we will install MySQL, a popular database management system that will allow you to store, manage, and manipulate your data. Finally, we will install PHP, the scripting language that allows you to create dynamic web pages.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the LEMP on a Fedora 38.


  • A server running one of the following operating systems: Fedora 38.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Nginx, MariaDB, and PHP.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install LEMP Stack on Fedora 38

Step 1. Before we can install the LAMP stack on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install LAMP without any issues:

sudo dnf upgrade --refresh

Step 2. Installing Nginx on Fedora 38.

Nginx is one of the most popular web servers in use today, and it is known for its speed and scalability. In this section, we’ll guide you through the process of installing Nginx on Fedora 38:

sudo dnf install nginx

This command will download and install the latest version of Nginx, along with any necessary dependencies. After the installation is complete, we can start the Nginx service using the following command:

sudo systemctl start nginx
sudo systemctl enable nginx

For additional resources on installing Nginx, read the post below:

Step 3. Installing MySQL Database Server.

Now that we have installed the Nginx web server on our system, we need to install a database management system that can store, manage and retrieve our website data efficiently:

sudo dnf install mysql-server

Once the package installation is complete, the MySQL service will start automatically. We can verify the status of the service by executing the following command:

sudo systemctl start mysqld
sudo systemctl enable mysqld
sudo systemctl status mysqld

By default, MySQL installation is not secured. We need to run the mysql_secure_installation script to secure the installation by setting a root password, removing anonymous users, disallowing root login remotely, and removing the test database:

sudo mysql_secure_installation

To connect to the MySQL server from the terminal, we need to enter the following command:

mysql -u root -p

For additional resources on installing MySQL, read the post below:

Step 4. Installing PHP.

Now that we have installed Nginx and MySQL, it’s time to install PHP. PHP is a widely used server-side scripting language that is known for its ability to interact with HTML and MySQL:

sudo dnf install php php-cli php-fpm php-mysqlnd

Once the installation is complete, we need to make some changes to the php.ini file. To do this, open the php.ini file using the following command:

sudo nano /etc/php.ini

In this file, find the line that reads “cgi.fix_pathinfo” and change its value to 0. This will disable the “PATH_INFO” vulnerability, which can be exploited by attackers.

Next, we need to configure PHP-FPM. Open the www.conf file using the following command:

sudo nano /etc/php-fpm.d/www.conf

In this file, find the line that reads “listen =” and uncomment it by removing the semicolon at the beginning of the line. This will allow PHP-FPM to listen to requests.

Finally, restart the PHP-FPM service to apply the changes:

sudo systemctl restart php-fpm

For additional resources on installing PHP, read the post below:

Congratulations! You have successfully installed LEMP. Thanks for using this tutorial for installing the LEMP Stack on your Fedora 38 system. For additional help or useful information, we recommend you check the official LAMP Stack website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button