Install Linux Kernel 6.2 in Ubuntu 22.04 | 20.04 Linux

Ubuntu is one of the most popular operating systems built on top of the Linux kernel, developed by Linus Torvalds. However, installing the kernel on Ubuntu OS is not as straightforward, therefore in this article, we will learn the steps to install any latest available Linux kernel version on Ubuntu OS.

The Linux Kernel is the main part of any operating system and is responsible for bridging hardware and software together. Developers can use Kernel to modify operating systems to suit specific needs or tasks. Therefore, it’s a valuable part required for the proper functioning of the complete Ubuntu Linux OS.

Note: “The mainline kernel builds are produced for debugging purposes and therefore come with no support. Use them at your own risk”

In this article, we learn how to install Linux Kernel 6.2 on Ubuntu 22.04 or 20.04 Linux to get the advantages and improvements of this Kernel version on an existing system.

Update Ubuntu 22.04 | 20.04 Linux Kernel to version 6.2

The given steps in this tutorial are not just limited to Ubuntu only, even we can use them for Linux Mint, Debian, POP OS, and other similar Linux systems.

1. Check the Current Ubuntu Kernel version

Well, it is good to know which version of the Kernel is on our Ubuntu system before installing a new one. To do that, on your Ubuntu access the command terminal. The GUI desktop users can use the keyboard shortcut Ctrl+Alt+T to open the terminal app. After that run the given command:

uname -r

2. Update Ubuntu 22.04 or 20.04

It is a good practice to make your system always up to date. However, if you haven’t then first run the system update command to ensure all the system packages are up to date. After that also install wget which we require later in this article.

sudo apt update && sudo apt upgrade
sudo apt install wget

3. Download Ubuntu mainline kernel installer

Well, we don’t need to use any script to install the latest Linux kernel package on Ubuntu, because it is available as Debian binary to install. 

However, to easily install, update and uninstall Linux Kernels on Ubuntu 22.04 | 20.04  LTS, we can use the Ubuntu Mainline Kernel script available on GitHub. Use the given command to download it on your Ubuntu system.


Once the script is on your system, make it executable and move it to /usr/local/bin to easily use it in the future to get the latest version of the kernel.

chmod +x
sudo mv /usr/local/bin/

4. Find the latest version of the Linux Kernel

We can use the Ubuntu Mainline Kernel script to find what is the latest available version of the Linux kernel to install on our Ubuntu system. For that on your command terminal run: -c

If the latest version is different from the one installed on your system, the script will display that.

Whereas to list available Kernel series (versions) that you can install using the script, use this terminal command: -r
Find the latest available version of Linux kernel using command

5. Installing Linux 6.2 Kernel on Ubuntu

To install the latest Linux kernel package which is available in the repository of, we can use

sudo -i

However, if you have some special requirements and looking for some specific kernel version then after the -i parameter mention the exact version you want. For example: for 6.2, we can use:

sudo -i v6.2.0

If you have installed multiple Linux kernel versions on our Ubuntu using this script then to list all of them we can use:

sudo -l
Installing Linux 6.2 Kernel on Ubuntu

6. Reboot your system

Restart your system to let it use the kernel version you have just configured.

sudo reboot

After the system reboots, check your current version by using:

uname -r

This time you will see the latest one.

7. Change or Set the Default Kernel Version

Ubuntu is configured to use the latest available Linux version on the system, by default. However, due to any reason, if you want to change that, then edit the Grub file.

sudo nano /etc/default/grub

Add the following two lines, to get an idea you can see the screenshot.

Set Default Kernel Version of Ubuntu

Save the file Ctrl+O, hit the Enter Key, and then exit it Ctrl+X. This will save our preference of the default kernel in the Boot menu and will not reset it with the system reboot until we change it.

Update Grub:

sudo update-grub

Now reboot your system:

sudo reboot

As you start your system, press the Esc button to get the Grub menu. Select “Advanced options for Ubuntu” and then select the Kernel version you want to set as the default one on your system.

open Advance options for Ubuntu 22.04
Install Linux Kernel 6.2 on Ubuntu 22.04 or 20.04

8. Uninstall Linux kernel v6.2.0

To remove any existing Ubuntu Linux kernel from your system you have installed using the script, run again mainline tool command:

sudo -u

Select the serial number of the version you want to completely remove from your system.

Uninstall Ubuntu Linux Kernel 6.2

You can even use the PPA of Ubuntu Mainline to update or downgrade the Ubuntu Linux kernel.


What is Ubuntu mainline?

The Mainline kernel is a term used for the latest available version of the Linux kernel that has recently been released by the developers but is still under development. Whereas Ubuntu mainline is a script that is available on GitHub and allows users to install the latest mainline and even the old or previous kernel versions from the repository.

How to install Mainline in Ubuntu?

  • Open the Ubuntu command terminal window.
  • Download Ubuntu mainline script, the command is given in this article for that.
  • After that use the sudo -i command.
  • This will install the latest Mainlin version on your Ubuntu Linux.

What are the three types of kernels?

A kernel is the core of any operating system which acts as a bridge between the hardware and software in a computer.

There are three main types of kernels: monolithic kernels, microkernels, and hybrid kernels.

Monolithic Kernels are the most commonly used type of kernel. They contain all device drivers and core OS services within one large block of code which makes them more efficient and less prone to errors.

Microkernels are another type of kernel that only contains essential operating system functions, such as memory management, process scheduling, and inter-process communication. As its name suggests this arrangement reduces its size and complexity but makes it more difficult to debug.

“Hybrid Kernels” – as the name suggest it is a mixture of two kernels. Developers took the best aspects of monolithic kernels and microkernels by having both essential components and device drivers all within the same block of code. This makes such kernels more efficient and less prone to errors than microkernels but with better scalability than monolithic kernels.

1 thought on “Install Linux Kernel 6.2 in Ubuntu 22.04 | 20.04 Linux”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.