How to install Apache 2.4 in CentOS 6

SystemMen - In this article, I will show you how to install Apache 2.4 in CentOS 6.10.

By default, CentOS 6.10 (Final) only supports Apache 2.2.15-69.el6.centos. If you want to use the newer version of Apache, you need to do some things.

Install necessary repositories

First, we will when EPEL, this is the repository that we will use very often.

[root@centos6 ~]# yum update -y && yum install epel-release -y

Next, if you find the Apache 2.4 installation package on the CentOS repository as in this link, you will find it belongs to the CentOS SCLo RH x86_64 repository.

To install this repository, type the command below.

[root@centos6 ~]# yum install centos-release-scl-rh -y

Install and use Apache 2.4

After we have added the required repositories, we now type the command below to install Apache 2.4.

Install Apache 2.4 in CentOS 6.10

[root@centos6 ~]# yum --enablerepo=centos-sclo-rh install httpd24 -y

After installation is complete, if you type the command httpd -V as usual, you will get the following error.

[root@centos6 ~]# httpd -V
bash: httpd: command not found
how-to-install-apache-2-4-in-centos-6 How to install Apache 2.4 in CentOS 6
Install Apache 2.4 in CentOS 6.10.

You need to load the environment of scl to be able to use its command line. Type the command below.

[root@centos6 ~]# scl enable httpd24 bash

Now, try typing the httpd -V command again. The Apache version at the time of this article is 2.4.34.

[root@centos6 ~]# httpd -V
Server version: Apache/2.4.34 (Red Hat)
Server built:   Nov 16 2018 12:58:22
Server's Module Magic Number: 20120211:79
Server loaded:  APR 1.5.1, APR-UTIL 1.5.4
Compiled using: APR 1.5.1, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D HTTPD_ROOT="/opt/rh/httpd24/root/etc/httpd"
 -D SUEXEC_BIN="/opt/rh/httpd24/root/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/opt/rh/httpd24/root/var/run/httpd/"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

Use Apache 2.4 after installation complete

If you list the init.d directory, you will find the httpd24-httpd file, which is the service file of Apache 2.4.

[root@centos6 ~]# ls /etc/init.d/
cgconfig   halt                  iptables    netfs    restorecond  udev-post
cgred      httpd24-htcacheclean  killall     network  sandbox
functions  httpd24-httpd         netconsole  rdisc    single

First, we need to enable the auto start service after the server reboots.

[root@centos6 ~]# chkconfig httpd24-httpd on

Next, you start Apache service up.

[root@centos6 ~]# service httpd24-httpd start
Starting httpd: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to suppress this message
                                                           [  OK  ]

And finally, check the service is working or not.

[root@centos6 ~]# service httpd24-httpd status
httpd (pid  618) is running…


For this article, I’m sure you can successfully install Apache 2.4. As for using it, you need to read more documents on the Apache website, I cannot present it all in one article.

«« »»