Make sure development libraries and development tools are installed before installing. Installation method Reference: Http://www.linuxidc.com/Linux/2016-04/130080.htm and http://www.linuxidc.com/Linux/2016-04/130081.htm
First, compile and install
1. Solve the dependency relationship
When installing httpd 2.4.4, you first need to resolve dependencies, httpd 2.4.4 requires a newer version of APR and Apr-util. There are two ways to upgrade, one is to compile the installation through source code, and the other is to upgrade the RPM package directly. This article chooses the first method to upgrade. Here we download apr-1.4.6.tar.bz2 and apr-util-1.5.2.tar.bz2 versions. In order to later unnecessary trouble, here must ensure that the system time is correct, incorrect (data self-modification).
The download path for Apr and Apr-util is: http://archive.apache.org/dist/apr/
(1) First cut the APR and Apr-util to/USR/LOCAL/SRC and then extract the operation according to the practice
MV Apr-1.4.6.tar.bz2/usr/local/src
MV Apr-util-1.5.2.tar.bz2/usr/local/src
TAR-XJVF apr-1.4.6.tar.bz2
TAR-XJVF apr-util-1.5.2.tar.bz2
(2) Compile and install Apr
CD apr-1.4.6
./configure--PREFIX=/USR/LOCAL/APR #安装在/usr/local/under the name Apr
Make
Make install
(3) Compile and install Apr-util
CD apr-util-1.5.2
./configure--prefix=/usr/local/apr-util--WITH-APR=/USR/LOCAL/APR
Make
Make install
The expat.h file could not be found at compile time, the workaround:
Yum Install Expat-devel
(4) The httpd-2.4.4 compilation process also relies on the Pcre-devel software package, which needs to be installed beforehand. This package system CD comes with it, so find and install it.
Yum-y Install Pcre-devel
This concludes that the dependencies are basically resolved.
2. Compile and install httpd-2.4.4
Download httpd-2.4.4.tar.bz2 to https://archive.apache.org/dist/httpd/
(1) First cut the httpd-2.4.4.tar.bz2 to/USR/LOCAL/SRC according to the practice, then the decompression operation
MV Httpd-2.4.4.tar.bz2/usr/local/src
TAR-XJVF httpd-2.4.4.tar.bz2
(2) Compile and install httpd
CD httpd-2.4.4
./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd--enable-so--enable-rewirte--enable-ssl-- enable-cgi--enable-cgid--enable-modules=most--enable-mods-shared=most--enable-mpms-shared=all--with-apr=/usr/ LOCAL/APR--with-apr-util=/usr/local/apr-util
Make
Make install
Explain:
--ENABLE-SO: Support dynamic sharing module, if support PHP will not work with Apache. Have to have
--ENABLE-SSL: Enable SSL feature, if not enabled, will not be able to use HTTPS
--enable-mpms-shared=all:prefork, worker, event
--with-mpm=event:event as the default
--enable-rewrite: Support URL rewriting
--ENABLE-CGI: Support CGI
--ENABLE-CGID:HTTPD using event or worker to enable thread access
--enable-modules=most: Enable most modules
--enable-mods-shared=most: Enable most shared modules
(3) Setenforce 0 turn off SELinux. (Temporarily closed)
Permanently close Vim/etc/selinux/config
(4) Edit the httpd.conf, modify the listening port number
3. Start httpd
/usr/local/apache/bin/apachectl start
CentOS6.5 under Apache Installation