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
  • Michael

    Hi! thanks very much! i got few error during a build so i D?Led reary rpms

    any ideas how to install prebuild php on this new apache ? for eamxple from remi or webtatic ? as they are demanding older apache 🙁

  • James

    I used your 64 bit complete package and received some dependency rerequirements.

    expat-devel is needed by apr-util-devel-1.5.3-1.x86_64
    libsybdb.so.5()(64bit) is needed by apr-util-freetds-1.5.3-1.x86_64
    libodbc.so.2()(64bit) is needed by apr-util-odbc-1.5.3-1.x86_64
    libpq.so.5()(64bit) is needed by apr-util-pgsql-1.5.3-1.x86_64
    libtool is needed by httpd-devel-2.4.9-1.x86_64
    libdistcache.so.1()(64bit) is needed by mod_socache_dc-2.4.9-1.x86_64
    libnal.so.1()(64bit) is needed by mod_socache_dc-2.4.9-1.x86_64

    installed everything else and 2.4.9 works fime on ceintos 6.5

    • Andrew

      I also ran into these dependency issues. James, did you figure out how to resolve them?

      • Mitch

        Hello Andrew, i will test it out tommorow and try to provide you with the solution. Regards, Mitch

    • Mitch

      Hello James, as i said to Andrew, i will test it out tommorow and try to provide you with the solution. Regards, Mitch

  • ffs

    followed instruction and installed perfect. The only problem is php is not working anymore and yum install php shows dependency error. can’t install php. Thanks for the post anyway.

  • Michael Baldwin

    Getting this error when starting httpd, downloaded your complete builds, centos 6.5
    Starting httpd: /usr/sbin/httpd: symbol lookup error: /usr/sbin/httpd: undefined symbol: apr_crypto_init [FAILED]

    • Mitch

      Hi Michael, did you install apr-util? Regards, Mitch

      • Michael

        thought I did, but I started over with a clean install of CentOS 6.5 minimal, and it worked this time.
        Thanks for a great tutorial.

  • Matin

    Dear
    Thanks for this post
    Php web pages not working can u suggest witch php version should I use ? I have checked with php 5.5.13 with rpm file not working

    But when I used source files and compiled with apache then its working fine.

    I wanted php with rpm installation and auto compile with apache 2.4.9 so plz me on same

  • Mr..OKEK

    Hi *.*
    nice Guide, but wrong of end Guide!
    httpd-2.4.9-RPM-full.x86_64.tgz this packages is not Source-RPM-Files!
    Please Full-Install-Guide within httpd-2.4.9-RPM-full.x86_64.tgz – Files?

    with thanks ahead… 🙂

    With best regards
    Mr. OKEK

  • Pingback: SSL Library Error: error:0906D06C:PEM - GeekPeek.Net()

  • scotthallett

    Greetings, thank you for a great post.

    Quick question – what if you want multiple RPMs of different versions at custom locations (for testing) – such as:

    /usr/local/httpd-2.4-worker
    /usr/local/httpd-2.4-prefork
    /usr/local/httpd-2.4-prefork-with-php-5.3
    /usr/local/httpd-2.4-prefork-with-php-5.4
    etc…

    I know when doing a standard build, you can use the –prefix-/usr/local/httpd-2.4-worker option when configuring – but not sure how when making an RPM.

    Also, everything is built into the rpm – so I only need the following .rpm for my other (minimal) boxes:

    httpd-2.4.10-1.i386.rpm
    httpd-tools-2.4.10-1.i386.rpm
    apr-1.5.1-1.i386.rpm
    apr-util-1.5.4-1.i386.rpm

    Correct?

    Thanks again!