CentOS Linux 7.x runs the Linux kernel version 3.10.xx. Both RHEL and CentOS does not provide an updated version of Linux kernel. RHEL backports patches for the Linux kernel version 3.10.xx. However, it is posssilbe to compile your own kernel or install pre built kernel using a third party repo. This tutorial shows you how to install the latest stable (mainline stable) Linux kernel version on a CentOS 7 using yum command. The following instructions should work on RHEL 7.x and clones such as Oracle 7.x, Scientific Linux and more.
Before you being
You can find out the current Linux kernel version using any one of the following command:$ cat /proc/version
Sample outputs:
Linux version 3.10.0-514.21.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Jun 20 12:24:47 UTC 2017
Or use old good uname command:$ uname -mrs
Sample outputs:
Linux 3.10.0-514.21.2.el7.x86_64 x86_64
Finally, use the cat command to see the contains of /etc/centos-release file:$ cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core)
How To Check Linux Kernel Version
Step 1 – Enable ELRepo
From the project home page:
It is an RPM repository for Enterprise Linux packages. ELRepo supports Red Hat Enterprise Linux (RHEL) and its derivatives (Scientific Linux, CentOS & others). The ELRepo Project focuses on hardware related packages to enhance your experience with Enterprise Linux. This includes filesystem drivers, graphics drivers, network drivers, sound drivers, webcam and video drivers.
Import the public key
Warning: Please note that installing a new kernel not officially supported by both RHEL and CentOS project. It is also possible that your system may not boot. As the kernel-ml/lt packages are built from the source tar balls provided by kernel.org without any modifications to the code, they can contain some differences when compared to the CentOS/RHEL distribution kernels. Hence, you must keep backups of all important files before you do this.
Grab the GPG key using wget command:$ wget https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
Check the fingerprint of the GPG key with the gpg command to make sure it matches the key published by elrepo.$ gpg --quiet --with-fingerprint RPM-GPG-KEY-elrepo.org
Sample outputs:
pub 1024D/BAADAE52 2009-03-17 elrepo.org (RPM Signing Key for elrepo.org) <secure@elrepo.org> Key fingerprint = 96C0 104F 6315 4731 1E0B B1AE 309B C305 BAAD AE52 sub 2048g/B8C66E6D 2009-03-17 |
If the fingerprint matches, import the GPG key with the rpm command.$ sudo rpm --import RPM-GPG-KEY-elrepo.org
Install ELRepo for CentOS 7
Again using the wget command.$ wget http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Sample outputs:
--2017-06-25 19:06:34-- http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm Resolving www.elrepo.org (www.elrepo.org)... 69.195.83.87 Connecting to www.elrepo.org (www.elrepo.org)|69.195.83.87|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 8584 (8.4K) [application/x-rpm] Saving to: ‘elrepo-release-7.0-2.el7.elrepo.noarch.rpm’ 100%[===================================================================================================================================>] 8,584 --.-K/s in 0s 2017-06-25 19:06:34 (163 MB/s) - ‘elrepo-release-7.0-2.el7.elrepo.noarch.rpm’ saved [8584/8584] |
Step 2 – Install elrepo
Type the following yum command:# yum install elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Sample outputs:
Step 3 – List all packages in the yum elrepo repositories available to be installed
Type the following yum command to list all packages in elrepo-kernel repo:$ yum list available --disablerepo='*' --enablerepo=elrepo-kernel
Sample outputs:
* elrepo-kernel: repos.lax-noc.com Available Packages kernel-lt.x86_64 4.4.73-1.el7.elrepo elrepo-kernel kernel-lt-devel.x86_64 4.4.73-1.el7.elrepo elrepo-kernel kernel-lt-doc.noarch 4.4.73-1.el7.elrepo elrepo-kernel kernel-lt-headers.x86_64 4.4.73-1.el7.elrepo elrepo-kernel kernel-lt-tools.x86_64 4.4.73-1.el7.elrepo elrepo-kernel kernel-lt-tools-libs.x86_64 4.4.73-1.el7.elrepo elrepo-kernel kernel-lt-tools-libs-devel.x86_64 4.4.73-1.el7.elrepo elrepo-kernel kernel-ml.x86_64 4.11.7-1.el7.elrepo elrepo-kernel kernel-ml-devel.x86_64 4.11.7-1.el7.elrepo elrepo-kernel kernel-ml-doc.noarch 4.11.7-1.el7.elrepo elrepo-kernel kernel-ml-headers.x86_64 4.11.7-1.el7.elrepo elrepo-kernel kernel-ml-tools.x86_64 4.11.7-1.el7.elrepo elrepo-kernel kernel-ml-tools-libs.x86_64 4.11.7-1.el7.elrepo elrepo-kernel kernel-ml-tools-libs-devel.x86_64 4.11.7-1.el7.elrepo elrepo-kernel perf.x86_64 4.11.7-1.el7.elrepo elrepo-kernel python-perf.x86_64 4.11.7-1.el7.elrepo elrepo-kernel |
Where,
- Long term support kernel package name is kernel-lt version 4.4.xx
- Mainline stable kernel package name is kernel-ml version 4.11.xx
Step 4 – Install kernel version
To install long term support kernel, run:# yum --disablerepo='*' --enablerepo=elrepo-kernel install kernel-lt
To install mainline stable kernel, run:# yum --disablerepo='*' --enablerepo=elrepo-kernel install kernel-ml
Sample outputs:
Step 5 – Boot into new kernel
Type the following reboot command to reboot the Linux box:# reboot
OR# shutdown -r now
OR# shutdown -r 0
Step 6 – Verification
Find out the current Linux kernel version using any one of the following command:$ cat /proc/version
Sample outputs:
Linux version 4.11.7-1.el7.elrepo.x86_64 (mockbuild@Build64R7) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Sat Jun 24 09:49:01 EDT 2017
Or use old good uname command:$ uname -mrs
Sample outputs:
Linux 4.11.7-1.el7.elrepo.x86_64 x86_64
Conclusion
I strongly suggest that if you need the latest kernel for hardware support/drivers, get Fedora Linux latest. My professional opinion is you only use distro supplied kernel for security reasons on server or cloud computing. However, Linux or CentOS does not restrict your freedom. Another option is to compile Linux kernel from the source code itself.
And there you have it, the latest version of mainline Linux kernel up and running on a CentOS Linux 7.x. For more info see the project home page here.