当前位置: 首页 > news >正文

RHEL - 更新升级软件或系统

《OpenShift / RHEL / DevSecOps 汇总目录》

文章目录

  • 小版本软件更新
    • yum update 和 yum upgrade 的区别
    • 升级软件和升级系统
    • 检查软件包是否可升级
    • 指定升级软件使用的发行版本
      • 方法1
      • 方法2
      • 方法3
      • 方法4
    • 查看软件升级类型
    • 更新升级指定的 RHSA/RHBA/RHEA
    • 更新升级指定的 CVE
    • 更新升级指定的 Bug
    • 查看软件安装升级操作历史
    • undo/rollback 操作
  • 大版本系统升级
    • 参考

说明:先《RHEL - 订阅、注册系统和 Yum Repository》一文完成 “注册和注销 RHEL 系统” 章节。

小版本软件更新

yum update 和 yum upgrade 的区别

yum update 和 yum upgrade 都会升级软件,唯一的区别是 yum update 使用了 –obsolete flage=0 参数,而 yum upgrade 使用了 –obsolete flage=1 的参数。

yum update 是直接将旧版本软件升级到新版本,因此升级后还会继续保留有些不再被用的旧版文件,而 yum upgrade 是先把旧版本的软件删除后再安装新版软件。

升级软件和升级系统

以下命令分别会升级 rpm 软件和整个系统。

$ yum update rpm
$ yum update

检查软件包是否可升级

只检查软件包是否可用的升级。

$ yum check-update rpm
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.rpm.x86_64                      4.11.3-48.el7_9                         rhel-7-server-rpms

指定升级软件使用的发行版本

可以使用以下显式(前一种)或隐式(后三种)的方法指定 yum 命令使用的发行版本。
注意:如果以下方法都不用,则缺省会使用当前主要版本的最新次要版本,例如 7.9。另外显式方法可以覆盖隐式方法所指定的版本。

方法1

  1. 执行命令检查可更新的 kernel,在参命令参数中显式指定使用的发行版本,
$ yum check-update kernel --releasever=7.6

方法2

注意:该方法只能将使用的版本锁定在当前环境中 redhat-release-server 包所对应的版本。

  1. 在 /etc/yum.conf 文件中添加以下内容。
distroverpkg=redhat-release-server
  1. 然后检查可更新的 kernel。
$ yum check-update kernel

方法3

  1. 执行命令,在 /etc/yum/vars/releasever 文件中设置使用的发行版本,然后检查可更新的 kernel。
$ echo 7.8 > /etc/yum/vars/releasever
$ yum check-update kernel

方法4

  1. 参照《RHEL - 订阅、注册系统和 Yum Repository》一文的 “将 RHEL 系统关联和取关订阅” 章节完成订阅关联。
  2. 执行以下命令设置使用的发行版本,然后检查可更新的 kernel。
$ subscription-manager release --show
Release not set$ subscription-manager release --set=7.6
Release set to: 7.6$ yum check-update kernel

查看软件升级类型

  1. 以下命令可以列出和当前环境有关的所有可用软件更新包:
$ yum updateinfo list
  1. 还可进一步查看升级包类型,包括 RHSA/RHBA/RHEA。
$ yum updateinfo list --security
$ yum updateinfo list --bugfix
$ yum updateinfo list | grep enhancement

更新升级指定的 RHSA/RHBA/RHEA

$ yum update --advisory=RHSA-2022:6834

更新升级指定的 CVE

$ yum updateinfo list cves
$ yum update --cves=CVE-2022-40674

更新升级指定的 Bug

可以通过 https://access.redhat.com/errata/RHBA-2022:6936 查看一个 RHBA 对应的 Bug 编号,然后使用该编号升级。

$ yum update --bz=2130769

查看软件安装升级操作历史

  1. 先安装一个软件,然后查看操作历史。
$ yum install createrepo
$ yum history
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------2 | root <root>              | 2024-01-11 12:01 | Install        |    31 | System <unset>           | 2023-10-16 02:32 | Install        |  342
  1. 查看 ID 为 2 的详细情况。
$ yum history info 2
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.
Transaction ID : 2
Begin time     : Thu Jan 11 12:01:18 2024
Begin rpmdb    : 342:c938f565466bf7a9c8b9740a0504053f5f0b5922
End time       :            12:01:24 2024 (6 seconds)
End rpmdb      : 345:58ca1f49bd20bfca9e08468a8514a7f9fd62e525
User           : root <root>
Return-Code    : Success
Command Line   : install createrepo
Transaction performed with:Installed     rpm-4.11.3-35.el7.x86_64                  @anaconda/7.6Installed     subscription-manager-1.21.10-2.el7.x86_64 @anaconda/7.6Installed     yum-3.4.3-161.el7.noarch                  @anaconda/7.6
Packages Altered:Install     createrepo-0.9.9-28.el7.noarch   @rhel-7-server-rpmsDep-Install deltarpm-3.6-3.el7.x86_64        @rhel-7-server-rpmsDep-Install python-deltarpm-3.6-3.el7.x86_64 @rhel-7-server-rpms
history info

undo/rollback 操作

yum history 的 undo 将撤销一个指定的操作事务,而 rollback 将回滚指定事务之后的所有操作事务。

  1. 以下命令是撤销 ID 为 2 的操作。
$ yum history undo 2
  1. 以下命令是撤销 ID 为 1 以后的所有操作,即恢复到 ID 为 1 时的状态。
$ yum history rollback 1

大版本系统升级

参见 https://access.redhat.com/labs/rhelupgradehelper,可根据向导可获得跨大版本升级 RHEL 的操作指导。
在这里插入图片描述

参考

https://access.redhat.com/solutions/238533
https://access.redhat.com/solutions/10021
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-yum
https://linuxsimply.com/linux-basics/package-management/upgrade-package/yum-update-vs-upgrade/
https://access.redhat.com/downloads/content/69/ver=/rhel—7/7.9/x86_64/product-errata
https://git.centos.org/rpms/kernel/releases
https://kcm.trellix.com/corporate/index?page=content&id=KB93176
https://www.redhat.com/zh/blog/what-latest-kernel-release-my-version-red-hat-enterprise-linux
https://access.redhat.com/articles/3078

http://www.lryc.cn/news/284973.html

相关文章:

  • JNPF低代码开发平台总体架构介绍
  • axios的传参方式
  • 受电端协议芯片是如何让Type-C接口设备实现快充?
  • 浪花 - 搜索标签前后端联调
  • GPU与SSD间的P2P DMA访问机制
  • 未来的NAS:连接您的数字生活
  • C++ 设计模式之备忘录模式
  • 【项目搭建三】SpringBoot引入redis
  • 漫谈广告机制设计 | 听闻RTA要搞二次竞价了?牛啊!
  • 第04章_IDEA的安装与使用(下)(IDEA断点调试,IDEA常用插件)
  • HBase鉴权设计以及Kerberos鉴权方法
  • 【华为GAUSS数据库】IDEA连接GAUSS数据库方法
  • [java基础揉碎]键盘输入语句
  • Redis 面试题 | 01.精选Redis高频面试题
  • Crow:实现点击下载功能
  • 2024年华为OD机试真题-内存冷热标记-Python-OD统一考试(C卷)
  • Webpack5入门到原理9:处理字体图标资源
  • 【Docker】在Windows操作系统安装Docker前配置环境
  • Webpack5入门到原理21:提升开发体验
  • YOLOv8改进 | Conv篇 | 在线重参数化卷积OREPA助力二次创新(提高推理速度 + FPS)
  • conda国内加速
  • RabbitMQ-数据持久化
  • JS-WebAPIs-本地存储(五)
  • 了解Vue中日历插件Fullcalendar
  • Cloudreve存储策略-通过从机存储来拓展容量
  • java进阶-jvm精讲及实战
  • vue中引入sass、scss
  • Java学习笔记(八)——Lambda表达式
  • 【JavaEE】CAS
  • Linux 系统之部署 h5ai 目录列表程序