How To Exclude Specific Packages from Yum Update in CentOS / RHEL
Below I will show some examples how to exclude specific packages updates from manual yum update in Red Hat or CentOS.
Yum is the primary tool for getting, installing, deleting, querying, and managing Red Hat Enterprise Linux RPM software packages. Yum command cheat sheet.
To exclude package from yum update use command:
# yum update --exclude=PACKAGENAME
PACKAGENAME replace with your specific package name.
For example i don’t want update Linux Kernel and all Kernel related packages:
# yum update --exclude=kernel*
Permanently Exclude Packages Update From Automatic Yum Update
To Permanently Exclude Package Update (postfix) from Yum Update edit yum configuration file /etc/yum.conf with any editor and add: exclude=postfix line in end of file. In case if you need exclude multiple packages separate them using a single space or comma.
In next example we will permanently prevent Linux Kernel and postfix packages updating during automatic yum update command execution.
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 exclude=kernel* redhat-release* postfix