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.
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.
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
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
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
Next, open the web browser and go to localhost. You will see this:
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
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
<?php phpinfo(); ?>
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.
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
Then, enable the MariaDB service.
:~$ sudo systemctl enable mariadb :~$ sudo systemctl start mariadb
Now, you have to define a password and some extra settings. For this, you will use the MySQL script.
:~$ sudo mysql_secure_installation
To the questions that arise, I have answered: Y, N, Y, Y.
And that’s it.
Conclusion
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.
Thank you.
And now how can we add multiple sites for development? Nobody sdeems to make a tut about that.
Simple and easy to follow tutorial. This was exactly what I was looking for! Keep up the good work.