≡ 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?

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
Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 3 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.

  • ASHWINII February 18, 2016, 2:42 pm

    i need a help. I want to upgrade the packages & kernel in the servers that are running
    Eg: if there are around 200 packages now who to upgrade them at once. kindly reply me

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , ,