Force yum update Command To Exclude Certain Packages
Q. How can I exclude selected packages when I rum yum update command under CentOS Linux server?
A. Yum uses a configuration file at /etc/yum/yum.conf or /etc/yum.conf. You need to place exclude directive to define list of packages to exclude 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:
exclude=php* kernel*
At the end, it should look like as follows:
[main] cachedir=/var/cache/yum keepcache=0 debuglevel=2 logfile=/var/log/yum.log distroverpkg=redhat-release tolerant=1 exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 exclude=php* kernel* # Note: yum-RHN-plugin doesn't honor this. metadata_expire=1h # Default. # 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
E-mail this to a friend
Printable version
Related Other Helpful FAQs:
- Linux yum command skip updating packages
- Exclude certain files when creating a tarball using tar command
- Linux List All Outdated Packages Which Could be Updated and Applied to System
- CentOS Linux apply package updates
- Patch and Update Redhat Enterprise Linux / CentOS 5 server
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: /etc/yum.conf, CentOS, kernel, Linux, metadata, redhat, wildcards, yum, yum command, yum update command




June 17th, 2008 at 1:45 pm
Is there some way to override exclusions configured in the conf file when yum is run manually, short of removing or commenting the exclude entry in the conf files?
Say I’d like to automate the updates of most of my packages, but some subset of core packages I’d like to upgrade manually after I’ve had a chance to test the package.
June 17th, 2008 at 4:49 pm
Ben,
I’m afraid but it is not possible to achieve.
August 28th, 2008 (2 weeks ago) at 7:30 pm
Ben,
I’m not sure what version of yum they added this, but:
`yum –disableexcludes=[all|main|repoid]`
or
`yum –disableexcludes=all update`
or
`yum –disableexcludes=all update kernel`