升级至Httpd-2.4.54

首先下载Httpd-2.4.54.tar.gz数据包:

#cd /usr/local/src
......
#wget https://downloads.apache.org/httpd/httpd-2.4.54.tar.gz
......

解压缩数据包:

#tar xf httpd-2.4.54.tar.gz
......

设置编译环境和选项:

#cd httpd-2.4.54
......
#./configure
......

注意:这里使用的是缺省目录项配置。如果对Linux不熟悉,请尽量使用缺省配置。

开始编译和安装:

#make
......
#make install
......

查看最终安装结果:

# find / -name "httpd*"
......
/usr/local/apache2/conf/original/extra/httpd-manual.conf

......
/usr/sbin/httpd
......
/usr/lib/systemd/system/httpd.service
......
/etc/httpd/conf/httpd.conf
......
/var/log/httpd
......

设置Httpd开机启动:

#vi /usr/lib/systemd/system/httpd.service
......
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target
......
#systemctl daemon reload
......
#systemctl start httpd
......

检查版本号:

#httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Jan 27 2023 17:36:29
......

至此,Httpd升级完成。