1. Prepare the compiling environment
Yum-y install GCC make cmake Autoconf libtool libevent
Install a required dependency package for Apache
Yum-y install Apr-util apr pcre-devel
2. download the software package
Wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.10.tar.gz
Decompress the package:
Tar-xzf httpd-2.4.10.tar.gz
3. Compile and install Apache. For Apache versions earlier than 2.x, follow these steps)
./configure --prefix=/usr/local/httpd make make install
Notes:
Error message:
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
Solution
: Execute Yum-y install PCRE-devel to solve this error.
Error message:
checking for APR... noconfigure: error: APR not found . Please read the documentation.
Solution:
Download the latest version of the APR installation file:
Wget http://mirror.atlanticmetro.net/apache//apr/apr-1.4.6.tar.gz wget http://mirror.atlanticmetro.net/apache//apr/apr-util-1.4.1.tar.gz tar xvfz apr-1.4.6.tar.gz tar xvfz apr-util-1.4.1.tar.gz
MV apr-1.4.6 httpd-2.4.2/srclib/APR (note this directory for your own Apache installation file directory)
MV apr-util-1.4.1 httpd-2.4.2/srclib/APR-UTI
Run the following command to re-compile:
./configure --prefix=/usr/local/httpd --with-included-apr
make
make install
Centos compilation and installation apache2.4.10