HowTo: Prevent Yum From Upgrading The Kernel On a CentOS / Red Hat Enterprise Linux

I

am a new RHEL / Centos Linux server admin. I would like yum to update all packages except the Linux Kernel. How can I prevent yum command from updating kernel on a CentOS/RHEL/Fedora Linux based systems?

 

You can prevent yum command from updating the Kernel permanently by following the simple steps.

Option #1: Edit /etc/yum.conf file

Use a text editor such as vi to edit /etc/yum.conf:

# vi /etc/yum.conf

Append/modify exclude directive line under [main] section, enter:

exclude=kernel*

 

Save and close the file. Try, updating the system without updating the Linux kernel:

# yum -y update

 

This is a permanent option, so you don’t need pass the -x option to yum command.

Option #2: Pass the -x option to prevent yum from updating kernel

The syntax is as follows to skip update on command line itself:

# yum -x  kernel*  update

 

 

Leave a Reply

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