X
X
Worldwide (English) USD 0

Welcome

Sign in

Knowledge Base

HomepageKnowledge BaseUpgrade Kernel on CentOS 8.x, AlmaLinux 8.x an...

Upgrade Kernel on CentOS 8.x, AlmaLinux 8.x and Rocky Linux 8.x

Upgrading the Kernel on CentOS 8.x / AlmaLinux 8.x / Rocky Linux 8.x

Before proceeding , as always make sue you have a snapshot or backup or your system.

The article was written on 26 June 2021. The current Kernel versions where longterm:5.4.128 and stable:5.12.13.

 

To update the Kernel, we will use a fairly reliable external repository called elrepo.

As opposed to Red Hat, CentOS / AlmaLinux / Rocky Linux allows the use of elrepo, a third-party repository that makes the upgrade to a recent version a kernel.

 

Step 1. Install elrepo

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

The screen will take a second then return you to a prompt, that is normal.

Run: dnf install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm

install ELRepo repo

Enter "y", and Press "Enter"

You should see the below:

ELRepo installed

We are going to use nano to edit some test files, so now is a good time to make sure you have it installed.
If not take a quick second to install it using: dnf install nano
If you use vi, that is fine also.
But all screenshots show nano.

 

Step 2. Enabling elrepo to install updated kernel(s)

Run: cd /etc/yum.repos.d

then

Run: ls

You should see a repo named elrepo.repo

Run: nano elrepo.repo

Scroll down to the section [elrepo-kernel]

Enable ELRepo repo kernel elrepo-kernel

Change enabled=0 to enabled=1

elrepo is not configured to install, and auto update kernels when you run dnf update.

 

Step3. Installing New Kernel

Now there are 2 kernel versions available: longterm and stable

If you are not sure what these are, take a quick visit to The Linux Kernel Archives at : https://www.kernel.org/

To Install the recommended longterm kernel - Run: dnf install kernel-lt

Or if you prefer the latest stable kernel - Run: dnf install kernel-ml

 

In the example below, we install the longterm kernel:

dnf install kernel-lt

Enter "y", and Press "Enter"

Installation:

kernel-lt installed

 

Step 4. Set Default Kernel in Grub

 

To make the newly-installed version the default boot option, you will have to modify the GRUB configuration as follows:

Run: cd /etc/default

then

Run: nano grub

 

You will see:

default grub configuration

Delete the line: GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"

Delete Line

Change GRUB_DEFAULT=saved to GRUB_DEFAULT=0 (ZERO, NOT o)

Change to 0

 

Next, we are going to update the kernel boot configuration.

Run: grub2-mkconfig -o /boot/grub2/grub.cfg

On a new system, you should see:

 

Then we just need to Reboot the system, Run: shutdown -r now

After it's rebooted, just SSH or log back in.

Run: uname -r

You should see the new kernel version:

uname-r kernel version check

Which shows the current longterm kernel version was installed, and is running.

Congrats You Are Done!

 

Now when you run dnf update, if there is a kernel update, it will update as well.

If you do NOT want to automatically update the kernel for some reason, you can disable it by changing the 1 back to a 0 under [elrepo-kernel].

Then to manually update the kernel you would have to Run: dnf --enablerepo=elrepo-kernel install kernel-lt (or kernel-ml)

 

Last Updated: 2021 June 26

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?
(79 times viewed / 0 people found it helpful)
Copyright © 2023 All Rights Reserved
Powered by WISECP
G-CKH47PBJ1Q Top