How to Install LAMP Stack on Fedora 36 (Simple Guide)

The step-by-step guide on this page will show you how to install LAMP stack on Fedora 36.

LAMP is a stack of open-source tools which are required to build web based applications. It has following tools:

  • L: Linux (Physical Server, VM or Container)
  • A : Apache Web Server
  • M: MariaDB/MySQL
  • P: PHP

LAMP is the building block of web based software like WordPress, Drupal, Joomla and OpenCart.

Prerequisites

  • Minimal Installed Fedora 36
  • Sudo User with admin rights
  • Internet Connectivity

Let’s jump into LAMP installation steps.

1) Install Apache Web Server

In Fedora Linux, dnf is the default Package Manager. So, software or rpm packages are installed via dnf.

Apache Web Server (httpd) rpm package is available in default package repositories, so it’s installation is straight forward, run following dnf command,

$ sudo dnf install -y httpd

Install-Apache-Fedora-Linux

View Apache version, run

$ sudo rpm -q httpd
httpd-2.4.54-3.fc36.x86_64
$

Start and Enable Apache (httpd) Service

$ sudo systemctl start httpd
$ sudo systemctl enable httpd

Check status of httpd service, run

$ sudo systemctl status httpd

Apache-Service-Check-Fedora-Linux

Allow http port in OS firewall, run following commands,

$ sudo firewall-cmd --permanent --add-service=http
$ sudo firewall-cmd --permanent --add-service=https
$ sudo firewall-cmd --reload

Verify the Installation of Apache

Use ip command to get the ip address of your machine. Open the browser type IP Address of your machine and hit enter. We should get following Apache web page,

Default-Apache-WebPage-Fedora-Linux

2) Install MariaDB Database Server

MariaDB and its dependencies are available in the default package repositories of Fedora 36. Execute following command to install it.

$ sudo dnf install mariadb-server mariadb -y

MariaDB-Install-Fedora-Linux

Start and enable mariadb service

$ sudo systemctl enable mariadb --now

To Check mariadb service status, run

$ sudo systemctl status mariadb

Secure MariaDB installation by configuring initial settings of database and root password using “mysql_secure_installation

$ sudo mysql_secure_installation

Secure-MariaDB-Installation-Fedora-Linux-Part1

Secure-MariaDB-Installation-Fedora-Linux-Part2

3) Install PHP (Server Scripting Language)

PHP is an open-source server side scripting language used for building the web applications. Latest php 8.1 and it’s dependencies are also available in default packages repositories. So, to install php and other php modules, run folllwing dnf command

$ sudo dnf install -y php php-common php-cli

Install-PHP-Fedora-Linux-Dnf-Command

To test the php installation , create a php file (fedora.php) in /var/www/html

$ sudo vi /var/www/html/fedora.php
<?php
phpinfo()
?>

Restart the Apache Service

$ sudo systemctl restart httpd

Now access the fedora.php file from your browser, type following URL

http://<IP_Address_Your_Machine>/fedora.php

PHP-Default-Apache-Fedora-Linux

Great, above page confirms that php 8.1 is installed successfully.

That’s all from this guide. I hope you have found it useful, please hesitate to post your queries and feedback in below comments section.

Read Also: How to Configure Static IP Address on Fedora Linux

1 thought on “How to Install LAMP Stack on Fedora 36 (Simple Guide)”

  1. What if multi-php is needed, say, for different vHost, one project uses 7.4(I know is deprecated), and another project uses php8+, plus, what about PhpMyAdmin… Other than that your blog looks great, thanks.

Leave a Comment

Your email address will not be published. Required fields are marked *