First, the official installation manual Http://httpd.apache.org/docs/2.4/install.html#customize
Download the latest version of Http://httpd.apache.org/download.cgi#apache24
httpd-2.4.27.tar.bz2
Unzip the tar xvf httpd-2.4.27.tar.bz2
CD httpd-2.4.27
Configure the directory for the./configure--prefix= installation path--WITH-APR and Apr-util
Compiling make
Install make install
Ii. Problems and Solutions
Problem a:configure:error:apr not found. Please read the documentation.
WORKAROUND: You need to install APR and Apr-util
Installation package Address: http://archive.apache.org/dist/apr/
Download apr-1.6.2.tar.bz2 and apr-util-1.6.0.tar.bz2
Unzip the tar xvf apr-1.6.2.tar.bz2
CD apr-1.6.2
Configure the installation path./configure--PREFIX=/USR/LOCAL/APR
Compile & install make && make install
Unzip the tar xvf apr-util-1.6.0.tar.bz2
CD apr-util-1.6.0
Configure the installation path./configure--prefix=/usr/local/apr-util--WITH-APR=/USR/LOCAL/APR
Compile & install make && make install
Problem b:xml/apr_xml.c:35:19: Fatal error: expat.h: No file or directory #include <expat.h>
Workaround: Missing Expat-devel Package
Yum Install Expat-devel
Problem c:configure:error:pcre-config for Libpcre not found. PCRE is required and available from http://pcre.org/
FIX: Install Pcre
Download pcre-8.41.tar.gz
Decompression pcre-8.41.tar.gz
CD pcre-8.41
Configure the installation path./configure--prefix=/usr/local/pcre
Compile & install make && make install
Issue D:make/usr/local/apr/-util/lib/libaprutil-1.so:undefined reference to ' Xml_geterrorcode ' during compilation
Resolution: I was just beginning to apr-util-1.6.0.tar.gz later changed to apr-util-1.6.0.tar.bz2 so that may be the problem of the package.
Can also be configured to need--with-expat=builtin, I tried but for my mistake is not good, later changed a package finally worked, wasted a long time.
Re-unzip with Apr-util-1.6.0.tar.bz2 again, back to Httpd-2.4.27,make clean
Configuration./configure--prefix=/usr/local/apache--with-pcre=/usr/local/pcre/--with-apr=/usr/local/apr/--with-apr-util=/ usr/local/apr-util/
Compile and install make && make install complete
CentOS 7 Source Installation Apache