First, the preparatory work
Install the Development Kit group and the required packages:
[Email protected] apr-util-1.6.0]# Yumgroupinstall "Development tools" [[email protected] apr-util-1.6.0]# Yum install E Xpat-devel[[email protected] httpd-2.4.28]# yum install pcre-devel openssl-devel
Note: The httpd-2.4.28 version needs to rely on more than apr-t.4 versions, and CENTOS6 installs the apr-1.3 version by default, so compile and install ARP before compiling httpd.
Second, the experimental steps (method i):
1. Extract three source packages
[[Email protected] ~]# tar xvf httpd-2.4.28.tar.bz2[[email protected] ~]# tar xvf apr-1.6.2.tar.gz[[email protected] ~]# Tar xvf apr-util-1.6.0.tar.gz
2. Compile and install Apr and Apr-util
[[email protected] apr-1.6.2]#/configure--prefix=/app/apr[[email protected] apr-1.6.2]# make && make install[ [Email protected] bin]#/configure--prefix=/app/apr-util--with-apr=/app/apr [[email protected]]# make && make Install
3. Compile and install httpd-2.4.28
[Email protected] bin]#/configure--prefix=/app/httpd24--enable-so--enable-ssl--enable-cgi-- Enable-rewrite--with-zlib--with-pcre--with-apr=/app/apr/--with-apr-util=/app/apr-util/--enable-modules=most-- Enable-mpms-shared=all--with-mpm=prefork[[email protected]]# make && make install
4. Start the service
[[email protected] bin]# Cd/app/httpd24/bin//Compile the path of the specified storage configuration file [[email protected] bin]#./apachectl
5. Test Connection
[Email protected] ~]# Curl 192.168.35.136
Third, method two
1. Unpack the package (same method one)
2. Compile and compile the installation
[Email protected]~]# cp-av apr-1.6.2 httpd-2.4.28/srclib/apr[[email protected]~]# cp-av apr-util-1.6.0 httpd-2.4.28/s Rclib/apr-util[[email protected]~]# CD Httpd-2.4.28[[email protected] httpd-2.4.28]#./configure--prefix=/app/ Httpd24--enable-so--enable-ssl--enable-cgi--enable-rewrite--with-zlib--with-pcre--with-included-apr-- Enable-modules=most--enable-mpms-shared=all--with-mpm=prefork[[email protected] httpd-2.4.28]# # MAKE-J 4 && Make install
3. Write the startup path to the PATH variable
[Email protected] httpd24]# vim/etc/profile.d/httpd24.sh path=/app/httpd24/bin: $PATH
4. Modify the service script
[[email protected] init.d]# CP httpd httpd24[[email protected] init.d]# vim httpd24 apachectl=/app/httpd24/bin/apachectl Apachectl file path HTTPD=${HTTPD-/APP/HTTPD24/BIN/HTTPD}//path of the service Pidfile=${pidfile-/app/http24/logs/httpd.pid}// The process ID file path that holds the service master process lockfile=${lockfile-/var/lock/subsys/httpd24}
5. Start the service
Service HTTPD24 Start
Summary: The difference between the two methods is that the second method does not need to compile the APR separately, but need to copy the extracted Apr file and the Apr-util file to the Srclib directory of the extracted HTTP file, and then add it when compiling -- With-included-apr.
CENTOS6 Compiling and installing httpd-2.4.28