How to skip updating certain packages by YUM

I’m runing RHEL/CentOS for a group of database servers, and they mainly use MySQL for productive services. Recently I noticed that MySQL’s new feathers and bug fixes that comes from system updates make little sense to our needs, so I’m planing not to apply these changes on our live servers, unless it’s really needed.

The question is: How can I disable a certain package from being updated by Yum in Linux server environment?

After having a check with the parameter “–help“, I know that the Yum under RedHat / CentOS has an option “–exclude“, and it will exclude a specific package by name or shell glob (* or ?) from being updated, here’re two examples:

1, Bypass updates for an exact package
You can just run this command. Note that you need to login as privileged user to use following commands:

yum --exclude=mysql-server update

2, Bypass some packages with glob
For example, with the following command, you can exclude both mysql-client and mysql-server from update:

yum --exclude=mysql* update

There’s another alternative way to bypass the package.
Yum also supplies a configuration parameter that can be used in /etc/yum.conf to bypass specified packages completely.
To exclude packages from being updated, you can edit /etc/yum.conf and add one line as below:

exclude=mysql*

Further readings: Updating Your System with yum
For any issues, it’s welcome to create postings at our support forum at forum.admon.org!

Leave a comment

Your email address will not be published. Required fields are marked *