How to update/upgrade the Red Hat Enterprise Linux kernel?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 3, 4, 5, 6, 7, 8, 9, and 10

Issue

  • How to update the Red Hat Enterprise Linux kernel?
  • How to update the kernel on Red Hat Enterprise Linux, is there anything that needs specific attention?
  • How to install a newer kernel?

Resolution

Red Hat does not recommend using update option to update the kernel. Rather we suggest install which allows us to preserve the old kernel to boot from should we run into issues on the newer kernel.

  • Get the kernel package, required kernel type can be downloaded from the This content is not included.Red Hat Customer Portal. In RHEL4 you can choose a normal kernel, kernel-smp, kernel-largesmp, kernel-hugemem. In RHEL5, you can choose a normal kernel, kernel-PAE and kernel-xen.
  • Install kernel package
  • Note: Again, never use "rpm -Uvh" here. To leave an old version just in case.
    # rpm -ivh kernel-<version>.rpm
    
    • If you have registered your system to RHN or RHSM, and your system is Red Hat Enterprise Linux 5, 6, 7, 8 or 9 run the command:
      # yum install kernel
      
    • If you have registered your system to RHN or RHSM, and your system is Red Hat Enterprise Linux 3 or 4, run the command:
      # up2date kernel
      
  • If your system is IA32 or x86_64 architecture, edit the /boot/grub/grub.conf.  You will find a new kernel section is appended to this file after you install the new kernel.  Find the "default" field, make sure it points to the right kernel you want to boot. You can modify the value of "default", just remember this value is counted from "0" which means the "0" is the first kernel, the "1" is the second kernel.
  • If your old system has installed some third party drivers, these drivers will not be included in new kernel, you need to reinstall all the third party drivers and corresponding initrd
  • Normally, only the new kernel package is needed, but sometimes the new kernel need install or upgrade other packages first (dependency problem), such as kernel-devel, kernel-headers, ecryptfs-utils, mkinitrd, etc.
  • If your old system has installed kernel-devel and kernel-headers package, and if you want to keep the kernel-devel package consistent with the new kernel, you can update the kernel-devel with command "rpm -Uvh", just remember that after you update it, it might not be easy to get it back to the old version, and some of your development applications might be affected.
  • If you need to update packages using rpm, not yum/up2date. You need to download packages and confirm dependency manually. Generally, Red Hat Support doesn't assure you to provide lists of all package you need to download. It is because it depend on each systems. It's not only kernel package but also all 'manual update using rpm utility'.
  • Backup important data and get ready for rebooting operation system.
  • In order for the system to use the latest installed kernel, it needs to be rebooted.
  • Additional for RHEL6, kernel-firmware is depended by kernel.
rpm -ivh kernel-2.6.32-504.el6.x86_64.rpm 
error: Failed dependencies:
	kernel-firmware >= 2.6.32-504.el6 is needed by kernel-2.6.32-504.el6.x86_64
  • Update kernel-firmware:
 rpm -Uvh kernel-firmware-2.6.32-504.el6.noarch.rpm 
Preparing...                ########################################### [100%]
   1:kernel-firmware        ########################################### [100%]
  • Install new kernel:
rpm -ivh kernel-2.6.32-504.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:kernel                 ########################################### [100%]
# rpm -ivh kernel-3.10.0-229.20.1.el7.x86_64.rpm
error: Failed dependencies:
	dracut >= 033-241.el7_1.5 is needed by kernel-3.10.0-229.20.1.el7.x86_64    

# rpm -Uvh dracut-033-241.el7_1.5.x86_64.rpm  
error: Failed dependencies:
	dracut = 033-240.el7 is needed by (installed) dracut-network-033-240.el7.x86_64
	dracut = 033-240.el7 is needed by (installed) dracut-config-rescue-033-240.el7.x86_64
  • Update dracut, dracut-network and dracut-config-rescue first:
# rpm -Uvh dracut-033-241.el7_1.5.x86_64.rpm dracut-config-rescue-033-241.el7_1.5.x86_64.rpm dracut-network 033-241.el7_1.5.x86_64.rpm

Preparing...                          ################################# [100%]
Updating / installing...
   1:dracut-033-241.el7_1.5           ################################# [ 17%]
   2:dracut-config-rescue-033-241.el7_################################# [ 33%]
   3:dracut-network-033-241.el7_1.5   ################################# [ 50%]
Cleaning up / removing...
   4:dracut-network-033-240.el7       ################################# [ 67%]
   5:dracut-config-rescue-033-240.el7 ################################# [ 83%]
   6:dracut-033-240.el7               ################################# [100%]
  • Then install new kernel:
# rpm -ivh kernel-3.10.0-229.20.1.el7.x86_64.rpm
Preparing...         
Updating / installing...
   1:kernel-3.10.0-229.20.1.el7       ################################# [100%]
  • Additional for RHEL8, It should be recommended using yum or dnf with oneline command for kernel, kernel-core and kernel-modules.
# yum localinstall kernel-4.18.0-305.el8.x86_64.rpm kernel-core-4.18.0-305.el8.x86_64.rpm kernel-modules-4.18.0-305.el8.x86_64.rpm
  • Additional for RHEL9, It should be recommended using yum or dnf with oneline command for kernel, kernel-core, kernel-modules and kernel-modules-core.
# yum localinstall kernel-5.14.0-284.11.1.el9_2.rpm kernel-core-5.14.0-284.11.1.el9_2.rpm kernel-modules-5.14.0-284.11.1.el9_2.rpm kernel-modules-core-5.14.0-284.11.1.el9_2.rpm
  • Additional for RHEL10, It should be recommended using yum or dnf with oneline command for kernel, kernel-core, kernel-modules, kernel-modules-core, and kernel-modules-extra.
# yum localinstall kernel-6.12.0-124.9.1.el10_1.x86_64.rpm kernel-core-6.12.0-124.9.1.el10_1.x86_64.rpm kernel-modules-6.12.0-124.9.1.el10_1.x86_64.rpm kernel-modules-core-6.12.0-124.9.1.el10_1.x86_64.rpm kernel-modules-extra-6.12.0-124.9.1.el10_1.x86_64.rpm
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.