Tuesday, 13 January 2015

Quick Start: Setup CentOS 7 as a LAMP Server

Quick Start: Setup CentOS 7 as a LAMP Server

In this tutorial, I'm going to show you simple steps using which you can setup your own LAMP (Linux-Apache-MySQL-PHP) on a CentOS 7 system.

CentOS 7 Minimal ISO
Make sure your system has a static IP address assigned to it and a fully qualified domain name.

System Details:
Base OS:        CentOS 7 64 Bit (Minimal ISO)
HOSTNAME:  master.cloud.com


Start by Installing a CentOS 7 system. You can refer THIS GUIDE for the same.

Once the base OS is ready, we now install the Apache web server package.

# yum install httpd

The httpd package downloads some additional dependencies as well. Hit "Y" and download all the required RPMs as shown.

Next, edit the "httpd conf" file

# vi /etc/httpd/conf/httpd.conf

In this file, you only need to edit at two places:

# Replace ServerAdmin root@localhost

# Replace ServerName localhost:80

NOTE: ServerName attribute is commented out by default, so remember to uncomment it out first.

Save and exit the editor once the changes are made.

Start and enable the httpd service

# systemctl start httpd

# systemctl enable httpd

Enable the HTTP port (Port 80) on the firewall and reload the firewall.

# firewall-cmd --permanent --add-port=80/tcp

# firewall-cmd --reload

Test your Web Server by typing in the CentOS system's IP address in a browser. You should see the following web page if your settings are done correctly.


Next up we install the MySQL Database. An important point to note here is that with CentOS 7, MariaDB is shipped as the default MySQL Engine unlike the earlier versions where MySQL was the de facto choice.

In this guide, I'll show you how to install both MariaDB and MySQL Server.

First off, its MariaDB

# yum install mariadb mariadb-server  

This will install the necessary DB packages for MariaDB, rest of the configuring steps remain the same for MySQL so I'll now show you how to install MySQL Community Edition on a CentOS 7 system.

First off, we download some prerequisites:

# yum install wget

Next, download the MySQL Community Release RPM using the following command:

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

Install the downloaded RPM

# rpm -ivh mysql-community-release-el7-5.noarch.rpm

The RPM installs two repos at /etc/yum.repos.d directory, both will be used to install the MySQL Community Server packages

Once prepped, you can now install the MySQL packages as required

# yum install mysql-server mysql 

Start and enable the MySQL service

# systemctl start mysqld

# systemctl enable mysqld

Run the mysql_secure_installation script to set the root password and other necessary parameters

# mysql_secure_installation

Test your MySQL server by logging on the DB:

# mysql -u root -p

The final install is PHP. Run the following command to install the basic PHP packages:

# yum install php php-mysql

Hit "Y" to download and install the packages

Next, create a simple file to test whether PHP was successfully installed or not

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

<?php phpinfo(); ?>
Restart the httpd service before you proceed.

# systemctl restart httpd

Open up a browser and type in the following. You should see the PHP info page as shown below:


Thats it for this post.. but stay tuned for much more coming your way soon..



Ayaz Alam said...

Very Nice Post

Best Software Training Institute in bangalore
Best SAP Training in bangalore
Best Advanced Excel Training in bangalore

kalai hai said...

I really enjoyed reading the Post. It was very informative and useful.Electrical Projects Center in Chennai | Electrical Projects Center in Velachery

giselle aga said...

Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
Java Training in Marathahalli

deepti said...

Wonderful blog..keep sharing...Diploma Projects Center in Chennai | Diploma Projects Center in Velachery

Gowri S said...

It has been just unfathomably liberal with you to give straightforwardly what precisely numerous people would've promoted for an eBook to wind up making some money for their end, basically given that you could have attempted it in the occasion you needed.
devops training in chennai

john kevin said...

I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

java training in bangalore

raina dhawan said...

It’s great to come across a blog every once in a while that isn’t
the same out of date rehashed material. Fantastic read.
dotnet training in bangalore

ijazz jazz said...

Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

Data Science Training in Chennai

Data Science Training in Bangalore

Obat Aborsi Manjur said...

Obat Aborsi ,
Obat Aborsi Ampuh ,
Obat Aborsi Asli ,
Jual Obat Aborsi ,
Obat Pelancar haid ,
Obat Telat datang Bulan ,
Obat Penggugur Kandungan ,
Pesan Cytotec Harga Obat Aborsi ,

Jual Obat Aborsi ,
Obat Aborsi ,
Jual Obat Penggugur Kandungan ,
Obat Penggugur Janin ,
Klinik Aborsi Janin Jakarta ,
Pesan Harga Obat Aborsi Tuntas ,
Order Cytotec Obat Aborsi ,

Post a Comment

Note: only a member of this blog may post a comment.