Compiling Apache 2.4.16 64bit for Linux with ssl and all available modules
# for i in download sandbox; do mkdir $i; done;
# yum install gcc
# export CC=gcc
# export CFLAGS=-m64
# export CPP_FLAGS=-m64
Get the packages :
----------------
# cd download/
# for i in bz2 bz2.asc; do wget http://archive.apache.org/dist/apr/apr-1.5.1.tar.$i; done;
# for i in bz2 bz2.asc; do wget http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.$i; done;
# wget http://archive.apache.org/dist/apr/KEYS
# gpg --import KEYS
# gpg --verify apr-1.5.1.tar.bz2.asc apr-1.5.1.tar.bz2
# gpg --verify apr-util-1.5.3.tar.bz2.asc apr-util-1.5.3.tar.bz2
# wget --no-check-certificate https://sourceforge.net/projects/pcre/files/pcre/8.30/pcre-8.30.tar.gz.sig
# wget --no-check-certificate https://sourceforge.net/projects/pcre/files/pcre/8.30/pcre-8.30.tar.gz
# gpg --verify pcre-8.30.tar.gz.sig pcre-8.30.tar.gz
# wget --no-check-certificate https://archive.apache.org/dist/httpd/httpd-2.4.16.tar.gz
# wget --no-check-certificate https://archive.apache.org/dist/httpd/httpd-2.4.16.tar.gz.asc
# wget --no-check-certificate https://archive.apache.org/dist/httpd/KEYS
# gpg --import KEYS
# gpg --verify apr-1.5.1.tar.bz2.asc apr-1.5.1.tar.bz2
Uncompress the packages and check the result :
--------------------------------------------
# for i in `ls *.gz`; do gunzip $i; done; ls -ltr; for j in `ls *.tar`; do tar -xvf $j; done; ls -ltr
# for i in apr-util-1.5.3 apr-1.5.1; do bunzip2 $i.tar.bz2; tar xvf $i.tar; done;
# for i in pcre-8.30 apr-util-1.5.3 httpd-2.4.16 apr-1.5.1; do chown -R root:root $i; done; ls -ltr
Compile PCRE :
------------
# cd pcre-8.30
# ./configure --prefix=/opt/pcre --disable-cpp
# make
# make install
Move source of APR to the Apache source files :
---------------------------------------------
# cd /root/download/
# mv apr-util-1.5.3 httpd-2.4.16/srclib/apr-util
# mv apr-1.5.1 httpd-2.4.16/srclib/apr
Compile Apache :
--------------
# cd httpd-2.4.16
# export LIBS=-lpthread
# ./configure --enable-module=so --prefix=/opt/apache2416 --with-included-apr --with-pcre=/opt/pcre --enable-ssl=shared --enable-mods-shared=all
# make
# make install
Then you test it :
----------------
# /opt/apache2416/bin/apachectl start
Open a browser and try to reach the machine on port 80, you should see in browser "It works !".
Great tip ! thank you Patrick.
2 remarks :
1. need to do the following when uncopressing the package:
#bzip2 -d apr-1.5.1.tar.bz2
#bzip2 -d apr-util-1.5.3.tar.bz2
2. change prefix to prefix=/opt/apache2.4 when compiling as prefix=/root/sandbox/apache2.4 you will have permission issues on /root.