How to install Apache 2.4 in CentOS 6

by Daniel Pham
Published: Updated:

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.

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.

You Might Be Interested In

To install this repository, type the command below.

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

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
install apache 2.4 in centos 6.10
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.

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_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -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/httpd.pid"
 -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.

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 172.17.0.2. 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...

Conclusion

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.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.