Monday, October 6, 2014

Compiling Apache from source

Compiling Apache from source 

Hello Friends welcome back again on my blog today I will explain how to compile  the Apache web server from source as its recommended to compile the software from source .

 1. Download the latest and greatest version of apache from the site:
     
     wget http://mirror.sdunix.com/apache//httpd/httpd-2.4.10.tar.gz

2. then extract the source using

 #  tar -xzvf httpd-2.4.10.tar.gz

3. Install the  pre-requisites using the yum utility

# yum install gcc* openssl openssl-devel

4. then changing the directory to the Apache source directory

# cd  httpd-2.4.10

5. configure the Apache source with default modules and Apache configuration directory
 #./configure --prefix=/usr/local/httpd

6.While configuring, we get below error

Error:
checking for APR… configure: WARNING: APR version 1.4.0 or later is required, found 1.3.9

configure: WARNING: skipped APR at apr-1-config, version not acceptable

Solution: 
We need to install apr and apr-util packages to resolve this issue.
Download apr and apr-util packages from

# wget http://mirror.olnevhost.net/pub/apache//apr/apr-1.5.1.tar.gz

# tar xvzf apr-1.5.1.tar.gz

# cd apr-1.5.1

# ./configure –prefix=/usr/local/src/httpd-2.4.10/srclib/apr

# make && make install

For apr-util package

# wget http://mirror.olnevhost.net/pub/apache//apr/apr-util-1.5.4.tar.gz

# tar -xzvf  apr-util-1.5.4.tar.gz

#./configure –prefix=/usr/local/src/httpd-2.4.10/srclib/apr-util

# make && make install

Now configure the Apache

./configure --prefix=/usr/local/httpd --enable-mods-shared=all --with-apr=/usr/local/src/httpd-2.4.10/srclib/apr/bin/apr-1-config --with-apr-util=/usr/local/src/httpd-2.4.10/srclib/apr-util/bin/apu-1-config

We will face an Error...

But, while configuring this we may get below error

Error:

checking for pcre-config… false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

Solution:

pcre package needs to be installed to resolve this issue.

Download pcre:

# wget http://sourceforge.net/projects/pcre/files/latest/download?source=files

pcre-8.33.tar.bz2 will be saved

To extract:

# tar jxf pcre-8.33.tar.bz2

# cd pcre-8.33


Now configure pcre with:

Now configure pcre with:

# ./configure –prefix=/usr/local/pcre

# make

# make install

Now configure it again

# ./configure –prefix=/usr/local/http –enable-mods-shared=all –with-apr=/usr/local/src/httpd-2.4.10/srclib/apr –with-apr-util=/usr/local/src/httpd-2.4.10/srclib/apr-util –with-pcre=/usr/local/pcre/

# make

# make install


This is how apache can be installed with source.

Now start and stop services by

/usr/local/apache/bin/apachectl start/stop

Check the apache homepage with http://serverIP/ or http://localhost/

It displays the file which is set for default document root.


No comments:

Post a Comment