How To Prevent Yum Upgrade Kernel On CentOS / Red Hat How do I exclude kernel or other packages from getting updated via yum?

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:


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

On Red Hat Enterprise Linux

The up2date command in Red Hat Enterprise Linux 4 excludes kernel updates by default. The yum in Red Hat Enterprise Linux 5 includes kernel updates by default.
To skip installing or updating kernel or other packages while using the yum update utility in Red Hat Enterprise Linux 5 and 6, use following options
Temporary solution via Command line:

# yum update --exclude=PACKAGENAME

For example, to exclude all kernel related packages:

# yum update --exclude=kernel*

To make permanent changes, edit the /etc/yum.conf file and following entries to it:

exclude=kernel* redhat-release*

Related Article: Prevent Yum From Upgrading The Kernel | Exclude kernel or other packages from getting updated in Red Hat Enterprise

Linux Corner: Yum Errors while downloading installers epel-release Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

What is yum?

YUM stands for Yellowdog Updater, Modified. Like all other program’s in Linux, YUM is also an open source tool.

It was initially used in Duke University, for managing package installation on their Red Hat based system’s. These day’s its been widely used by almost all Red Hat based system’s. In fact its the default program installer and package management tool these days.

If you are interested in visiting the official home page of YUM, then i would recommend, visiting the below link of Duke university.

In particular yum is a software package manager that installs, updates, and removes packages on RPM-based systems. It automatically computes dependencies and figures out what things should occur to install packages. yum makes it easier to maintain groups of machines without having to manually update each one using rpm.

Features include:

  • Support for multiple repositories
  • Simple configuration
  • Dependency calculation
  • Fast operation
  • RPM-consistent behavior
  • Package group support, including multiple-repository groups
  • Simple interface

yum uses an online repository by default, but you can also configure it to use a local repository of packages.

Linux Corner of Today

Trying to update or install packages with YUM, the procedure doesn’t work, with the following error

Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

You have some possibilities to solve the problem:

  1. Update ca-certificates package. Before that, just disable all repos with https that are failing. For example if you need to disable only epel repo:
    yum --disablerepo=epel -y update  ca-certificates
  2. Editing both /etc/yum.repos.d/epel.repo and /etc/yum.repos.d/epel-testing.repo files, commenting all entries starting with mirrorlist=... and uncomenting all the entries starting with baseurl=....