Installing or Updating the Linux Kernel 4.X on CentOS

Step 1 - Find current kernel version

Run the following command to know your current kernel:

uname -sr

Output:

Kernel Version

Step 2 - Enable ELRepo

To enable the ELRepo repository on CentOS 7, do:

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

Output:

ELRepo

Once the repository has been enabled, you can use the following command to list the available kernel related packages:

yum --disablerepo="*" --enablerepo="elrepo-kernel" list available

Output:

Kernel Packages

Step 3 - Install kernel

Run the following command to install the latest mainline stable kernel:

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

Output:

Kernel Packages

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

Open and edit the file /etc/default/grub and set GRUB_DEFAULT=0. This means that the first kernel in the GRUB list will be used as default.

vi /etc/default/grub

To insert/edit the file enter 'i' for insert mode and insert the following at End Of Fle. After inserting, save the file by hitting Esc key and then ':' [colon] followed by wq and enter

:wq

Output:

Grub config

Step 4 - Kernel configuration

Run the following command to recreate the kernel configuration:

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

Output:

grub

Step 5 - Verify the kernel version

Reboot and verify that the latest kernel is now being used by default using the uname command again:

uname -sr

Output:

Kernel version

You have upgraded your system kernel to the latest version available!


Last Modified: January 09 2018 20:50:04