Install Linux Kernel 4.9 In CentOS and Ubuntu

Install Linux Kernel 4.9 In CentOS and Ubuntu

Linux Kernel 4.9 has been released a week ago with updated features and bug fixes. The merge window for next version 4.10 has already been opened and the development is going on. For more details, check the release notes in the following link.

In this guide, I am going to explain how to install Linux Kernel 4.9 version in CentOS 7 and Ubuntu 16.04 LTS.

Install Linux Kernel 4.9 in CentOS 7

I successfully installed and tested Kernel 4.9 on CentOS 7 64 bit edition as described below. Although, It might work on other RPM versions such as RHEL 7, Scientific Linux 7 and Fedora etc.

To install the latest kernel, we need to add ELRepo repository.

First, let us add ELRepo GPG key:

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

Then, add ELRepo in CentOS 7 / RHEL 7 / Scientific Linux 7 using command:

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

To Install ELRepo for CentOS 6 / RHEL 6 / Scientific Linux 6:

rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm

To Install ELRepo for CentOS 5 / RHEL 5 / Scientific Linux 6:

rpm -Uvh http://www.elrepo.org/elrepo-release-5-5.el5.elrepo.noarch.rpm

Enable ELRepo fastest mirror by installing the following package:

yum install yum-plugin-fastestmirror

Sample output:

[…]Dependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Updating: yum-plugin-fastestmirror noarch 1.1.31-40.el7 base 32 kTransaction Summary================================================================================Upgrade 1 PackageTotal download size: 32 kIs this ok [y/d/N]: yDownloading packages:No Presto metadata available for baseyum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm | 32 kB 00:02 Running transaction checkRunning transaction testTransaction test succeededRunning transactionWarning: RPMDB altered outside of yum. Updating : yum-plugin-fastestmirror-1.1.31-40.el7.noarch 1/2 Cleanup : yum-plugin-fastestmirror-1.1.31-34.el7.noarch 2/2 Verifying : yum-plugin-fastestmirror-1.1.31-40.el7.noarch 1/2 Verifying : yum-plugin-fastestmirror-1.1.31-34.el7.noarch 2/2 Updated: yum-plugin-fastestmirror.noarch 0:1.1.31-40.el7 Complete!

We have added the ELRepo. Now, it is time to install Linux kernel 4.9.

Let us find out the current version details with command:

uname -r

Sample output:

3.10.0-327.22.2.el7.x86_64

So, the currently installed Linux Kernel version is 3.10.0-327.22.2.el7.x86_64.

Now, let us install Linux Kernel 4.9 by running the following command from Terminal:

yum –enablerepo=elrepo-kernel install kernel-ml

After installing the Kernel, Reboot your system and select the latest Kernel from the Grub boot menu.

Once you successfully logged-in to the system, run the following command to verify whether latest the latest Linux Kernel has been installed or not:

uname -r

Sample output:

4.9.0-1.el7.elrepo.x86_64

Congratulations! You have successfully updated the Linux Kernel. Now, your system is powered by most recent stable Linux Kernel 4.9 version.

If have encountered with any problems after installing the new Linux Kernel? No worries, reboot your system. Select your previously working Kernel from the Boot menu.

Finally, remove the newly installed Kernel using command:

yum remove kernel-ml

That’s it.

Install Linux Kernel 4.9 LTS in Ubuntu 16.04 LTS

I tested this guide in Ubuntu 16.04 LTS server. However, this guide should work on newer and as well as older Ubuntu versions, Debian, and Linux Mint etc.

Let us check the currently installed Linux kernel version with command:

uname -r

Sample output:

4.4.0-34-generic

As you see, my Ubuntu 16.04 system is running with 4.4.0-34-generic kernel version.

Now, we will install Linux Kernel 4.9. You can download the latest kernel from the following link.

For 64 bit Ubuntu systems:

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-headers-4.9.0-040900_4.9.0-040900.201612111631_all.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-headers-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-image-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb

For 32 bit Ubuntu systems:

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-headers-4.9.0-040900_4.9.0-040900.201612111631_all.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-headers-4.9.0-040900-generic_4.9.0-040900.201612111631_i386.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-image-4.9.0-040900-generic_4.9.0-040900.201612111631_i386.deb

Finally, install Linux Kernel 4.9 using command:

sudo dpkg -i *.deb

Sample output:

Selecting previously unselected package linux-headers-4.9.0-040900.(Reading database … 136211 files and directories currently installed.)Preparing to unpack linux-headers-4.9.0-040900_4.9.0-040900.201612111631_all.deb …Unpacking linux-headers-4.9.0-040900 (4.9.0-040900.201612111631) …Selecting previously unselected package linux-headers-4.9.0-040900-generic.Preparing to unpack linux-headers-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb …Unpacking linux-headers-4.9.0-040900-generic (4.9.0-040900.201612111631) …Selecting previously unselected package linux-image-4.9.0-040900-generic.Preparing to unpack linux-image-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb …Done.Unpacking linux-image-4.9.0-040900-generic (4.9.0-040900.201612111631) …Setting up linux-headers-4.9.0-040900 (4.9.0-040900.201612111631) …Setting up linux-headers-4.9.0-040900-generic (4.9.0-040900.201612111631) …Setting up linux-image-4.9.0-040900-generic (4.9.0-040900.201612111631) …Running depmod.update-initramfs: deferring update (hook will be called later)Examining /etc/kernel/postinst.d.run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.9.0-040900-generic /boot/vmlinuz-4.9.0-040900-genericrun-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.9.0-040900-generic /boot/vmlinuz-4.9.0-040900-genericupdate-initramfs: Generating /boot/initrd.img-4.9.0-040900-genericW: mdadm: /etc/mdadm/mdadm.conf defines no arrays.run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.9.0-040900-generic /boot/vmlinuz-4.9.0-040900-genericrun-parts: executing /etc/kernel/postinst.d/update-notifier 4.9.0-040900-generic /boot/vmlinuz-4.9.0-040900-genericrun-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.9.0-040900-generic /boot/vmlinuz-4.9.0-040900-genericGenerating grub configuration file …Found linux image: /boot/vmlinuz-4.9.0-040900-genericFound initrd image: /boot/initrd.img-4.9.0-040900-genericFound linux image: /boot/vmlinuz-4.4.0-57-genericFound initrd image: /boot/initrd.img-4.4.0-57-genericFound linux image: /boot/vmlinuz-4.4.0-34-genericFound initrd image: /boot/initrd.img-4.4.0-34-genericFound linux image: /boot/vmlinuz-4.4.0-22-genericFound initrd image: /boot/initrd.img-4.4.0-22-genericdone

Finally, update the Grub boot loader with command:

sudo update-grub

Sample output:

Generating grub configuration file …Found linux image: /boot/vmlinuz-4.9.0-040900-genericFound initrd image: /boot/initrd.img-4.9.0-040900-genericFound linux image: /boot/vmlinuz-4.4.0-57-genericFound initrd image: /boot/initrd.img-4.4.0-57-genericFound linux image: /boot/vmlinuz-4.4.0-34-genericFound initrd image: /boot/initrd.img-4.4.0-34-genericFound linux image: /boot/vmlinuz-4.4.0-22-genericFound initrd image: /boot/initrd.img-4.4.0-22-genericdone

If you’re using BURG boot loader, then run:

sudo update-burg

Reboot your system and log in to the newly installed Kernel.

Check if new Kernel has been installed with command:

uname -r

Sample output:

4.9.0-040900-generic

If you have any problems after upgrading the Kernel, force reboot your system, and login to the old Kernel by selecting the ‘Advanced options for Ubuntu’ option from the Boot menu.

Select the old Kernel which is working without any issues.

Then uninstall the new Kernel with command:

sudo apt-get remove linux-headers-4.9* linux-image-4.9*

Finally, reboot your system once again to log in to the old Kernel.

Additional Tip: If you encountered with an Error in Oracle VirtualBox like below after upgrading to Kernel 4.x version, refer the following link.

I got this error after upgrading the Kernel version.

Kernel driver not installed (rc=-1908)

If you encountered with similar error, refer the following guide to fix the problem.

You may also like...

Leave a Reply

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