Share, , Google Plus, Pinterest,

Print

Posted in:

Build Apache 2.4.9 RPM on CentOS 6

We all know Apache HTTP Server. Apache is de-facto web server on UNIX-like systems and is maintained by an  open community of developers of the Apache Software Foundation. Apache HTTP Server is released under the Apache License and is an open-source software.

The problem with Apache HTTP Server on CentOS and other RHEL based distros is, that it is hard to find a stable release Apache 2.4.X version RPM out there. CentOS and RHEL official repositories only offer legacy version (currently 2.2.15) of Apache HTTP Server. I even could not find an Apache 2.4.X version RPM from EPEL of RPMForge, so i decided to put the latest available version of Apache HTTP Server out there!

Apache 2.4.9 RPM
Apache 2.4.9 RPM

Read this guide on how to build latest Apache 2.4.9 RPM package or scroll to the bottom of this page and download a already built Apache 2.4.9 RPM package and install it on your system!

This guide was written for an up-to-date CentOS 6.5 64bit minimal install with SELinux and IPtables disabled!

Let’s start Build Apache 2.4.9 RPM on CentOS guide!

1. Install RPMForge Repository

[root@centos1 httpd-build]# rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

2. Install Required Software and Dependencies

This is the software needed to install and satisfy all of the dependencies to build Apache HTTP Server 2.4.9 and Apache Portable Runtime. If you do not want to install all of these packages on your system please scroll to the bottom of this page and download a pre-built Apache 2.4.9 RPM.

[root@centos1 ~]# yum install wget rpm-build autoconf zlib-devel libselinux-devel libuuid-devel pcre-devel openldap-devel lua-devel libxml2-devel distcache-devel openssl-devel apr-devel postgresql-devel mysql-devel sqlite-devel freetds-devel unixODBC-devel nss-devel distcache-devel expat-devel db4-devel mailcap libtool doxygen

3. Download the latest Apache HTTP Server package

[root@centos1 ~]# mkdir httpd-build
[root@centos1 ~]# cd httpd-build/
[root@centos1 httpd-build]# wget http://www.apache.si/httpd/httpd-2.4.9.tar.bz2

4. Download the latest Apache Portable Runtime packages

Apache 2.4.9 requires Apache Portable Runtime to be higher that 1.4.0 which unfortunately is not available from official CentOS repositories.

[root@centos1 httpd-build]# wget http://www.apache.si/apr/apr-1.5.1.tar.bz2
[root@centos1 httpd-build]# wget http://www.apache.si/apr/apr-util-1.5.3.tar.bz2

5. Download Distcache Source RPMs

Distcache packages are not so easy to find! 🙂 We shall download source RPMs from Fedora 18 repository and build RPMs.

[root@centos1 httpd-build]# wget http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Fedora/source/SRPMS/d/distcache-1.4.5-23.src.rpm

6. Rebuild and Install Distcache and Distcache-devel RPMs

RPM packages are written to /root/rpmbuild/RPMS/ folder when built. Watch out for architecture you are running and check the correct subfolder.

[root@centos1 httpd-build]# rpmbuild --rebuild distcache-1.4.5-23.src.rpm
[root@centos1 httpd-build]# rpm -Uvh /root/rpmbuild/RPMS/x86_64/distcache-1.4.5-23.x86_64.rpm /root/rpmbuild/RPMS/x86_64/distcache-devel-1.4.5-23.x86_64.rpm

7. Build and Install Apache Portable Runtime RPMs

RPM packages are written to /root/rpmbuild/RPMS/ folder when built. Watch out for architecture you are running and check the correct subfolder.

[root@centos1 httpd-build]# rpmbuild -tb apr-1.5.1.tar.bz2
[root@centos1 httpd-build]# rpm -Uvh /root/rpmbuild/RPMS/x86_64/apr-1.5.1-1.x86_64.rpm /root/rpmbuild/RPMS/x86_64/apr-devel-1.5.1-1.x86_64.rpm

8. Build and Install Apache Portable Runtime Util RPMs

RPM packages are written to /root/rpmbuild/RPMS/ folder when built. Watch out for architecture you are running and check the correct subfolder. We will only install apr-util and apr-util-devel packages necessary for Apache 2.4.9 build.

[root@centos1 httpd-build]# rpmbuild -tb apr-util-1.5.3.tar.bz2
[root@centos1 httpd-build]# rpm -Uvh /root/rpmbuild/RPMS/x86_64/apr-util-1.5.3-1.x86_64.rpm /root/rpmbuild/RPMS/x86_64/apr-util-devel-1.5.3-1.x86_64.rpm

9. Build Apache 2.4.9 RPM packages

We have finally satisfied all of the Apache dependencies and can build Apache 2.4.9 RPM package.

[root@centos1 httpd-build]# rpmbuild -tb httpd-2.4.9.tar.bz2

10. Install Apache 2.4.9 RPM

We only want to install httpd, httpd-tools and mod_ssl 2.4.9 RPM packages on our system. If you like you can install additional.

[root@centos1 httpd-build]# rpm -ivh /root/rpmbuild/RPMS/x86_64/httpd-2.4.9-1.x86_64.rpm /root/rpmbuild/RPMS/x86_64/httpd-tools-2.4.9-1.x86_64.rpm /root/rpmbuild/RPMS/x86_64/mod_ssl-2.4.9-1.x86_64.rpm

11. Start Apache 2.4.9

We can finally start Apache 2.4.9 and check that it is running.

[root@centos1 httpd-build]# /etc/init.d/httpd start
                                                           [  OK  ]
[root@centos1 httpd-build]# netstat -anp |grep 80
tcp        0      0 :::80                       :::*                        LISTEN      2341/httpd
[root@centos1 httpd-build]# ps afx |grep httpd
 2432 pts/0    S+     0:00          _ grep httpd
 2341 ?        Ss     0:00 /usr/sbin/httpd
 2343 ?        Sl     0:00  _ /usr/sbin/httpd
 2344 ?        Sl     0:00  _ /usr/sbin/httpd
 2345 ?        Sl     0:00  _ /usr/sbin/httpd