How to install LAMP Server on Fedora 28

The new Fedora 28 is now available. Fedora 28 is a great operating system which is available for Desktop/Workstation and Server. Today, I am going to show you how to install LAMP Server on Fedora 28. LAMP Server is a great application stack for web server with MySQL backend. This website runs on top of LAMP Server. On this website, you can also read another tutorial to install LAMP Server on Fedora 27 and Fedora 26.

You can also check my Fedora Tutorials collection.

Steps to Install LAMP Server on Fedora 28

Step 1. Update Fedora 28

It is advisable to always update Fedora prior to LAMP Server installation. Use the following command to update Fedora

dnf update

Step 2. Install Apache web server

First, we are going to install Apache web server.

dnf install httpd


[root@localhost ~]# dnf install httpd
Fedora Modular 28 – x86_64 – Test 227 kB/s | 712 kB 00:03
Fedora 28 – x86_64 – Updates 179 kB/s | 6.0 MB 00:34
Last metadata expiration check: 0:00:00 ago on Thu 10 May 2018 06:23:19 PM JST.
Dependencies resolved.
Package Arch Version Repository
httpd x86_64 2.4.33-5.fc28 updates 1.2 M
Installing dependencies:
apr x86_64 1.6.3-5.fc28 fedora 124 k
apr-util x86_64 1.6.1-5.fc28 fedora 104 k
brotli x86_64 1.0.1-3.fc28 fedora 316 k
fedora-logos-httpd noarch 28.0.3-1.fc28 fedora 34 k
httpd-filesystem noarch 2.4.33-5.fc28 updates 27 k
httpd-tools x86_64 2.4.33-5.fc28 updates 86 k
mod_http2 x86_64 1.10.20-1.fc28 updates 145 k

Transaction Summary
Install 8 Packages

Total download size: 2.1 M
Installed size: 6.4 M
Is this ok [y/N]:

Once the installation complete, we need to start the web server and test it.

systemctl start httpd
systemctl enable httpd

Now modify the firewall to allow http and https traffic

firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
firewall-cmd --reload

Now open web browser from other computer and type the Fedora 28 server IP address. You should see the following page.

fedora 28 lamp server.png

At this point, our web server is up and running.

Step 3. Install MySQL/MariaDB Server

To install MariaDB on Fedora 28, use this command instead

dnf install mariadb-server

Now start and enable Mariadb

systemctl start mariadb
systemctl enable mariadb

Now secure Mariadb


You will be asked to change the current Mysql root password (empty). Follow the steps shown on your screen.

[root@localhost ~]# mysql_secure_installation


In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
… Success!

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
… skipping.

By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Now allow Mariadb connection through firewall

firewall-cmd --add-service=mysql --permanent
firewall-cmd --reload

Step 4. Install PHP

Now lets install PHP on Fedora 28

dnf install php php-mbstring php-pear

It will download and install PHP on your sytem. Wait until it complete.

Now, we have Apache, MariaDB and also PHP install and running on our Fedora 28. I hope you enjoy my tutorial and see you next time.

1 Comment

Leave a Reply