on it road .com

使用 yum.conf

  1. 从 yum.conf 的手册页:
# man yum.conf
exclude
List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg.* and ?) are allowed.
  1. 所以需要在客户端的 yum.conf 中的“[main]”部分下。
# vi /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
# Exclude Kernel Updates
exclude=kernel*
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
  1. 验证运行 yum update 命令时在可安装包中没有看到内核包:
# yum update

问题

如何制作一个排除列表,以便运行“yum update”命令时不下载内核补丁?

CentOS/RHEL:使用 Yum 时不更新内核

解决方法

这可以通过两种方式完成:

  1. yum配置文件yum.conf(永久)
  2. 使用命令行选项

从命令行

这是临时的,我们需要在命令行上提供排除列表。

# yum --exclude=kernel* update
日期:2020-09-17 00:12:08 来源:oir作者:oir