FedoraRHEL Based

How To Install LAMP Stack on Fedora 38

Install LAMP Stack on Fedora 38

In this tutorial, we will show you how to install LAMP Stack on Fedora 38. For those of you who didn’t know, LAMP is an acronym that stands for Linux, Apache, MySQL, and PHP – the four main components of this stack. Linux is the operating system that serves as the foundation for LAMP. Apache is the web server that processes and delivers web pages to users’ web browsers. MySQL is the relational database management system that stores and retrieves data. And PHP is a server-side scripting language that enables the creation of dynamic web pages. With LAMP, you can build robust and scalable web applications that can handle a large volume of traffic. And the best part? It’s all open-source, which means it’s free and constantly evolving with the contributions of developers from all over the world.

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 LAMP Stack on a Fedora 38.

Prerequisites

  • 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 LAMP Stack.
  • 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 LAMP Stack on Fedora 38

Step 1. Before proceeding, update your Fedora operating system to make sure all existing packages are up to date. Use this command to update the server packages:

sudo dnf upgrade
sudo dnf update

Step 2. Installing Apache on Fedora 38.

Apache is the most popular web server used in the LAMP stack. To install Apache on your Fedora 38 system, open the terminal and execute the following command:

sudo dnf install httpd

Once the installation is complete, start the Apache service by executing the following command:

sudo systemctl start httpd
sudo systemctl enable httpd

To verify that Apache is installed and running, open your web browser and type in the following URL: http://localhost. You should see the Apache test page.

Install LAMP Stack on Fedora 38

Step 3. Installing MySQL on Fedora 38.

MySQL is the database management system used in the LAMP stack. To install MySQL on your Fedora 38 system, open the terminal and execute the following command:

sudo dnf install mysql-server

Once the installation is complete, start the MySQL service by executing the following command:

sudo systemctl start mysqld
sudo systemctl enable mysqld

By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

To log into MySQL, use the following command (note that it’s the same command you would use to log into a MariaDB database):

mysql -u root -p

Step 4. Installing PHP on Fedora 38.

PHP is the scripting language used in the LAMP stack. To install PHP on your Fedora 38 system, open the terminal and execute the following command:

sudo dnf install php php-mysqlnd

Once the installation is complete, restart the Apache service by executing the following command:

sudo systemctl restart httpd

Step 5. Testing LAMP Stack on Fedora 38.

To test whether the LAMP stack is working correctly, we will create a simple PHP file and place it in the Apache document root directory. Now we create a new file called info.php in the /var/www/html directory using the following command:

sudo nano /var/www/html/info.php

Add the following PHP code to the file:

<?php
phpinfo ();
?>

Save and exit the file. Then, open your web browser and type in the following URL: http://localhost/info.php. You should see the PHP information page, which will confirm that the LAMP stack is installed and working correctly on your Fedora 38 system.

Congratulations! You have successfully installed LAMP. Thanks for using this tutorial for installing the LAMP 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

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button