How to Prevent Yum From Upgrading certain packages?

I would like yum to update all system packages except the mysql related packages. How can I prevent yum from updating mysql on a CentOS/RHEL system?

There are basically two ways,

Way 1: edit yum config file /etc/yum.conf, and add this line in the end,

exclude=mysql*

Then, you can run yum update to upgrade all the rest packages.

Way 2: Use command line parameter to ignore pages. The command is like below

yum update -x mysql*
yum update --exclude mysql*

Please note that,

  • The excluded chars above are case sensitive
  • If you need to exclude multiple packages, you can sepecify the strings as “–exclude=mysql*,ImageMagick”
Share Button

Leave a comment

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