Install LAMP on Fedora

Install LAMP on Fedora

dnf install mariadb-serverdnf install mariadb-serverSo, I have a old MacBook lying around, the hard drive had died, literally, couldn’t even boot it.

So I got myself a 500GB hard drive and stuck it in it. I initially tried to install Linux Mint on it, but later thought I would stick Fedora on it.

I wanted to be able to build sites, offline so needed a localhost.

To do this I followed the following directions…

Install LAMP webserver

First of all LAMP stands for Linux, Apache, MySQL/MariaDB and PHP

Although not ideal, I find the easiest way of installing anything from the terminal is to change to the root. So first of all open your terminal:

Type into the terminal:

sudo su

Stick in your password:

This will now show you are in the root.

Now we can install the server. First run:

dnf update

Type in y and hit enter.

Now we can install the httpd run

dnf install httpd

You will get:

Hit y and enter:

You will get complete, it has been installed. We now need to configure the Apache so it automatically turns on on set up.

Run the following one at a time:

$ systemctl enable httpd.service
$ systemctl start httpd
$ systemctl status httpd

You will be presented with:

This shows at the end of mine that it is at the end:

I need to get out of this, to do this I simply clicked Ctrl and C and it seemed to escape from it.

So now we need to ensure that other computers can see your local server, to do this run the following one at a time:

$ sudo firewall-cmd –permanent –add-service=http
$ sudo firewall-cmd –permanent –add-service=https
$ sudo systemctl reload firewalld

When I did this they were already enabled for some reason.

Now we will see is Apache is running, type the following in your terminal:

$ ip a | grep inet

You will see something like:

What you are interested in is the line that has been highlighted

Copy the IP address into your browser:

The default Apache folder is:


Install MariaDB

MariaDB is one of the most popular database servers. Made by the original developers of MySQL. Guaranteed to stay open source.

To install MariaDB (my preferred Database) in your terminal, run:

dnf install mariadb-server

You will get:

Hit y and enter, go any get a beer or coffee.

Once installed, we need to enable MariaDB, run each line on its onwn:

# systemctl enable mariadb
# systemctl start mariadb
# systemctl status mariadb

To escape press ctrl and c.

Now we need to secure the database.


# mysql_secure_installation

You will get:

At the moment I don’t have a password so will just hit enter:

Hit Y, and enter a secure password that you will remember, hit enter:

You now want to remove the anonymous users now, so hit y and and enter:

Hit Y so only root can access the database:

you guessed, unless you really want it, delete the test database:

Now hit y and enter to reload the privileges:

The database is all installed.

Install PHP

Now lets install PHP, in your terminal run:

# dnf install php php-common

Hit Y and enter:

Now we need to install the modules to run PHP and MariaDB together. Run:

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

Hit Y and enter.

Now we need to restart Apache, run:

# systemctl restart httpd

Now to make sure everything is working I am going to create a phpinfo page.

To change the director run:

# cd /var/www/html/

Then the following to create the page:

# nano info.php


Add the code:


To save press Ctrl O, then to exit, Ctrl X.

Now navigate to your info page using:


Job done, you deserve a beer!


Please Login to Comment.