Centos7在线升级Apache Httpd至最新版本
Posted Hsia运维笔记
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7在线升级Apache Httpd至最新版本相关的知识,希望对你有一定的参考价值。
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.
三、Some Tips
Please also note that this package depends on apr-util 1.5.0+ and libnghttp, which you can found in EPEL repository. So, the easiest way to use our builds of Apache HTTPd is to add EPEL repository, if you still do not have it: yum install -y epel-release
yum install libc.so.6 libbrotli* yum install glibc yum install libnghttp2 libnghttp2-devel apr-util -y
年底了,个人事情加上工作比较忙多,很久没更新,对不住各位朋友也对不住自己。
奉上几碗鸡汤:
以上是关于Centos7在线升级Apache Httpd至最新版本的主要内容,如果未能解决你的问题,请参考以下文章