LAMP Server (Apache / MariaDB /PHP) on Fedora 19+ and Centos/RHEL 7

LAMP is a combination of operating system and open-source software stack. The acronym LAMP comes from the first letters of Linux, Apache HTTP Server, MySQL/MariaDB database, and PHP, Perl or Python (and sometimes PhpMyAdmin too.)


Installing Apache

Change to root (if not root already) user using the following command:

and install apache using yum:

Enable the httpd service to start automatically

Then start httpd service

Adjust firewall to allow the httpd service to connect with remote clients.


Restart firewalld service:

Testing Apache:

Open up your browser and enter http://your-ip-address/ in the address bar. You will see the Apache default page.


Installing MariaDB

MariaDB is a drop in replacement for MySQL. It is a robust, scalable and reliable SQL server that comes rich set of enhancements. The default database in Fedora 19 is MariaDB.

Install it using the following command:

Enable mysqld service at boot time with following command:

And start mysqld service using command:

Set MariaDB root password:

By default mysql root user password is empty. So, to prevent unauthorized access to mysql databases, let us set a root user password:


Installing PHP

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

Install PHP with following command:

Test PHP:

Create a sample “testphp.php” file in Apache document root folder and append the lines as shown below:

Add the following lines:

Restart httpd service:

Now, navigate to http://server-ip-address/testphp.php. It will display all the details about PHP such as version, build date and commands etc.

Install PHP Modules:

Search for the available PHP modules using the following command:

Now install the required module of your choice, for example php-mysql, using the following command:

Restart the httpd service.

To verify the modules, open your web browser and navigate to http://server-ip-address/testphp.php. You will able to see the installed PHP modules.

2 thoughts on “LAMP Server (Apache / MariaDB /PHP) on Fedora 19+ and Centos/RHEL 7”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.