How To Install LAMP (Linux, Apache, MySQL, PHP) on Fedora 22

Introduction

A LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the server is already running Fedora, the Linux part is taken care of. Here is how to install the rest.

Prerequisites

Before beginning this tutorail you should have a running Fedora 22 droplet and be logged in via SSH.

Setup

Before you start installing the LAMP programs, you should first download and install all of the updates with dnf update dnf replaced yum as the default package manager for Fedora in version 22:

sudo dnf update

Step One—Install Apache

Apache is a free open source software which runs over 50% of the world’s web servers.

To install apache, open terminal and type in this command:

sudo dnf install httpd

Once it installs, you can start apache running on your VPS:

sudo systemctl start httpd.service

That’s it. To check if Apache is installed, direct your browser to your server’s IP address (eg. http://12.34.56.789). You should see the default Fedora page

How to find your Droplet’s IP address

You can run the following command to reveal your server’s IP address.

ifconfig eth0 | grep inet | awk '{ print $2 }'

Step Two—Install MySQL

MySQL/MariaDB is a powerful database management system used for organizing and retrieving data on a virtual server

Then the prompt will ask you if you want to set a root password. Go ahead and choose Y and follow the instructions.

Fedora automates the process of setting up MySQL, asking you a series of yes or no questions.

It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.

<pre>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] Y
... Success!
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.
Thanks for using MariaDB!

Step Three—Install PHP

PHP is an open source web scripting language that is widely used to build dynamic web pages.

To install PHP on your virtual private server, open terminal and type in this command:

sudo dnf install php php-mysql

Once you answer yes to the PHP prompt, PHP will install itself.

PHP Modules

PHP also has a variety of useful libraries and modules that you can add onto your server. You can see the libraries that are available by typing:

dnf search php-

The terminal then will display the list of possible modules. The beginning looks like this: