How to “Exclude” Packages from Updating with YUM & Centos/Redhat

When keeping your servers up to date you may not want to have every package upgraded. This is especially true with programs like http servers, script processors (like PHP & Perl) or database servers. It seems that inevitably I want to only upgrade those programs when I know I can take alot of time to make sure their upgrade was perfect. So the quick solution is to “Exclude” them from the update.

Just grab your handy dandy favorite editor and edit /etc/yum.conf and add an exclude line…

[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=mysql*

# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

installonly_limit = 5

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
tsflags=repackage

exclude=mysql*

You can then exclude any package you want or like I did above, no updates any MySQL package.

No when I am ready to finally do an upgrade on MySQL I can remove that entry.

One Response to “How to “Exclude” Packages from Updating with YUM & Centos/Redhat”

  1. Bill Bates Says:

    Thanks for the info, made it easy for me to exclude PHP.

Leave a Reply