Sometimes when running a ‘yum update’ there are certain packages you may be running which you wish to remain static, or which can potentially cause errors with running a ‘yum update’. 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 /etc/yum/yum.conf or /etc/yum.conf
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