This is a simple guide on how to configure Apache from source in Centos 6.7 + installing APR, APR-UTIL and PCRE to make it work.
Step 1. Install gcc:
Open up your terminal window and type the following command:
yum install gcc gcc-c++
Now, change to following directory:
cd /usr/src/
Step 2: Download and configure APR :
To download the APR file, use the below command:
wget http://a.mbbsindia.com//apr/apr-1.5.2.tar.gz
Now extract the downloaded file:
tar -zxvf apr-1.5.2.tar.gz
Change to the extracted folder and run the following commands to configure apr:
cd apr-1.5.2
./configure –prefix=/usr/src/apr
make
make install
Step 3. Download and configure apr-utils:
Change to following /usr/src/ directory:
cd /usr/src/
To download the APR-UTIL file, use the below command:
wget http://mirror.fibergrid.in/apache//apr/apr-util-1.5.4.tar.gz
To extract file, change to extracted folder and to configure apr, run the following commands:
tar -zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure –prefix=/usr/src/apr-util –with-apr=/usr/src/apr/
make
make install
Step 4. Download and config PCRE:
Change to /usr/src/ directory:
cd /usr/src/
To download pcre2-10.21.tar.gz type the following your terminal:
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.gz
To extract file, change to extracted folder and to configure pcre2-10.21, run the following commands:
tar -zxvf pcre2-10.21.tar.gz
cd pcre2-10.21
./configure –prefix=/usr/src/pcre2
make
make install
Step 5. Download Apache / httpd:
Now, change to following directory:
cd /usr/src/
To download httpd tar ball type the following your terminal:
wget http://a.mbbsindia.com//httpd/httpd-2.4.18.tar.gz
To extract file, change to extracted folder and to configure httpd, run the following commands:
tar -zxvf httpd-2.4.18.tar.gz
cd httpd-2.4.18
./configure –prefix=/usr/local/apache2 –with-apr=/usr/src/apr –with-apr-util=/usr/src/apr-util –with-pcre=/usr/src/pcre2/bin/pcre2-config
make
make install
Step 6. Start and test your apache server
service httpd start
httpd -v
You can also open your browser and go to:
And it should give you the Apache Welcome page.
And Voila! You have successfully configured apache from source. Hope this helps!
[DISCLAIMER: This guide is strictly for the purpose of learning how to configure apache from source for beginners. This should not to be used in a real production server as no security measures has been discussed or implemented in this tutorial.]
If you liked this article, do leave a comment below. You can also share this article by clicking on the social media buttons below.
Source: Apache, Troubleshooting source: APR troubleshooting
Apache Web Server (httpd/apache2) does not actually compile under RHEL 6 with pcre2. There is a specific requirement on pcre.h which is not compiled when you build pcre2. You have to use pcre <= 8.42. I would guess that the machine that you ran your test on either had a pre-existing system-level dependency on pcre or somehow or another pcre.h exists in your include path.