24 C
Senior Writer and partner

How to install LAMP on Fedora 29 or Fedora 30?

A LAMP server (Linux + Apache + MariaDB + PHP) allows us to have a web server ready to host sites made with each of the components of the acronym. So, this article will teach you how to install LAMP on Fedora 29 and Fedora 30.

Many web developers use Fedora for their work. It’s not uncommon because we’re talking about a very stable and carefully made Linux distribution. However, it is true that Fedora is not the first choice to install LAMP so many don’t know how to do it.

Install LAMP on Fedora 29
Install LAMP

A LAMP server as I said before is composed of Linux, a web server as Apache, a database manager in MariaDB and a programming language to interpret and make the application work, in this case, PHP. Together, they form an ideal combination to develop web applications and to run applications.

- Advertisement -

Let’s start.

Install LAMP on Fedora

1. Install Apache web server

First, you need to install apache web server. It is perhaps the most used web server in the world. It stands out for its ease of use, its great documentation and its compatibility with almost all Linux distributions. In addition, its installation is quite simple. Let’s get to it.

Open a Terminal and run:

:~# sudo dnf install httpd

1.- Install apache web server
1.- Install Apache web server

Once the installation is complete, you need to start the service and enable it to run at system startup.

:~$ sudo systemctl enable httpd
:~$ sudo systemctl start httpd

2.- Enabling httpd service
2.- Enabling httpd service

So far there should be no problems, however, if you want to enable remote access, you have to configure something in the firewall.

:~$ sudo firewall-cmd --permanent --zone=FedoraWorkstation --add-service=http

And finally, restart the Firewall service.

:~$ sudo systemctl restart firewalld

3.- Restarting the Firewall service
3.- Restarting the Firewall service

Next, open the web browser and go to localhost. You will see this:

Apache default page on Fedora 30
Apache default page on Fedora 30

And you can continue with the next step.

3. Install PHP

PHP is another fundamental component of LAMP. Without it, you will not be able to execute correctly web applications created in this language. So, it is necessary to install it.

:~$ sudo dnf install php php-cli php-xml php-pdo php-mysqlnd php-pear php-mbstring php-mcrypt

4.- Installing PHP
4.- Installing PHP

Now it is necessary to test the installation. Create a file named example.php in /var/www/html/ with the following content.

:~$ sudo vi /var/www/html/example.php
?>5. Creating a PHP file for test

5. Creating a PHP file for testRestart apache service.

:~$ sudo systemctl restart httpd

Open a web browser and open it. http://IP_ADDRESS/example.php and if you see something like this, then everything goes in order.

6.- PHP installed
6.- PHP installed

The next step is to install MariaDB.

4. Install MariaDB

Now it’s MariaDB’s turn to install. This is so that the applications that require database can run. MariaDB is a MySQL fork that inherits its strength, robustness, and stability.

:~$ sudo dnf install mariadb mariadb-server

7.- Install MariaDB
7.- Install MariaDB

Then, enable the MariaDB service.

:~$ sudo systemctl enable mariadb
:~$ sudo systemctl start mariadb

8.- Enabling MariaDB service
8.- Enabling MariaDB service

Now, you have to define a password and some extra settings. For this, you will use the MySQL script.

:~$ sudo mysql_secure_installation

9.- mysql_secure_installation
9.- mysql_secure_installation

10.- Configuring MariaDB using mysql_secure_installation
10.- Configuring MariaDB using mysql_secure_installation

To the questions that arise, I have answered: Y, N, Y, Y.

And that’s it.


As you may have noticed, installing LAMP is really easy. The key is to do it methodically and everything becomes easy.

The LAMP is necessary for any web developer and for system administrators to be able to run their web applications.

Please spread this article through your social networks.

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



Please enter your comment!
Please enter your name here

Latest article