How to install the latest Linux Kernel on CentOS 7

Linux Kernel updates enable new technologies and features on your modern PC.

CentOS, a free, repackaged version of the business-oriented Red Hat Enterprise Linux, is widely used by numerous people across the globe for many reasons. From simple workstations to powerful web servers, CentOS can handle whatever you throw at it.

In many of these use cases, it can be beneficial to upgrade the Linux kernel from the default kernel version of 3.10 (as of CentOS 7.6). Some of the benefits you may get from upgrading the Linux kernel are:

  • Security patches
  • Bug fixes
  • Better performance
  • Added kernel functions

In this tutorial, we will show you how to upgrade the Linux kernel in CentOS 7 to the newest version available from kernel.org.  In case anything goes wrong, we will show you how to downgrade. And finally, this tutorial will also show you how to remove older kernel versions if everything works fine.

Prerequisites

You will need:

  • A computer with CentOS 7 installed
  • An Internet connection

Upgrading the Linux Kernel in CentOS

Step 1 – Check the Kernel Version

Before we can upgrade the Linux kernel, it is important that we take note of which kernel CentOS is currently using. To do this, we will use the `uname` utility. Open the terminal and type:

$ uname -r

Running uname
Running uname

2. Enable the ElRepo Repository

ElRepo is a third-party repository for CentOS that allows upgrades to the latest kernel version from kernel.org. It must be used as opposed to CentOS’ own repositories because CentOS does not publish the latest version in their repository. To use ElRepo, it must be enabled.

First, we have to use RPM, a package manager included with CentOS, to import ElRepo’s GPG keys:

$ sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

Second, install the repository:

$ rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

Installing ElRepo
Installing ElRepo

Step 2 – Install Latest LTS Kernel

Now that ElRepo is enabled, we can use it to install the latest long term support kernel. To do this, we will use `yum`:

$ sudo yum --enablerepo=elrepo-kernel install kernel-lt

Step 3 – Reboot Using New Kernel

Finally, we have installed the new Linux kernel. Now, all that is left is to reboot and select the new kernel in the bootloader. When you boot up the system, there should be a new entry in your bootloader with the new kernel version.

New kernel in GRUB
New kernel in GRUB

Removing the New Kernel in Case of Issues

1. Reboot into Old Kernel

Sometimes, a new kernel can cause problems in CentOS, and you may wish to remove it. To do this, you will need to reboot into the old kernel.

$ sudo reboot

2. Use Yum to Remove New Kernel

Now, we will use `yum` to remove the new kernel from the system. To do this, run:

NOTE: The kernel version can be tab-completed.

NOTE: You will be prompted by yum to enter “y”.

Removing the new kernel
Removing the new kernel

3. Reboot into the Old, Working Kernel

Now, reboot the system. The new, problematic kernel should not appear in the bootloader, and you should be able to boot regularly.

Removing the Old Kernel when Everything Works

1. Ensure you are Using the New Kernel

Before we can remove the old kernel version, we must ensure that we are not using it already. To do this, run:

$ uname -r

If you are not using the new kernel, reboot the system and select it in the bootloader.

2. Use Yum to Remove the Old Kernel

Now, we can use yum to remove the old kernel version. For this, you will need to run:

$ sudo yum remove kernel-3.10.0-957.el7.x86_64

Removing the old kernel
Removing the old kernel

Conclusion

Now that you have installed the latest Linux kernel in CentOS, and are familiar with the process of installing and uninstalling new kernel versions, you can reap the benefits of the new kernel, such as more kernel functions and higher performance.

Brandon Hammond
Hello, my name is Brandon Hammond, I am an avid Linux enthusiast, programmer, and contributor here at FOSS Linux. Linux is one of my passions, and when I'm not attending college I'm usually tinkering with it in a VM.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,533FansLike
366FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

Top 10 Reasons to use Xfce as your Desktop Environment

There are many choices for desktop environments for Linux based operating systems. Mainly, you can install any DE of your choice on most of the Linux based distributions, even if they are not offered as a package officially. In our recent articles, we discussed the best of KDE and Cinnamon. In this article, we wish to present to you the top reasons why you should consider Xfce as your desktop environment.

The 10 Best Linux Network Monitoring Tools

Having total control over your network is essential to prevent programs from overusing your network resources and slowing down the overall performance. This is why you should install a network monitoring tool on your system, giving you a visual overview of everything that's happening on your network. Networking Tools are like swiss-knife for the system administrators for troubleshooting system issues.

How to install CouchPotato on Ubuntu

Downloading movies and copying them over to your home server can get frustrating, especially if you are doing it daily! What if you have an option to download videos automatically, quickly, and above all with excellent quality. CouchPotato allows you to download movies easily once they are available and released automatically.

Top 20 Rsync Examples in Linux

The Rsync (remote sync) command is a Linux/Unix utility used to synchronize and copy files and directories either locally or remotely. Most Linux geeks use Rsync to mirror, backup or migrate data across folders, across disks and networks. One notable feature with the Rsync command is that it uses the "delta transfer algorithm."

Setting up NFS Server on Ubuntu Server

We have put together a detailed step-by-step tutorial that will guide you on how to install and set up NFS Server on Ubuntu so you too can start sharing data with other client systems. It is divided into sections, the first part discussing how to set up the host server and the second part showing you how to set up the client-side. For this tutorial, we will be using Ubuntu 20.04 LTS.

Crontab in Linux Explained With Examples

Crontab is the Linux equivalent of the Window's Task Scheduler. It can help you set up a task to run automatically at a regular...

MUST READ

Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

5 Best Application Launchers for Ubuntu

Ubuntu is one of the most used Linux distributions worldwide. It is also the reason why it has the maximum number of available programs for itself. Today we are going to talk about one category of those programs, the application launchers.

5 Best Notepad++ Alternatives for Linux

Notepad++ has been the de facto standard for source code editors for nearly 16 years, almost since its creation in 2003.  For Windows users, that is.  For years, Linux users had no source code editor that compared to Notepad++ with all its bells and whistles, such as code folding, scripting, markup languages, syntax highlighting, auto-completion for programming (limited).

How to dual-boot Ubuntu and Fedora on your PC

Every Linux distribution has its capabilities and preferences as per the user requirements. That brings forth the need to run different distros on one laptop. For example, a CyberSecurity enthusiast might prefer to use Ubuntu for development and Kali Linux for penetration testing.

6 Essential Command-Line Utilities Every Linux User Should Know

Last week, we shared with you several "cool and fun" commands to get comfortable and confident with the Linux command-line. In our quest to further aid Linux users with mastery of the command line, or CLI, we present you with a variety of command-line utilities essential for all Linux users, regardless of proficiency level.