CentosControl PanelLinuxVesta CP

How to Install or Upgrade to Kernel 6.1 in CentOS 7/Centos 8/Stream, CWP7, aaPanel and VestaCP

In this tutorial we’ll updating/installing Kernel 6.1 on Linux OS – Centos 7/8 EL7/8. So what is kernel? -A kernel is the lowest level of easily replaceable software that interfaces with the hardware in your computer/server. It is responsible for interfacing all of your applications that are running in “user mode” down to the physical hardware, and allowing processes, known as servers, to get information from each other using inter-process communication (IPC).

ELRepo supports Red Hat Enterprise Linux (RHEL) and its derivatives such as Scientific Linux, CentOS Linux, Alma Linux and Rocky Linux.

In order to Update Kernel This requirements are mandatory :

  • Centos 7/Centos 8/stream with root access
  • KVM virtualization/any other full virtualization OR Dedicated Server
  • SSH/Terminal access

Let’s started with Kernel install/update procedure :

Check current kernel version :

uname -sr

Eg. output :

[root@server ~]# uname -sr
Linux 3.10.0-1160.15.2.el7.x86_64
Linux 4.18.0-338.el8.x86_64 #versions may vary

Now We’ll Start the procedure of Kernel upgrade on el7/8 CentOS 7/8 :

Enable the ELRepo repository on  CentOS 7, RHEL 7 and Scientific Linux, run the below commands :

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm

Enable the ELRepo repository on CentOS 8, RHEL 8, Alma Linux and Rocky Linux, run the below commands :

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm

You can retrieve latest download links on official page here

Now we’ll install Kernel 6.1 with the below command :

** at the time kernel 6.1 was available as latest version, for latest versions the procedure will be the same.

yum --enablerepo=elrepo-kernel install kernel-ml -y

Now kernel 6.1 will downloaded and installed this process will take some time to complete.

Now we need to add/modify config under /etc/default/grub :

nano /etc/default/grub

And put this line or modify the line if already exists to :


eg :

[root@server ~]# cat /etc/default/grub
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX="vconsole.keymap=us crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet"

*** here I’ve changed “GRUB_DEFAULT=saved” to “GRUB_DEFAULT=0”

Save the file and run this command to create the kernel configs :

CentOS 7/EL7 :

grub2-set-default 0
grub2-mkconfig -o /boot/grub2/grub.cfg

CentOS 8/Stream/EL8 :

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

That’s it reboot your server and check the kernel version again :

CentOS 7/EL7 :

uname -sr
[root@server ~]# uname -sr
Linux 6.1.6-1.el7.elrepo.x86_64

CentOS 8/Stream/EL8 :

uname -sr
[root@server ~]# uname -sr
Linux 6.1.6-1.el8.elrepo.x86_64

TO update Kernel on CentOS 7/EL7 :

yum clean all
yum --enablerepo=elrepo-kernel install kernel-ml
yum --enablerepo=elrepo-kernel update kernel-ml
grub2-mkconfig -o /boot/grub2/grub.cfg

TO update Kernel on CentOS 8/Stream/EL8 :

dnf clean all
dnf--enablerepo=elrepo-kernel install kernel-ml
or dnf --enablerepo=elrepo-kernel update kernel-ml grub2-mkconfig -o /boot/grub2/grub.cfg reboot

Clean Old Kernels :

CentOS 7/EL7 :

yum install yum-utils -y
package-cleanup --oldkernels --count=1

CentOS 8/Stream/EL8 :

dnf remove --oldinstallonly --setopt installonly_limit=2 kernel

Advanced cleanup (this will remove old kernel headers and tools):

rpm -qa kernel\* |sort -V
rpm -e --nodeps kernel-tools kernel-tools-libs kernel-headers

Eg. usage :

[root@srv1 ~]# rpm -qa kernel\* |sort -V

[root@srv1 ~]# rpm -e --nodeps kernel-tools-3.10.0-957.10.1.el7.x86_64 kernel-tools-libs-3.10.0-957.10.1.el7.x86_64 kernel-headers-3.10.0-957.10.1.el7.x86_64

TO install Latest Kernel-ML devel and tool package CentOS 7/EL7 :

yum remove kernel-tools kernel-tools-libs
yum --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml-tools

TO install Latest Kernel-ML devel and tool package CentOS 8/Stream/EL8 :

dnf remove kernel-tools kernel-tools-libs
dnf --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml-tools

Additional :

to check kernel saved entry :

grep saved /boot/grub2/grubenv

Sandeep B.

I'm a system admin and php developer and currently working as System Admin In CWP Control panel, expertise in Linux and Windows administration RHEL certified admin.

Related Articles


  1. Hi,

    Your solution not work for CWP (Centos Web Panel) and CWP PRO (Centos Web Panel Pro) !!!

    I made this update whit this guide from Kernel v3.x to Kernel v5.x but at the moment CWP PRO (Centos Web Panel Pro) for Centos 7 has reported it automatically and by itself to the Kernel v3.x !

    Please help me to solve this problem.

    Thanks in advance for the support.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button