Table of Contents
Introduction
This how-to will help you with your LAMP installation in Fedora 21 so that you can successfully run a high available solid platform for your web environment. LAMP is simply a software bundle that consists of 4 components that work together to form a powerful web server. However, in this setup the acronym’s are as follows: 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 used as the programming language. Making the platform a LAMP.
Prerequisites
You need a Fedora21 server that is configured with a static IP address. If you do not have a server already, you can spin up a SSD virtual private server in under 30 seconds.
Install LAMP
To get started, login to your Fedora21 server via SSH or the VNC Console in cloud.atlantic.net. Atlantic.Net Cloud servers are setup as minimal installations in order to avoid having unnecessary packages from being installed and never used. Because of this, let’s make sure that your server is fully up-to-date.
yum update
With the server up-to-date, we can continue the process and secure your server.
Install Apache
We must first begin by installing Apache with the following command:
yum install httpd
Start the Apache service with the following command:
systemctl start httpd.service
You will also want the Apache service to start upon start-up/reboot with the following command:
systemctl enable httpd.service
Add the following commands in Apache to override the 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 address on your browser.
http://YOUR.IP.ADD.RESS
This is the default webpage when installing Apache on a Fedora21 LAMP Stack Server
To edit the main Apache configuration file for one or many websites according to your preference, enter one of the following:
vi /etc/httpd/conf/httpd.conf
or
nano /etc/httpd/conf/httpd.conf
Un-comment the line containing the text #ServerName www.example.com:80 and edit accordingly with your domain or IP Address of the server.
Save the file
Restart the Apache HTTP service so the changes take affect.
systemctl restart httpd.service
Install MySQL
We then want to continue installing MySQL with the following command:
yum install mysql mysql-server
Start the MySQL service with the following command:
systemctl start mysqld.service
You will also want the MySQL service to start upon start-up/reboot with the following command:
systemctl enable mysqld.service
To ensure the security of the default settings of MySQL, continue with the next command:
mysql_secure_installation
Note: When prompt with “Enter current password for root” hit enter for none then Y(Yes) to set MYSQL password. You will be prompt with a series of questions. Simply type Y for yes on all of them, see the screen shot below:
This is the default webpage when installing MySQL on a Fedora21 LAMP Stack Server
Install PHP
Finally we will conclude the installing PHP with the following command:
yum install php
Restart the Apache HTTP service so the changes take affect.
systemctl restart httpd.service
In order to test and verify this installation create a test PHP file in the directory below with the following command:
sudo nano /var/www/html/info.php
Insert the following PHP code in the empty space then save and exit:
<?php phpinfo(); ?>
Restart the Apache HTTP service one last time so all the changes take affect.
sudo systemctl enable httpd.service
You can now verify that PHP is installed correctly by typing the following on your browser.
http://YOUR.IP.ADD.RESS/info.php
This is the default webpage when installing PHP on a Fedora21 LAMP Stack Server
What Next?
Congratulations! You now have a server with a LAMP platform for your web environment. Thank you for following along and feel free to check back with us for further updates.