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
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:
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exclude=kernel* redhat-release*
Related Article: Prevent Yum From Upgrading The Kernel | Exclude kernel or other packages from getting updated in Red Hat Enterprise