How To Install or Update Latest Kernel in CentOS 7

Tutorial on how to install or update to the latest version of Kernel a CentOS 7 Linux system.

The main base of any distro of Linux is its core or kernel because, thanks to him, each operating system works properly shape we see today. The kernel fulfills two fundamental functions that are:

  • Manage each operating system resource making it more productive and this implies improvements in the performance and stability of the system.
  • Being a bridge between the hardware and software to carry out all the tasks performed in this.

In this opportunity we will see how to update the latest kernel version in a CentOS 7 environment. According to the official Kernel website, the current version is 4.15.7.

To be aware of the new versions of the kernel in Linux we can go to the following official link: KERNEL VERSIONS

https://www.kernel.org/

Check Current Kernel version in CentOS 7

First we must know what is the current version of kernel that we are running in CentOS 7 and for this we will run the following command. We can see that the current version is 3.10.0.

uname -r

-r

Besides this step, it is essential that we take into account that each kernel has a life cycle before being renewed.

Update Kernel in CentOS 7

Once we have in mind that our kernel is outdated we will start the update process of this one.

First of all we must install a repository where we will obtain the latest version of the kernel directly from the official kernel.org site since, by default, using yum and the official repositories, we will not have the opportunity to access the latest version of it.

In this case we will use the repositories of the elrepo website, for this we execute the following lines in their order:

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

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

Once the repository is installed, we will run the next line to observe the available kernel packages:

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

We must focus on the mainline packages (kernel-ml.x86_64) and verify that its most current version is 4.15.7. Now we proceed to the installation of this kernel by executing the following:

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

Once the process is finished, we reboot the machine and execute the following command to check the new version of the kernel:

uname -sr

Set Default Value in the CentOS 7 kernel

When starting the operating system, we can verify that there is a kernel version selected by default, in this case it will be 3.10 because version 4.15.7was not installed directly from the official repository.

We could just use the arrow keys to select version 4.15 but sometimes we are not present, and the process starts with the default value.

To change this and establish that the default value is version 4.15 it will be necessary that we access and edit the file / etc / default / grub:

nano /etc/default/grub/etc/default/grub

There it will be necessary to edit the value of the GRUB_DEFAULT line from saved to 0.

The value zero indicates that the default value will be the first line of the options. We save the changes using the key combination Ctrl + O, and we left the editor using Ctrl + X.

Now we will execute the following line to refresh the GRUB configuration:

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

When restarting the computer we can see that the default option is 4.15.

As simple as that we can update the CentOS 7 kernel and make the most of its new features and functionalities.

Similar Posts

Leave a Reply

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