🌐 🇵🇱 Polski · 🇬🇧 EN
We all know how important it is to keep software up to date, which protects us from the actions of malicious actors and harmful programs by patching existing vulnerabilities. If something goes wrong with the system due to a lack of updates, it can lead to serious trouble. Updating the kernel in Red Hat is very straightforward.
Step 1 - Check the kernel version in the system.
[root@RHEL01 ~]# uname -r
2.6.32-220.el6.i686
We previously discussed installing packages using the package manager.
Step 2 - View information about the system kernel using the command:
[root@RHEL01 ~]# yum info kernel
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Installed Packages
Name : kernel
Arch : i686
Version : 2.6.32
Release : 220.el6
Size : 83 M
Repo : installed
From repo : anaconda-RedHatEnterpriseLinux-201111171035.i386
Summary : The Linux kernel
URL : http://www.kernel.org/
License : GPLv2
Description : The kernel package contains the Linux kernel (vmlinuz), the core
: of any Linux operating system. The kernel handles the basic
: functions of the operating system: memory allocation, process
: allocation, device input and output, etc.
Since we are currently working on RHEL6, the kernel version in this case is up to date. We will discuss an example update on RHEL05 on the CLIENT01 machine.
Step 1 - Let's find out which kernel version is on RHEL05
[root@station1 ~]# yum info kernel
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
file:///media/cdrom/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/media/cdrom/Server/repodata/repomd.xml'
Trying other mirror.
Installed Packages
Name : kernel
Arch : i686
Version : 2.6.18
Release : 164.el5
Size : 41 M
Repo : installed
Summary : The Linux kernel (the core of the Linux operating system)
URL : http://www.kernel.org/
License : GPLv2
Description: The kernel package contains the Linux kernel (vmlinuz), the core of
: any Linux operating system. The kernel handles the basic functions
: of the operating system: memory allocation, process allocation,
: device input and output, etc.
Step 2 - Use the package manager to update the system kernel.
# yum update -y kernel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirrors.xmission.com
* base: ftp.osuosl.org
* extras: centos-distro.cavecreek.net
* updates: mirror.sanctuaryhost.com
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package kernel.i686 0:2.6.18-194.11.3.el5 set to be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================
Package Arch Version Repository Size
===================================================================
Installing:
kernel i686 2.6.18-194.11.3.el5 updates 17 M
Transaction Summary
===================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 17 M
Downloading Packages:
kernel-2.6.18-194.11.3.el5.i686.rpm | 17 MB 00:18
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : kernel
1/1
Installed:
kernel.i686 0:2.6.18-194.11.3.el5
Complete!
Now the kernel version should be up to date. If no kernel version is available in the repository, it means that Red Hat does not provide a newer kernel for that specific system. If you wish, you can also download the latest kernel release from http://www.kernel.org in the most convenient format (.tar, .gz, .rpm). To perform such an installation, we use RPM commands as follows:
# rpm -ivh kernel-2.6.18-194.3.1el5
Regardless of the chosen update method, after performing it, you should verify the file:
/boot/grub/grub.conf
Check if it contains entries for the new kernel and if the system is set to boot from the new version.
# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.11.3.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.11.3.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-194.11.3.el5.img
title CentOS (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-164.el5.img
It is immediately visible that the first entry is the new kernel version and the default option is "0", which ensures that the new kernel version will be loaded after the system restarts. Restart the system and check if the new kernel is working correctly.
Comments