When running a ‘yum update’ under CentOS, there are certain packages you may be running which you wish to remain static, or which can potentially cause errors with the update eg. Samba.
In these situations it is useful to force yum to exclude certain packages from being updated under CentOS.
Yum uses a configuration file located at <
If you wish to exclude packages you need to define a list for exclusion from updates or installs. This should be a space separated list. (Shell globs using wildcards * and ?) are allowed).
How do I exclude php and kernel packages when I use “yum update”?
Open /etc/yum.conf file:
# vi /etc/yum.conf
Append following line under [main] section, enter:
At the end, it should look like as follows:
# Note: yum-RHN-plugin doesn’t honor this.
# installonly_limit = 3
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
yum –exclude command line option
Finally, you can skip yum command updates on command line itself using following syntax:
# yum –exclude=package* update
# yum –exclude=php* update
# yum –exclude=kernel* update