《OpenShift / RHEL / DevSecOps 汇总目录》
说明:先《RHEL - 订阅、注册系统和 Yum Repository》一文完成 “注册和注销 RHEL 系统” 章节。
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。另外显式方法可以覆盖隐式方法所指定的版本。
$ yum check-update kernel --releasever=7.6
注意:该方法只能将使用的版本锁定在当前环境中 redhat-release-server 包所对应的版本。
distroverpkg=redhat-release-server
$ yum check-update kernel
$ echo 7.8 > /etc/yum/vars/releasever
$ yum check-update kernel
$ subscription-manager release --show
Release not set
$ subscription-manager release --set=7.6
Release set to: 7.6
$ yum check-update kernel
$ yum updateinfo list
$ yum updateinfo list --security
$ yum updateinfo list --bugfix
$ yum updateinfo list | grep enhancement
$ yum update --advisory=RHSA-2022:6834
$ yum updateinfo list cves
$ yum update --cves=CVE-2022-40674
可以通过 https://access.redhat.com/errata/RHBA-2022:6936 查看一个 RHBA 对应的 Bug 编号,然后使用该编号升级。
$ yum update --bz=2130769
$ 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 | 3
1 | System <unset> | 2023-10-16 02:32 | Install | 342
$ 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.6
Installed subscription-manager-1.21.10-2.el7.x86_64 @anaconda/7.6
Installed yum-3.4.3-161.el7.noarch @anaconda/7.6
Packages Altered:
Install createrepo-0.9.9-28.el7.noarch @rhel-7-server-rpms
Dep-Install deltarpm-3.6-3.el7.x86_64 @rhel-7-server-rpms
Dep-Install python-deltarpm-3.6-3.el7.x86_64 @rhel-7-server-rpms
history info
yum history 的 undo 将撤销一个指定的操作事务,而 rollback 将回滚指定事务之后的所有操作事务。
$ yum history undo 2
$ 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