CyberKeeda In Social Media

Install Apache 2.4 on Centos / RHEL 6 from Source Code



Apache 2.4 is not shipped within RHEL / Centos 6.XX and even it's not within RHN or Centos central repository.

The best way is to download the tar ball and compile it within your host, since if you are installing it for your firm obviously It might be not allowed to directly download packages from internet.


Requirement / Dependencies

Even installation of apache from tarball needs two utilty , make sure both are installed within your server/host to proceed ahead

Apache Portable Runtime Packages.

  1. apr
  2. apr-util
  3. distache
  4. distache-devel
Download and install it one by one, as all are dependencies of one another, take a chill pill and go ahead.

Download APR packages from - http://apr.apache.org/
Download Distache packages from the link - Download
Download the apache tarball from apache's official website

Build and install the APR packages

[root@localhost]# mkdir -p /usr/local/httpd-build
Move and extract the apr packages into it.
Then execute the below mentioned command
[root@localhost httpd-build]# rpmbuild -tb apr-1.5.1.tar.bz2
[root@localhost 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
RPM packages are written to /root/rpmbuild/RPMS/ folder when built. We will only install apr-util and apr-util-devel packages necessary for Apache 2.4.9 build.
[root@localhost httpd-build]# rpmbuild -tb apr-util-1.5.3.tar.bz2
[root@localhost 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
While installing APR packages, if it shows dependencies of dustache packages , download and install the rpms provide din the above link.

Once APR packages were installed, we can proceed ahead with the installation of Apache 2.4.X

Extract the Apache 2.4 tarball downloaded from above provided link.

[root@localhost httpd-build]# tar -xvf httpd-2.4.xx
[root@localhost httpd-build]# cd httpd-2.4.xx

Configure.

[root@localhost httpd-build] ./configure --prefix=PREFIX
If it shows any error or you are not sure to add prefixes within it, go with default configuration by removing prefixes
[root@localhost httpd-build] ./configure

Compile

[root@localhost httpd-build] make

Install

[root@localhost httpd-build] make install

If all done successfully without any error, you are done with the installation.

Default Directory

[root@localhost httpd-build] cd /usr/local/apache2/

Customize

[root@localhost httpd-build] vim /usr/local/apache2/conf/httpd.conf

Test

[root@localhost httpd-build] sh /usr/local/apache2/bin/apachectl -k start
Go to your browser and hit http://localhost or http://your ip address
If all set you will get a page saying.

It Works !


Do comment, in case you ge any error while installing Apache 2.4, next blog post will be helpfull to you as it is relevant with Apache 2.4..
Installation of PHP 5.6 on Centos/RHEL 6

1 comment:

  1. do the APR works, if i download it and install as a RPM package ?

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...
Designed By Kunal Saha