How to exclude yum kernel updates in CentOS

Published on Author JFLeave a comment

CentOS, unlike some other distros, will automatically update the kernel when you yum -y update.

In other places you have googled you will find that people have tried adding the following to yum.conf:

exclude=kernel*

or

exclude=kernel/*

This seems to mysteriously work from some people, but not for others. Below is what worked for me.

To prevent this from happening there are a few options:

  1. CMD Line
    yum update --exclude=kernel* redhat-release* centos-release*
  2. Update yum.conf
    vi /etc/yum.conf

    Simply add to the bottom of the file (use # to add a comment). Don’t use multiple exclude statements:

    # excluding kernel releases from yum automatically updating 
    exclude=kernel* redhat-release* centos-release*

 

Good luck and let me know if it works for you and what changes you had to make it order for it to work. By the way, one hint I found is this line in yum.conf:

distroverpkg=centos-release

VERY IMPORTANT NOTE:

If you’re going to install Software Collections Library or any package that has “centos-release” in the name you will have to comment out “centos-release*” from yum.conf and, instead, rely on using the command line above.¬†

Recommendation: comment it out until you’re done doing what you need to do, then remove the comment #.

 

 

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.