The Right Way To Manually Install & Update The Linux Kernel (RHEL/CentOS 7 & 8)

Update linux kernel

In this article, you will learn the following:

  • How to Update Linux Kernel properly.
  • How to Install the Linux Kernel


What is Linux Kernel?

Just as every other operating system have their own kernel, the Linux kernel is the core module/component/part of the OS. It’s responsible for managing most especially the CPU, disk, task, processes, and memory.

The kernel provides an interface between application and hardware.

No kernel, no operating system.

There are a lot of controversies about the Linux kernel. Some people say it makes a complete operating system while some disputes this. Well, this tutorial is not to argue whether it is or not, it will be out of scope.

The Linux history already clarified this but it is a well-known fact that the Linux kernel is the common thing among all the Linux distributions.

Benefits of updating the Linux kernel

There are benefits of updating the Linux kernel and the reasons why you may want to consider upgrading yours.

Here is a list of some of the benefits you can get when you update Linux kernel

. Driver updates

When the Linux kernel is updated, the Linux device drivers on the hardware will automatically be updated as well because the latest open source drivers are always integrated into the new Linux kernels.

This is good for the modern hardware as it will fully take the updates advantage

. Speed increment

one of the good reasons why Linux users love Linux is because of the speed rate.

Linux users agree that Linux is fast. Imagine that the speed of the operating system can be increased with the already fast speed, this can be done with the kernel update which is what every system users love, to be able to query any kind of information at the speed of light. Speed is also very important for web servers.

. Security patches

updating the Linux kernel also tightens the security of the system, especially when security breaches have been detected.

security patches are included in the updated kernel and updating it will block every hole or weak spot that may cause brute force attacks on the system.

Security patches are very important especially to the internet-facing systems where all manner of hacking tools are used by hackers now and then, looking for systems to penetrate.

This is the last thing every system users want as it can be very devastating.

. New features

The updated kernel sometimes comes with new kernel features, though may not be noticeable to an ordinary user.

This is useful for applications because application developers also update their apps with respect to the kernel build.

Sometimes, the used application on the system may require you update the kernel to be able to update the applications for better performance and stability.

. Guaranteed stability

If the system is fond of crashing now and then, probably due to a false high rate of the memory use, if it doesn’t get stabilized even after tweaking the kernel, updating the Linux kernel may be the solution to stabilize the system.

install and update Linux kernel

Disadvantages of updating the Linux kernel

Having mentioned all the advantages above, you should know that the benefits may turn out to become the disadvantages only except for the security fixes benefit.

Updating the Linux kernel can resort to the malfunction of the system. programs may begin to get stalled, unstable and even slow to an extent that it may even cause your system to no longer boot up after a restart which is a major turn off for production environments especially if the window period is not much.

After reading this, you may begin to wonder why you would want to update your kernel

Why should I update my Linux kernel?

If you are facing bad performances, stability issues and basically want to make do of the advantages as mentioned above, then you should update your kernel.

Fortunately, if the system begins to malfunction after a kernel update, the former kernel the system was using before the update can be reverted to.

Hence why I have taken my time to do a step by step process on the right way to update the Linux kernel and the process to revert to the old kernel in case this happens.

More so, every kernel usually goes through a rigorous quality assurance test before it is released. so if you ask me, I say it’s worth taking the risk.

After all, if it doesn’t work, I will humbly roll back and if it’s a production environment, I will make sure this is done in an off-peak or low peak hour so it won’t have an impact on the business.

How to check the installed Linux kernel version.

To check for the Linux kernel version, you do

[root@rhel8 ~]# uname -r


or -a to see the distribution.

[root@rhel8 ~]# uname -a

Linux rhel8 4.18.0-147.el8.x86_64 #1 SMP Thu Sep 26 15:52:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@rhel8 ~]#

How to check if Linux kernel update is available

If your system is internet-facing or connected to the internet and you did not configure your system to automatically install patches, you can use the “yum check-update kernel” command to see if a new kernel is available.

[root@rhel8 ~]# yum check-update kernel

Updating Subscription Management repositories.
Last metadata expiration check: 0:04:16 ago on Wed 01 Jan 2020 05:50:48 PM WAT.

kernel.x86_64 4.18.0-147.3.1.el8_1 rhel-8-for-x86_64-baseos-rpms
[root@rhel8 ~]#

On the contrary, if your system is not connected to the internet, you will have to use the red hat package browser to search for the latest kernel package.

How To Rightly Update Linux Kernel

Rightly updating the Linux kernel can be done in two ways.

1. Manually install the .rmp kernel package

To manually install a kernel, the best practice is to use the – i option and not the – U option. The reason is that the –U option will update the kernel and not keep the old kernel.

If there are any issues with the updated kernel, rolling back to the previous kernel won’t be possible any longer because it has been updated and not kept by the system.

On the other hand, the – i option will keep the old kernel and in case of any casualties, one can easily revert to the old kernel. The steps to do this will be stated below in the “ACTION TIME”

2. Using the “yum install” or “yum update” command

The kernel can also be updated using the “yum update” command and the old kernel will not be overwritten.


Step By Step On How To Rightly Update The Linux Kernel

OPTION A (manually installing the .rpm package)

1. download the rpm package: you can use the Red Hat package browser to find the kernel you want to install. In this case, the kernel that is going to be installed is [ kernel-3.10.0-862.2.3.el7.x86_64.rpm ]

2. Before we install, it is good to confirm the number of kernels installed on the system

[root@lab01 ~]# rpm -qa kernel

[root@lab01 ~]#

You can see that there is only one kernel on the system and that is the kernel the system is using.

NOTE: if there are many kernels on the system, use the command “uname -r” to know the kernel the system is running on as mentioned above in the “understanding the subject matter” section

3. Installing,

[root@lab01 ~]# rpm -ivh kernel-3.10.0-862.2.3.el7.x86_64.rpm

warning: kernel-3.10.0-862.2.3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:kernel-3.10.0-862.2.3.el7 ################################# [100%]
[root@lab01 ~]#

4. reboot the system to make it start with the new kernel.

[root@rhel8 ~]# reboot

5. confirm the new kernel after start up

[root@lab01 ~]# uname -r

[root@lab01 ~]#

OPTION B: using the “yum update” command.

1. use “yum update kernel” command to update the kernel

[root@rhel8 ~]# yum update kernel

Updating Subscription Management repositories.
Last metadata expiration check: 0:33:47 ago on Wed 01 Jan 2020 06:13:17 PM WAT.
Dependencies resolved.
Package Arch Version Repository Size
kernel x86_64 4.18.0-147.3.1.el8_1 rhel-8-for-x86_64-baseos-rpms 1.5 M
Installing dependencies:
kernel-modules x86_64 4.18.0-147.3.1.el8_1 rhel-8-for-x86_64-baseos-rpms 22 M
kernel-core x86_64 4.18.0-147.3.1.el8_1 rhel-8-for-x86_64-baseos-rpms 25 M

Transaction Summary
Install 3 Packages

Total download size: 49 M
Installed size: 78 M
Is this ok [y/N]:

2. reboot the system to make it start with the new kernel.

[root@rhel8 ~]# reboot

3. confirm the new kernel after the system is booted up.

[root@lab01 ~]# uname -r

[root@lab01 ~]#

It is good to know that the kernel can also be installed without restarting the system. I will write on it as a subject matter on this blog site.

RHCSA Dumps, Q&A On How To Install/Update Linux Kernel

Your feedback is welcomed. If you love others, you will share with others

Be the first to comment

Leave a Reply

Your email address will not be published.