Centos7在线升级Apache Httpd至最新版本

piaoling  2023-11-13 12:15:22

Centos7下在线升级Apache Httpd至最新版本



一、确认原版本信息

查找Centos上软件库里的Apache版本,在命令行下输入以下指令:

[root@test yum.repos.d]# yum info httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 89.el7.centos
Size        : 9.4 M
Repo        : installed
From repo   : sccfc_updates
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

我们从上面的输出结果中看到,默认Installed Packages是2.4.6版本的apache。

二、使用向后修复安全实践升级Apache

在Centos上可以使用”向后修复安全实践”来将新的软件修复应用到更早期的版本,来满足我们的安全需求更新。

安装CodeIT库

CodeIT的人提供了一个很好的自定义库。这个库提供了最新版本的服务器软件(Apache & nginx)。在安装CodeIT库之前,我们需要首先开启 EPEL ,EPEL提供了CodeIT库所需要的依赖

 
[root@test yum.repos.d]# yum install -y epel-release
[root@test yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 
[root@test yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo 

然后,我们来安装CodeIT库


[root@test yum.repos.d]# cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo

[root@test yum.repos.d]# cat codeit.el7.repo 
[CodeIT]
name=CodeIT repo
baseurl=https://repo.codeit.guru/packages/centos/7/$basearch
enabled=1
gpgkey=https://repo.codeit.guru/RPM-GPG-KEY-codeit
gpgcheck=1

更新前,我们首先查看下codeit提供的httpd版本信息

[root@test yum.repos.d]# yum info httpd Loaded plugins: fastestmirror
CodeIT                                                                            | 2.9 kB  00:00:00     
CodeIT/x86_64/primary_db                                                          |  59 kB  00:00:02     
Loading mirror speeds from cached hostfile
Installed Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 89.el7.centos
Size        : 9.4 M
Repo        : installed
From repo   : sccfc_updates
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

Available Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.46
Release     : 1.codeit.el7
Size        : 1.4 M
Repo        : CodeIT/x86_64
Summary     : Apache HTTP Server
URL         : https://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

ok,Available Packages是2.4.46,确实符合我们的要求;

更新走起

yum upgrade httpd

等过程跑完,最后查看下更新后的信息

[root@ansible ~]# yum info httpd Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Installed Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.46
Release     : 1.codeit.el7
Size        : 4.2 M
Repo        : installed
From repo   : CodeIT
Summary     : Apache HTTP Server
URL         : https://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.
来源:https://it.cha138.com/jingpin/show-17902.html


类别 :  默认(739)  |  浏览(879)  |  评论(0)
发表评论(评论将通过邮件发给作者):

Email: