To update the kernel on CentOS, you’ll need to install a third-party repository called ElRepo. ElRepo offers the latest kernel version available from kernel.org.
The official releases are tested to ensure they work properly and do not destabilize applications and OS functions. There are two types of Linux kernel versions:
To check current kernel version on CentOS, open a command-line interface and enter following command:
Prior to upgrading the kernel, all packages must be updated to the latest version.
To update CentOS software repositories, use the command (this is included in the regular Centos7/VERDE install process):
To install the new kernel version, a new repository (ELRepo repository) needs to be enabled.
In a terminal window, type:
Next, install the ELRepo repository by executing the following command:
kernel-lt – signifying a stable long-term support release – or
kernel-ml – which indicates a mainline release, with a shorter support term but with more frequent updates.
Next, look at the right-hand column, and notice a series of letters and numbers (which looks something like ‘4.4.113-1.e17.elrepo’). This is the kernel version.
Use these two pieces of information to decide which kernel version you want to install. As you can see, the Linux 5 kernel is the latest mainline release.
To install the latest mainline kernel:
Allow the process to complete.
Reboot your system by running the command:
Use the arrow keys to select the Linux kernel you have just installed, then press
Enter. Your operating system should boot normally.
Take a moment to check the functionalities of your CentOS system. Does all your software launch correctly and without errors? Do all your network functions work correctly?
Put your new kernel through its paces so all errors are identified and fixed in time. Or, if there aren’t any fixes, you can opt to switch back to the old kernel.
Once you confirm that the new kernel is compatible and working correctly, you’ll want to edit the GRUB boot utility so that, by default, it loads your new kernel.
Navigate to /etc/default/ and open the grub file with your text editor. Or, type the following in the terminal:
Once the file opens, look for the line that says GRUB_DEFAULT=X, and change it to GRUB_DEFAULT=0 (zero). This line will instruct the boot loader to default to the first kernel on the list, which is the latest.