In this article, we’ll be looking at how to install LEMP stack on Fedora 30 Server. LEMP Stands for:
- L -> Linux
- E -> Nginx
- M -> Maria DB
- P -> PHP
I am assuming Fedora 30 is already installed on your system.
LEMP is a collection of powerful software setup that is installed on a Linux server to help in developing popular development platforms to build websites, LEMP is a variation of LAMP wherein instead of Apache, EngineX (Nginx) is used as well as MariaDB used in place of MySQL. This how-to guide is a collection of separate guides to install Nginx, Maria DB and PHP.
Install Nginx, PHP 7.3 and PHP-FPM on Fedora 30 Server
Let’s take a look at how to install Nginx and PHP along with PHP FPM on Fedora 30 Server.
Step 1) Switch to root user
First step in installing Nginx in your system is to switch to root user. Use the following command :
[email protected] ~]$ sudo -i [sudo] password for pkumar: [[email protected] ~]#
Step 2) Install Nginx, PHP 7.3 and PHP FPM using dnf command
Install Nginx using the following dnf command:
[[email protected] ~]# dnf install nginx php php-fpm php-common -y
Step 3) Install Additional PHP modules
The default installation of PHP only comes with the basic and the most needed modules installed. If you need additional modules like GD, XML support for PHP, command line interface Zend OPCache features etc, you can always choose your packages and install everything in one go. See the sample command below:
[[email protected] ~]# sudo dnf install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml -y
Step 4) Start & Enable Nginx and PHP-fpm Service
Start and enable Nginx service using the following command
[[email protected] ~]# systemctl start nginx && systemctl enable nginx Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service. [[email protected] ~]#
Use the following command to start and enable PHP-FPM service
[[email protected] ~]# systemctl start php-fpm && systemctl enable php-fpm Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service. [[email protected] ~]#
Verify Nginx (Web Server) and PHP installation,
Note: In case OS firewall is enabled and running on your Fedora 30 system, then allow 80 and 443 ports using beneath commands,
[[email protected] ~]# firewall-cmd --permanent --add-service=http success [[email protected] ~]# [[email protected] ~]# firewall-cmd --permanent --add-service=https success [[email protected] ~]# firewall-cmd --reload success [[email protected] ~]#
Open the web browser, type the following URL: http://<Your-Server-IP>
Above screen confirms that NGINX is installed successfully.
Now let’s verify PHP installation, create a test php page(info.php) using the beneath command,
[[email protected] ~]# echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/info.php [[email protected] ~]#
Type the following URL in the web browser,
Above page confirms that PHP 7.3.5 has been installed successfully. Now let’s install MariaDB database server.
Install MariaDB on Fedora 30
MariaDB is a great replacement for MySQL DB as it is works much similar to MySQL and also compatible with MySQL steps too. Let’s look at the steps to install MariaDB on Fedora 30 Server
Step 1) Switch to Root User
First step in installing MariaDB in your system is to switch to root user or you can use a local user who has root privilege. Use the following command below:
[[email protected] ~]# sudo -i [[email protected] ~]#