Learn to compile and install httpd2.4, considering coexistence with httpd2.2, so you need to specify the installation directory when installing httpd2.4, consider the dependencies between packages.
APR-1.5.0.TAR.BZ2APR-UTIL-1.5.3.TAR.BZ2 (Requires apr-1.5.0) httpd-2.4.9.tar.bz2 (requires Pcre-devel, openssl-devel)
The directory structure is as follows
[Email protected] soft]# pwd/root/soft[[email protected] soft]# tree.├──apr-1.5.0.tar.bz2├── Apr-util-1.5.3.tar.bz2├──httpd-2.4.9.tar.bz2└──httpd24_install.sh0 directories, 4 files
httpd24_install.sh
#!/bin/bashdate1= ' date +%s%n|cut -c1-13 ' yum install -y gcccd /root/softtar jxf apr-1.5.0.tar.bz2tar jxf apr-util-1.5.3.tar.bz2tar jxf Httpd-2.4.9.tar.bz2cd apr-1.5.0./configure --prefix=/usr/local/aprmake && make  INSTALLCD&NBSP, .... cd apr-util-1.5.3./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && MAKE INSTALLCD&NBSP, .... yum install -y pcre-develyum install -y openssl-develcd httpd-2.4.9## --sysconfdir=/etc/httpd24 specifying the profile path ## --enable-so boot module dynamic loading and unloading ## --enable-ssl Compiling SSL modules requires pre-installation openssl-devel## --enable-cgi support CGI mechanism (a protocol that enables a static Web server to parse dynamic requests) ## -- enable-rewrite support for URL rewriting ## --with-zlib support for packet compression ## --with-pcre support regular expressions need to pre-install pcre-devel## --with-apr=/usr/local/apr indicate dependent Apr locationDirectory ## --with-apr-util=/usr/local/apr-util/ indicates the directory where the dependent apr-util resides ## --enable-modules=most enabled modules ## --enable-mpms-shared=all modules that are compiled in a shared manner ## - -with-mpm=prefork indicates that httpd works as prefork./configure -- prefix=/usr/local/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/ usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=preforkmake && make installdate2= ' date +%s%n|cut -c1-13 ' echo "Running time:: $ ( (${date2}-${date1})) " echo "done!"
Running Time:: 209274
done!
[Email protected] soft]# ls/usr/local/aprbin build-1 include lib[[email protected] soft]# Ls/usr/local/apr-util/bin Include Lib[[email protected] soft]# ls/usr/local/httpd24/bin build cgi-bin error htdocs icons include logs man Manual modules
Start httpd2.4
Turn httpd2.2 off [[email protected] bin]# service httpd statushttpd (PID 30807) is running ... [Email protected] bin]# service httpd stopstopping httpd: [OK ]
Go to the httpd2.4 installation directory and start the process to see if Port 80 is up.
[[email protected] bin]# cd /usr/local/httpd24/bin/[[email protected] bin]# lsab checkgid envvars-std htdbm httpd rotatelogsapachectl dbmmanage fcgistarter htdigest httxt2dbmapxs envvars htcacheclean htpasswd logresolve[[email protected] bin]# ./apachectl start[[email Protected] bin] #LISTEN 0 128 [[email Protected] bin]# lsab apachectl apxs checkgid dbmmanage envvars envvars-std fcgistarter htcacheclean htdbm htdigest htpasswd httpd httxt2dbm logresolve rotatelogs[[email protected] bin]# ./apachectl start[[email protected] bin ]# ss -ntlpstate recv-q send-q Local Address:Port Peer Address:PortLISTEN 0 128 :::22 :::* Users: (("sshd", 1276,4)) listen 0 128 *:22 *:* users: (("sshd", 1276,3) listen 0 128 127.0.0.1:631 *:* users: (("CUPSD", 1117,7)) listen 0 128 ::1:631 :::* users: (("CUPSD ", 1117,6)) listen 0 100 ::1:25 :::* users: (("Master", 1384,13) listen 0 100 127.0.0.1:25 *:* users: (("Master", 1384,12) LISTEN 0 128 :::47422 :::* Users: (("rpc.statd", 1041,11)) listen 0 128 *:52751 *:* users: (("rpc.statd", 1041,9)) listen 0 128 :::111 :::* users: (("Rpcbind", 1021,11)) listen 0 128 *:111 *:* users: (("Rpcbind", 1021,8)) listen 0 128 :::80 :::* users: (("httpd", 61535,4), (" HTTPd ", 61536,4), (" httpd ", 61537,4), (" httpd ", 61538,4), (" httpd ", 61539,4), (" httpd ", 61540,4)) [[email protected ] bin]#
done!
This article from "Adela" blog, declined reprint!
"Apache Learning" compiled installation httpd2.4 with automatic installation script for Dummies