In this tutorial we will be setting up a LAMP stack , which includes Apache 2.4, MySQL 8 or MariDB 10, PHP 7 on Fedora 23/24.

This comprehensive Linux guide expects that you run the following commands as root user but if you decide to run the commands as a different user then ensure that the user has sudo access and that you precede each of the privileged commands with sudo

Install Apache Server

Using dnf, we will be installing our Apache web server. Also, by default Fedora 23/24 comes with native Apache 2.4 package.

dnf install httpd

Now start the http service and enable it to start at boot .

systemctl start httpd.service
systemctl enable httpd.service

Fedora server comes with firewall service for network filtering. If firewall is enabled, then we need to perform the below steps.

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

Now, open web browser on a remote PC and type in the URL http://<Your server IP>. You should see a page similar to the following.

We have successfully installed our Apache web server. Lets move forward with further installation process.

Install MySQL / MariaDB

Install MariaDB

Since MariaDB is a MySQL fork of the original MySQL developer Monty Widenius, We will go with MariaDB.

dnf install mariadb-server

After installation we need to start and enable the DB services.

systemctl start mariadb.service
systemctl enable mariadb.service

Now we need to configure the Database to complete the installation


We will be asked to enter the password for the MySQL root account, since
we haven’t set this yet, so just hit ENTER . Then we will be asked to set that password. we should type Y to set a root password.

To rest of all the questions, the script asks, you should press Y, followed by the ENTER key at each prompt. During this process we will remove anonymous users and the test database, disable remote root logins, and load these new rules MySQL.

Install MySQL

NOTE :This is an optional step, since MariaDB is already installed. If you want to go with MySQL instead of MariaDB, then this for you.

We need to download and add the MySQL community repository to proceed further.

dnf install
systemctl start mysqld.service

systemctl enable mysqld.service

Further installation is similar to MariaDB..


Install PHP

Now to generate dynamic content, we need to install PHP. We can get a full list of available PHP modules and extensions using the following command.

dnf install -y php php-mysql php-common

we need to create a test PHP file in our document root. We will create a codesposts.php file in the document root to test our configuration

vi /var/www/html/codesposts.php
<?php phpinfo(); ?>      

After pasting the above code to our codesposts.php file, save and close the file.

Restart the httpd service and we can visit this web page in a web browser from the below shown URL.

systemctl restart httpd.service

we should see a web page that has been generated by PHP with information about your server.

Install phpMyAdmin

phpMyAdmin is a web interface, used to mange our MySQL/MariaDB database.

To avoid using MySQL command line to manage our database we will install PhpMyAdmin package

dnf install phpmyadmin

We need to configure phpMyAdmin to allow connections from remote hosts by editing phpmyadmin.conf file

vi /etc/httpd/conf.d/phpmyadmin.conf

Comment out the following lines, using “#” and save the file.

# Order Deny,Allow
# Deny from all
# Allow from

We will be using http authentication instead of cookie based authentication. Open /etc/phpMyAdmin/

vi /etc/phpMyAdmin/

Modify the below line as follows.. and restart the apache service.

$cfg['Servers'][$i]['auth_type']     = 'http';    // Authentication method (config, http or cookie based)?
systemctl restart  httpd.service

Now after the configuration, we can check our PHP configuration from the below URL


We will get an output something similar to the above. We have successfully completed the installation process of LAMP stack on Fedora.

Thanks for being with us, hope this help you in gaining knowledge and we are always ready to help you. For furthers queries or suggestions, kindly drop a comment below