How to Install LAMP (Linux, Apache, MariaDB and PHP) on Fedora 23 Server and Workstation

If you ever wanted to host your own website or just want to try your PHP programming skills, you will most definitely have stumbled upon LAMP.

For those of you, who don’t know what LAMP is, this is a stack of web service software. LAMP uses the first letter of each package included in it – Linux, Apache, Mysql/MariaDB and PHP.

Install LAMP in Fedora 23

In this article, we will show you how to install LAMP (Linux, Apache, MySQL/MariaDB and PHP) in Fedora 23 Server and Workstation.

I will assume that you have already completed the installation of Fedora 23 Server and Workstation, which basically completes the “Linux” part. But if you haven’t completed the Fedora install yet, you can check our guides here:

Before we start the installation of the rest of the packages, we recommend to update your packages with the following command:

$ sudo dnf update

Update Fedora 23 Packages

Now we can safely proceed to the installation of the rest of the packages. For easier understanding and follow up, the article will be separated in three parts, one for each package.

Step 1: Installing Apache Web Server

1. Apache web server is the most used web server on the internet. It’s powering millions of websites and is one of the most reliable solutions you can get for a web server. There are plenty of modules that can help you customize the functionality of Apache and also security modules such as mod_security to protect your web sites.

To install Apache in Fedora 23, you can simply run the following command:

$ sudo dnf install httpd

Install Apache Web Server in Fedora 23

2. Once the install is complete, there are few more things to be done. First we will setup Apache to automatically start upon system boot and then we will start and verify the status of Apache.

8. There are few settings that need to be adjusted in order to secure your MariaDB installation. To change this settings, we recommend running the following command:

# mysql_secure_installation

This action will start a series of questions that you will need to answer in order to improve the security of your MySQL server.

Here is what you will need to do.

When asked for MySQL root password, leave empty. There is no password by default.

After that you will be asked to enter the new “root” password for MariaDB. Make sure to select a strong one.

After that, you will be prompted if you wish to remove the MariaDB anonymous user. This user is not needed, so your should be “y” for yes.

Next, you will need to disallow remote access to the databases from root. The reason behind that is that you can later create separate users for each database that will be able to access the required databases.

Continuing further, you will be asked whether or not you wish to remove the “test” database that was created upon installation of MariaDB. This database is not needed so you can safely remove it.

Finally reload the database privileges and you are done.

Enter MariaDB Root Password

MySQL Secure Installation

Step 3: Installing PHP

9.PHP is a programming language used on most of the websites over the internet. It’s used for creating dynamic websites. To give you an idea of what sites you can build with PHP, I will tell you that www.tecmint.com is built on PHP.

To install PHP in Fedora 23, you will need to run the following command:

# dnf install php php-common

Install PHP in Fedora 23

10. Next install required PHP modules to run PHP/MySQL applications using following command.

# dnf install php-mysql php-pdo php-gd php-mbstring

Install PHP Modules

11. Once the installation is complete, restart Apache so it can start using PHP:

# systemctl restart httpd

12. Now let’s test our settings. Create a file called info.php in the following directory: /var/www/html. You can use command such as:

# cd /var/www/html/
# nano info.php

Enter the following code:

<?php
phpinfo()
?>

Now save the file. Go back to your browser and enter the following:

http://your-ip-address/info.php

You should now be able to see the PHP info page that you just created:

Check PHP Information

Conclusion

Your installation of the LAMP stack on Fedora 23 is now complete and you can start creating your awesome web projects. If you liked the article or simply have a question, please do not hesitate to submit your comment in the section below.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

I am a bachelor in computer science and a Linux Foundation Certified System Administrator. Currently working as a Senior Technical support in the hosting industry. In my free time I like testing new software and inline skating.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Nicely explained. Any chance you will update this for the new version of Fedora? Also Is the process of install PHP on Debian same? I have been using a platform, Cloudways, where there is no need to install it manually. But I think it will be a good thing if I know how to do it manually.