Introduction
LAMP stands for Linux, Nginx, MySQL/MariaDB, and PHP. Together, they provide a proven set of software for delivering high-performance web applications. Each component contributes essential capabilities to the stack.
It is a set of programs or libraries that when installed on a computer, allow you to transform it into a Web server. This makes it one of the first things to do to start deploying dynamic websites.
This article will explain how to install the LEMP stack on Fedora 34.
Install Nginx
- Before starting the installation let's update the system.
$ sudo dnf update
- To install Nginx on Fedora 34, use the following command.
$ sudo dnf -y install nginx
- After the installation, start and enable the Nginx service using the following commands.
$ sudo systemctl start nginx
$ sudo systemctl enable nginx
Install MariaDB
MariaDB is a drop-in replacement for MySQL database servers, and it is used to store and manage dynamic data on web servers.
- To install MariaDB run the below command on the terminal.
$ sudo dnf -y install mariadb-server mariadb
- Start and enable the MariaDB service using the following commands.
$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb - To secure the MariaDB installation, run the following command.
This command will prompt you to enter the root password, and then it will ask some questions to secure the MariaDB installation, such as removing the anonymous users, disabling the root login remotely, removing the test database, and reloading the privilege tables.$ sudo mysql_secure_installation
Install PHP
- To install PHP on Fedora 34, use the following command.
$ sudo dnf -y install php php-fpm php-mysqlnd php-opcache php-gd php-xml php-mbstring
- After the installation is completed, you need to configure the PHP-FPM service.
$ vi /etc/php-fpm.d/www.conf
- Change the following lines in the file then save and close the file.
user = nginx
group = nginx - After configuring PHP-FPM, start and enable the service.
$ sudo systemctl start php-fpm
$ sudo systemctl enable php-fpm - Open a browser and access your server IP to test the Nginx server.
Output: