≡ Menu

RHEL/CentOS: yum Update All Packages Except the Linux Kernel

I am a new CentOS Linux user running my community site on production server. I want to update all packages except the Linux kernel on CentOS Linux. How can I prevent the yum command from updating the Linux kernel on CentOS/RHEL/Scientific/Fedora Linux server?

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
Estimated completion time5m
You can easily run yum update command to updates everything but the kernel using the exclude directive. This option define list of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards * and ?) are allowed.

yum syntax to update all except Kernel

The syntax is:

yum --exclude=packgeName\* update
yum --exclude=packgeName1\* --exclude=packgeName2\* update
yum -x 'packageName*' update
yum -x 'packageName1*' -x 'packageName2*' update


To prevent yum command from updating the Kernel type:

yum -y --exclude=kernel\* update


yum -y -x 'kernel*' update

How do I prevent yum from Updating the Kernel permanently?

Edit /etc/yum.conf file, enter:
# vi /etc/yum.conf
Append/modify exclude directive line under [main] section, enter:


Save and close the file. Now, you can just run the following without passing the -x or --exclude option to yum command:
# yum -y update

See also
Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 2 comments… add one }

  • Chris January 6, 2014, 12:34 pm

    It suggest leaving out the ‘-y’ option in the example or at least explain its use lest someone expecting to be prompted ends up surprised.

  • city classifieds February 11, 2015, 7:17 pm

    Thanks it is useful article, I agree with Chris if we do without -y then we can verify the packages.

Leave a Comment