Compiling Apache from source files on a CentOS 7 system

I needed to recompile suexec on a CentOS 7 system which is running Apache 2.4.6, so that I could run a SMF forum, which uses PHP, from the account of the user maintaining the forum rather than having the forum software run from the system's apache account as I had done under a previous version of CentOS as noted in Using suexec to run PHP under a different account. I downloaded the httpd source code, i.e., the "source RPM", httpd-2.4.6-19.el7.centos.src.rpm, from the CentOS Mirror site. I then extracted the files from the source package using rpm -ivh package.

# rpm -ivh httpd-2.4.6-19.el7.centos.src.rpm 
   1:httpd                  warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root

I received a lot of "warning: group mockbuild does not exist - using root" messages, but those weren't of concern to me.

Using the httpd-2.4.6.tar.bz2 file in the /usr/src/redhat/SOURCES directory, I extracted its contents into a temporary directory.

[root@localhost temp]# ls /root/rpmbuild/SOURCES/httpd-2.4.6.tar.bz2
/root/rpmbuild/SOURCES/httpd-2.4.6.tar.bz2
[root@localhost temp]# cp /root/rpmbuild/SOURCES/httpd-2.4.6.tar.bz2 .
[root@localhost temp]# tar -jxvf httpd-2.4.6.tar.bz2

I made the needed changes to suexec.h in the support subdirectory. I then ran ./configure from the top level of the temporary directory where I had extracted the contents of the .bz2 file.

But when I ran .configure from the directory where I had unzipped the .bz2 file for Apache 2.4.6, I received an error message related to APR:

# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.

To resolve the problem, I followed the steps suggested by P.joel Nishanth Reddy at configure: error: APR not found. Please read the documentation. I downloaded the base portability library from Download - The Apache Portable Runtime Project. I opted to download the .bz2 version of the file, apr-1.5.2.tar.bz2 into the httpd-2.4.6/srclib directory with wget http://apache.mirrors.pair.com//apr/apr-1.5.2.tar.bz2 and extracted its contents with tar -jxvf apr-1.5.2.tar.bz2. A apr-1.5.2 subdirectory was created within the srclib directory. I renamed it to apr with mv apr-1.5.2 apr.

Then I used similar steps for APR-util, which provides a number of helpful abstractions on top of APR, which I also downloaded to the srclib directory.

wget http://mirrors.koehn.com/apache//apr/apr-util-1.5.4.tar.bz2
tar -jxvf apr-util-1.5.4.tar.bz2
mv apr-util-1.5.4 apr-util

I then ran ./configure again.

Generic Category (English)120x600
[root@localhost srclib]# cd ..
[root@localhost httpd-2.4.6]# ./configure

This time I got a lot further, but saw the following error message:

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

I attempted to install pcre, but found the package was already installed.

# yum install pcre
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.trouble-free.net
 * epel: mirror.cogentco.com
 * extras: mirror.umd.edu
 * updates: mirror.symnds.com
Package pcre-8.32-14.el7.x86_64 already installed and latest version
Nothing to do

So I looked for it on the system.

# locate pcre 
/usr/lib64/libpcre.so.1
/usr/lib64/libpcre.so.1.2.0
/usr/lib64/libpcre16.so.0
/usr/lib64/libpcre16.so.0.2.0
/usr/lib64/libpcre32.so.0
/usr/lib64/libpcre32.so.0.0.0
/usr/lib64/libpcrecpp.so.0
/usr/lib64/libpcrecpp.so.0.0.0
/usr/lib64/libpcreposix.so.0
/usr/lib64/libpcreposix.so.0.0.1
/usr/lib64/libreoffice/program/resource/pcren-US.res
/usr/share/doc/pcre-8.32
/usr/share/doc/pcre-8.32/AUTHORS
/usr/share/doc/pcre-8.32/COPYING
/usr/share/doc/pcre-8.32/ChangeLog
/usr/share/doc/pcre-8.32/LICENCE
/usr/share/doc/pcre-8.32/NEWS
/usr/share/doc/pcre-8.32/README
/usr/share/man/man3/clnt_pcreateerror.3.gz
/usr/share/man/man3/clnt_spcreateerror.3.gz

I thought perhaps I could specify the /usr/lib64 directory for pcre, but that only caused the ./configure process to terminate at the same point as before, but with a different error message regarding pcre.

# ./configure --with-pcre=/usr/lib64
...
checking for pcre-config... false
configure: error: Did not find pcre-config script at /usr/lib64

Based on a suggested solution by tejas at Apache installation configuration can't find PCRE? ( pcre-config for libpcre not found ), I installed pcre-devel with yum install pcre-devel. I then ran ./configure from the srclib directory again

This time I didn't see any error messages and the ./configure process terminated normally.

[root@localhost httpd-2.4.6# ./configure
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
[root@localhost httpd-2.4.6]#

I was then able to run make successfully.

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Saturday July 25, 2015