rhel升级httpd

rhel升级httpd

说明

1、此文档编写于2022年8月,阅读文档时,可能软件版本不是最新版本,请注意。
2、原理,安装时将新的httpd指向老的httpd,即可覆盖之前的httpd,完成升级,配置等都不会变。一定在测试环境测试完成再升级。

包名下载地址下载版本
aprhttps://apr.apache.org/download.cgiapr-1.7.0.tar.gz
apr-utilhttps://apr.apache.org/download.cgiapr-util-1.6.1.tar.gz
pcrehttps://sourceforge.net/projects/pcre/files/pcre-8.44.tar.gz
pcre-8.45.tar.gz(可安装最新版本)
expathttps://github.com/libexpat/libexpat/releasesexpat-2.0.1.tar.gz
expat-2.4.8.tar.gz(可安装最新版本)
zlibhttps://www.zlib.net/zlib-1.2.8.tar.gz
zlib-1.2.11.tar.gz(可安装最新版本)
httpdhttps://httpd.apache.org/download.cgihttpd-2.4.46.tar.gz
httpd-2.4.54.tar.gz

安装老apache

安装gcc,gcc-c++,root用户执行
yum install gcc -y
yum install gcc-c++ -y
创建目录
mkdir /apache
mkdir /apache/apache2.4.46
mkdir /apache/app
安装apr
tar -xzf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure --prefix=/apache/app/apr
make
make install
安装expat
tar -xzf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure --prefix=/apache/app/expat
make
make install
安装apr-util
tar -xzf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/apache/app/apr-util --with-apr=/apache/app/apr --with-expat=/apache/app/expat
make
make install
安装zlib
tar -xzf zlib-1.2.8.tar.gz
cd zlib-1.2.8/
./configure --prefix=/apache/app/zlib
make
make install
安装pcre
tar -xzf pcre-8.44.tar.gz
cd pcre-8.44
./configure --prefix=/apache/app/pcre
make
make install
安装httpd
tar -xzf httpd-2.4.46.tar.gz
cd httpd-2.4.46
./configure --prefix=/apache/apache2.4.46 --enable-so --enable-cgi --enable-cgid --enable-rewrite --with-pcre=/apache/app/pcre --with-z=/apache/app/zlib -with-apr=/apache/app/apr --with-apr-util=/apache/app/apr-util --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-mpm=event --enable-proxy --enable-proxy-fchi --enable-expires --enable-deflate
make
make install
修改配置文件,以便验证
User daemon改为User 
Group Daemon改为Group
添加ServerName localhost:80

升级apache

备份apache目录
cd /apache
tar cvf ./apache2.4.46.tar ./apache2.4.46/
停止apache
cd /apache/apache2.4.46/bin
./httpd -k stop
升级apache
tar -xzf httpd-2.4.54.tar.gz
cd httpd-2.4.54
./configure --prefix=/apache/apache2.4.46 --enable-so --enable-cgi --enable-cgid --enable-rewrite --with-pcre=/apache/app/pcre/bin/pcre-config --with-z=/apache/app/zlib -with-apr=/apache/app/apr --with-apr-util=/apache/app/apr-util --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-mpm=event --enable-proxy --enable-proxy-fchi --enable-expires --enable-deflate
make
make install
启动apache
cd /apache/apache2.4.46/bin
./httpd -v
Server version: Apache/2.4.54 (Unix)
Server built:   Jul 14 2022 18:54:04
./httpd -k start
检查服务是否正常

回退方案

再次备份apache目录,apache用户执行
cd /apache
tar cvf ./apache2.4.46_new.tar ./apache2.4.46/
停止apache
cd /apache/apache2.4.46/bin
./httpd -k stop
删除apache目录,并恢复apache目录,apache用户执行
rm -rf apache2.4.46
tar xvf apache2.4.46.tar 
启动apache
cd /apache/apache2.4.46/bin
./httpd -v
Server version: Apache/2.4.46 (Unix)
Server built:   Jul 14 2022 18:03:37
./httpd -k start
检查服务是否正常
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值