How To Install LAMP Stack on Fedora 36

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

In this tutorial, we will show you how to install LAMP Stack on Fedora 36.

LAMP stack is a known combination of Linux, Apache, MariaDB, and PHP. Here Linux is an operating system, Apache is the popular web server developed by Apache Foundation, MariaDB is a relational database management system used for storing data and PHP is the widely used programming language.

With LAMP it is possible to develop and deploy web applications created in PHP.

Lamp is free and open source it is used to host dynamic websites.

Also read: How to install LAMP Stack on Debian
How to install LAMP Stack on openSUSE
How to install LAMP Stack on FreeBSD
How to install LAMP Stack on CentOS
How to install LAMP Stack on Ubuntu

Step 1: Install Apache Web Server on Fedora 36

  • Run below command to install Apache
sudo dnf install httpd -y
  • Once installed, we need to start and enable apache service on system boot. to do this use below command:
sudo systemctl start httpd
sudo systemctl enable httpd
  • Check the status of httpd
sudo systemctl status httpd
  • Configure firewall to allow requests on Apache web server
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
  • Verify that the webs-erver is running and accessible by accessing your server’s IP address or just localhost as follows:

Step 2: Install MariaDB on Fedora 36

MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system (RDBMS), intended to remain free and open-source software under the GNU General Public License. It is developed by the members of MYSQL team.

  • So, run the following command to install MariaDB
dnf install mariadb mariadb-server -y
  • Once the installated, we need to start the MariaDB server to start operating.
sudo systemctl start mariadb
sudo systemctl enable mariadb
  • Check mariadb status
sudo systemctl status mariadb
  • Also to secure MariaDB database, you have to run the command below:
mysql_secure_installation
  • Then you will need to perform the following steps.

Enter current password for root (enter for none): (If you did not set the password for mariadb just press enter, you can set the password in next step)
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

  • Log into MariaDB as follows: (-u refers to user, -p refers to password)
mysql -u root -p
  • Then check the MariaDB version by running the statement below:
SELECT VERSION();

Step 3: Install PHP 8 on Fedora 36

PHP is a general-purpose scripting language especially suited to web development. PHP is a server side scripting language that is used to develop Static websites or Dynamic websites or Web applications. PHP stands for Hypertext Pre-processor, that earlier stood for Personal Home Pages.

  • PHP is not available on Fedora 36 base repository, so use below command to install these repositories:
sudo dnf install http://rpms.remirepo.net/fedora/remi-release-36.rpm
  • Enable PHP 8 from the Remi-8.0 module using the following command:
sudo dnf config-manager --set-enabled remi
sudo dnf module enable php:remi-8.1
  • Install PHP 8 by running the command below:
sudo dnf module install php:remi-8.1
  • Now, you can check the version of PHP to verify that it’s installed successfully on your Fedora Linux
php --version
  • Next is to Install PHP 8 Extensions and addons:
sudo dnf install -y php-cli php-devel php-gd php-pear php-fpm php-zip php-mcrypt php-mbstring php-bcmath php-json  php-curl php-xml php-mysqlnd 
  • Confirm that PHP is working via the Apache web server, so create the next file into the /var/www/html directory:
sudo vim /var/www/html/info.php

Then add the following:

<?php
phpinfo ();
?>
  • You can access this file by opening your browser then go to http://your-ip-address/info.php or http://localhost/info.php as shown below

Congratulations! you have installed LAMP Stack on Fedora 36 successfully. Now you can host your websites on your server.

Also visit: How to install LAMP Stack on CentOS
How to install LAMP Stack on Ubuntu

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
MQ-Jr
MQ-Jr
unixcop Admin

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook