Atlantic.Net Blog

How to Install Linux, Apache, MySQL and PHP (LAMP) on a Fedora 20 Cloud Server

Verified and Tested 02/27/15

Introduction

In this How-To, we will walk you through the install LAMP on your Fedora 20 Cloud Server. LAMP is simply a software bundle that consists of 4 components. L (Linux) is the core of the platform, which will sustain the other components. A(Apache)will be used for the web service. M(MySQL)will be used for database management, and P(PHP) will be the programming language. It is making the platform a LAMP.


In This Article

Install Lamp on Fedora 20

To install lamp, the first thing we need to do is install Apache with the following command:

yum install httpd

Start Apache with the following command:

systemctl start httpd.service

You will want the Apache service to start on start-up/reboot with the following command:

systemctl enable httpd.service

Add the following commands in Apache to override in Firewall-cmd as follows:

firewall-cmd --set-default-zone=public
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

You can now verify that Apache is installed correctly by typing http:// and your IP on your browser.

http:// YOUR.IP.ADD.RESS

You should see the following screenshot in your browser:

Default apache test page

Default apache test page

You can edit the main configuration file to your preference for one or many websites with the following commands:

vi /etc/httpd/conf/httpd.conf

or

nano /etc/httpd/conf/httpd.conf

Un-comment the line containing the text NameVirtualHost *:80 and edit accordingly

Save the file

Restart the Apache HTTP

systemctl restart httpd.service

Install MySQL with the following command to begin the install:

yum install mysql mysql-server

Start the service with the following command:

systemctl start mysqld.service

Enable MySQL to start upon a reboot with the following command:

systemctl enable mysqld.service

Secure MySQL with the following command:

mysql_secure_installation

Note: When prompted with “Enter current password for root,” hit enter for none then Y(Yes) to set the MYSQL password. You will be prompted with a series of questions. Type Y for yes on all of them; see the screenshot below:

Follow the on screen prompts and respond accordingly.

Mysql Secure Installation

Install PHP with the following command to begin the install:

yum install php

Restart apache to take all the changes:

systemctl restart httpd.service

Create a test PHP file in the following directory with the following command:

sudo vi /var/www/html/info.php

Insert the following code in the space, then save and exit:

<?php
phpinfo();
?>

Restart Apache, so all the changes take effect:

sudo service httpd restart
Sample info.php output.

info.php

Test your page in your browser with the following hyperlink changed with your IP address:
http:// YOUR.IP.ADD.RESS/info.php

Congratulations! You have just installed LAMP on your Fedora 20 Cloud Server. Thank you for following along in this How-To, and check back with us for any new updates.

Learn more about our VPS hosting services and VPS hosting price.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year