About Linux FAQ

Browse More FAQs:

Force yum update Command To Exclude Certain Packages

Posted by Vivek Gite [Last updated: June 16, 2008]

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:

Discussion on This FAQ

  1. Ben Says:

    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.

  2. Raj Says:

    Ben,

    I’m afraid but it is not possible to achieve.

  3. Bob Says:

    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`

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!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.