skip to Main Content

In this article, I’ll be showing you how to install Apache 2.4, MariaDB 10.1, and PHP 5.6 on CentOS 7.1.1503. This article assumes you are running a fresh installation of CentOS 7.1, and that you have not yet configured any services.

 

1. Upgrade CentOS 7.1

 

As always, with any freshly installed system, let’s upgrade the kernel and any other packages that may need updating.

yum -y upgrade

Once the upgrade has completed, restart your system to apply any upgraded kernels.

shutdown -r now

Once your system is back online, we can move on to the next step.

 

2. Install EPEL/Remi Repositories

 

Install the EPEL and Remi repositories to enable access to PHP 5.6.

rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

Enable the REMI repository globally:

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

Under the section that looks like [remi] make the following changes:

[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

Also, under the section that looks like [remi-php55] make the following changes:

[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
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Type CTRL-O to save and CTRL-X to close the editor

 

3. Install the Official MariaDB Repository

Install the Official MariaDB repository to get the latest version of MariaDB, and keep it up-to-date with yum updates.

 

Type in the following to add the MariaDB repository to your system:

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

Next, you need to copy and paste the following content into the editor:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Type in CTRL-O to save, and CTRL-X to exit

 

3. Install Apache 2.4.6, MariaDB 10.1, and PHP 5.6.

 

Now we can install the actual Apache, MariaDB, and PHP packages:

yum install mariadb-client mariadb-server httpd php

Start Apache 2.4.6, and configure it to start on boot:

systemctl start httpd.service
systemctl enable httpd.service

Add the firewall rules to open up ports 80 and 443

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

Start MariaDB 10.1, and configure it to start on boot:

systemctl start mysql.service
systemctl enable mysql.service

Make sure to run mysql_secure_installation after installing MariaDB 10.1. We’l be posting a detailed guide on How to Install MariaDB 10.1 on CentOS 7.1.

That’s it!

 

I hope you found this guide useful, Please leave any comments, suggestions, or questions in the box below.

Sponsored Links
This Post Has One Comment

Don't be shy, leave a reply!