CentOS / RHEL : Exclusion with Yum For Kernel Updates

Question : How to make an exclusion list so that anyone running the command “yum update” will not download any kernel patches ?

Answer :
This can be done using 2 ways :
1. yum configuration file yum.conf (permanent)
2. Using command line options

Using yum.conf

1. From the man page of 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.

2. This would need to be under the “[main]” section in yum.conf, on the client.

# 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

3. Verify that you don’t see a kernel package in the installable packages when you run yum update command :

# yum update

From command line

This is temporary and we need to give the exclusion list on command line.

# yum --exclude=kernel* update
Related Post