HugeServer Blog

Updates and News about HugeServer !

How to Install Apache 2.2, PHP 5.6, MySQL 5.7 on CentOS 6

Today I am going to teach you the easiest way of installing a Webserver with Apache, PHP, and MySQL.

We are going to use Epel and Remi repositories on CentOS and configure our server. First of all, we should find the latest version of Epel and Remi packages from their sites :

http://dl.fedoraproject.org/pub/epel/6/x86_64/
http://rpms.famillecollet.com/enterprise/

After it, we will download the packages on our system and install them on the server.

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm epel-release-6-8.noarch.rpm

After these packages are installed completely, we should activate these repositories on Yum configuration file.

nano /etc/yum.repos.d/remi.repo

Make sure that “[remi]” and “[remi-php56]” are enabled. It should look like as following.

[remi]
name=Remi’s RPM repository for Enterprise Linux 6 – $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php56]
name=Remi’s PHP 5.6 RPM repository for Enterprise Linux 6 – $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# NOTICE: common dependencies are in “remi-safe”
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

We have to save the file and then edit the Epel repository to make sure it is enabled too.

nano /etc/yum.repos.d/epel.repo

It should be enabled as following :

[epel]
name=Extra Packages for Enterprise Linux 6 – $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

Now we can start to install PHP, apache on our system.

yum clean all
yum update
yum install php php-mysql

After all these steps are done, we will install MySQL on our system.

wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
yum localinstall mysql57-community-release-el6-7.noarch.rpm
yum repolist enabled | grep “mysql.*-community.*”
yum install mysql-community-server

It is now fully installed, we will start all services and will confirm the installed versions.

service mysqld restart
mysql –version
service httpd restart
php -v
httpd -v

If you have any question, please add a comment and I will get you back.

Leave a Reply

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