How to Install Latest Kernel 5.0 in Ubuntu

[‘

n

Periodically new devices and technology coming out and it’s important to keep our Linux system kernel up-to-date if we want to get the most of out it.

n

Moreover, updating system kernel will ease us to take advantage of new kernel functions and also it helps us to protect ourselves from vulnerabilities that have been found in earlier versions.

n

Suggested Read: How to Upgrade Kernel in CentOS 7

n

Ready to update your kernel on Ubuntu and Debian or one of their derivatives such as Linux Mint? If so, keep reading!

n

Check Installed Kernel Version

n

To find the current version of installed kernel on our system we can do:

n

$ uname -srrn

n

The following shows the output of the above command in a Ubuntu 18.04 server:

n

Linux 4.15.0-42-genericrn

n

Upgrading Kernel in Ubuntu Server

n

To upgrade the kernel in Ubuntu, go to http://kernel.ubuntu.com/~kernel-ppa/mainline/ and choose the desired version (Kernel 5.0 is the latest at the time of writing) from the list by clicking on it.

n

Next, download the .deb files for your system architecture using wget command.

n

Download Linux Kernel for 32-Bit System

n

$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.0/linux-headers-5.0.0-050000_5.0.0-050000.201903032031_all.debrn$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.0/linux-headers-5.0.0-050000-generic_5.0.0-050000.201903032031_i386.debrn$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.0/linux-image-5.0.0-050000-generic_5.0.0-050000.201903032031_i386.debrn$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.0/linux-modules-5.0.0-050000-generic_5.0.0-050000.201903032031_i386.debrn

n

Download Linux Kernel for 64-Bit System

n

$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.0/linux-headers-5.0.0-050000_5.0.0-050000.201903032031_all.debrn$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.0/linux-headers-5.0.0-050000-generic_5.0.0-050000.201903032031_amd64.debrn$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.0/linux-image-unsigned-5.0.0-050000-generic_5.0.0-050000.201903032031_amd64.debrn$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.0/linux-modules-5.0.0-050000-generic_5.0.0-050000.201903032031_amd64.debrn

n

Once you’ve downloaded all the above kernel files, now install them as follows:

n

$ sudo dpkg -i *.debrn

n

Sample Output

n

(Reading database ... 140176 files and directories currently installed.)rnPreparing to unpack linux-headers-5.0.0-050000_5.0.0-050000.201903032031_all.deb ...rnUnpacking linux-headers-5.0.0-050000 (5.0.0-050000.201903032031) over (5.0.0-050000.201903032031) ...rnPreparing to unpack linux-headers-5.0.0-050000-generic_5.0.0-050000.201903032031_amd64.deb ...rnUnpacking linux-headers-5.0.0-050000-generic (5.0.0-050000.201903032031) over (5.0.0-050000.201903032031) ...rnPreparing to unpack linux-image-unsigned-5.0.0-050000-generic_5.0.0-050000.201903032031_amd64.deb ...rnUnpacking linux-image-unsigned-5.0.0-050000-generic (5.0.0-050000.201903032031) over (5.0.0-050000.201903032031) ...rnSelecting previously unselected package linux-modules-5.0.0-050000-generic.rnPreparing to unpack linux-modules-5.0.0-050000-generic_5.0.0-050000.201903032031_amd64.deb ...rnUnpacking linux-modules-5.0.0-050000-generic (5.0.0-050000.201903032031) ...rnSetting up linux-headers-5.0.0-050000 (5.0.0-050000.201903032031) ...rnSetting up linux-headers-5.0.0-050000-generic (5.0.0-050000.201903032031) ...rnSetting up linux-modules-5.0.0-050000-generic (5.0.0-050000.201903032031) ...rnSetting up linux-image-unsigned-5.0.0-050000-generic (5.0.0-050000.201903032031) ...rnProcessing triggers for linux-image-unsigned-5.0.0-050000-generic (5.0.0-050000.201903032031) ...rn/etc/kernel/postinst.d/initramfs-tools:rnupdate-initramfs: Generating /boot/initrd.img-5.0.0-050000-genericrn/etc/kernel/postinst.d/x-grub-legacy-ec2:rnSearching for GRUB installation directory ... found: /boot/grubrnSearching for default file ... found: /boot/grub/defaultrnTesting for an existing GRUB menu.lst file ... found: /boot/grub/menu.lstrnSearching for splash image ... none found, skipping ...rnFound kernel: /boot/vmlinuz-4.15.0-42-genericrnFound kernel: /boot/vmlinuz-4.15.0-29-genericrnFound kernel: /boot/vmlinuz-5.0.0-050000-genericrnFound kernel: /boot/vmlinuz-4.15.0-42-genericrnFound kernel: /boot/vmlinuz-4.15.0-29-genericrnReplacing config file /run/grub/menu.lst with new versionrnUpdating /boot/grub/menu.lst ... donernrn/etc/kernel/postinst.d/zz-update-grub:rnGenerating grub configuration file ...rnFound linux image: /boot/vmlinuz-5.0.0-050000-genericrnFound initrd image: /boot/initrd.img-5.0.0-050000-genericrnFound linux image: /boot/vmlinuz-4.15.0-42-genericrnFound initrd image: /boot/initrd.img-4.15.0-42-genericrnFound linux image: /boot/vmlinuz-4.15.0-29-genericrnFound initrd image: /boot/initrd.img-4.15.0-29-genericrndonern

n

Once the installation is complete, reboot your machine and verify that the new kernel version is being used:

n

$ uname -srrn

n

Verify Kernel Version in Ubuntu
Verify Kernel Version in Ubuntu

n

And that’s it. You are now using a much more recent kernel version than the one installed by default with Ubuntu.

n

Summary

n

In this article we’ve shown how to easily upgrade the Linux kernel on Ubuntu system. There is yet another procedure which we haven’t showed here as it requires compiling the kernel from source, which is not recommended on production Linux systems.

n

If you’re still interested in compiling the kernel as a learning experience, you will get the instructions on how to do it at the Kernel Newbies page.

n

As always, feel free to use the form below if you have any questions or comments about this article.

n

‘]