First method one, download unzip
wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.29.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar -vxf httpd-2.4. . tar. gz
TAR-VXF apr-1.6.3.tar.gz
TAR-VXF apr-util-1.6.1.tar.gz
Second, install the development package group and related dependent packages
Yum " Development Tools " Yum Install openssl-devel pcre-devel expat-devel
Third, compile Apr and Apr-util
HTTPD is dependent on APR, so first compile Apr and Apr-util
1. Compiling Apr
CD apr-1.6. 3 . /configure--PREFIX=/APP/APR
Make && make install
2. Compiling apr-util
CD apr-util-1.6. 1
./configure--prefix=/app/apr-util--WITH-APR=/APP/APR
Make && make install
Iv. compiling httpd
CD httpd-2.4. in . /configure--prefix=/app/--enable---enable---enable---enable--- with---with---with-apr=/app/apr/--with-apr-util=/app/apr-util/-- enable-modules=--enable-mpms-shared=--with-mpm=prefork
Make && make install
V. Environment variables
Echo ' path=/app/httpd24/bin/: $PATH ' >/etc/profile.d/httpd24. SH /etc/profile.d/httpd24. SH
Vi. Creating users and Groups
Useradd-r-s/sbin/nologin Apache
Vii. Modifying configuration files
vim/app/httpd24/conf/httpd.conf Modify user Apachegroup Apache
Viii. Startup scripts
vim/etc/init.d/httpd24apachectl=/app/httpd24/bin/apachectlhttpd=${httpd-/app/httpd24/bin/ httpd}pidfile=${pidfile-/app/httpd24/logs/httpd.pid}lockfile=${lockfile-/var/lock/ SUBSYS/HTTPD24}
Chkconfig--add httpd24
Chkconfig httpd24 on
Service HTTPD24 Start
The second method of one, download decompression
wgethttp//Mirrors.hust.edu.cn/apache//httpd/httpd-2.4.29.tar.gzwgetHttps//Mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gzwgetHttps//Mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gzTar-VXF httpd-2.4. in.Tar. GZTar-VXF apr-1.6.3.Tar. GZTar-VXF apr-util-1.6.1.Tar. gz
Second, install the development package group and related dependent packages
Yum " Development Tools " Yum Install openssl-devel pcre-devel expat-devel
Third, copy Apr and Apr-util source Package
CP -R apr-1.6. 3 httpd-2.4. /srclib/AprCP -R apr-util-1.6. 1 httpd-2.4. /srclib/apr-util
Third, compile
CD httpd-2.4. in . /--prefix=/app/--enable---enable---enable---enable--- with---with---with-included---enable-modules=--enable-mpms-shared= --with-mpm=prefork
Make && make install
The following steps are the same as the first method
Two ways to compile and install httpd2.4 Centos 6