Learn the steps to install the latest Linux kernel version on Ubuntu 20.04 LTS Focal fossa or Ubuntu 22.04 Jammy Jelly Fish to change the default one using the command terminal.
The kernel is the core program of any Linux -based operating system that offers meditation between the software and hardware of the computer system. That implies on any hardware device running with some software. And when we wrap it with a layer of graphical user interface and other applications around the kernel, we have a full-fledged Linux operating system such as Ubuntu. Well, Kernel keeps work in the background and takes care that the operating system works and that hardware and software can be put into operation.
Well, the “Linux kernel” is not the right term to use there is one Linux and that is the so-called kernel. All popular operating systems based on this GNU kernel are referred to as “Linux operating systems”.
In short a Linux distro is – Kernel + GUI (X server) + software + additional tools = Desktop Linux operating system. Whereas the server Linux skips the GUI part to become a pure command-line server.
Hence, whenever, we install a Linux distro such as Ubuntu, a kernel will install automatically because without it the entire system would not be able to run. Also, we can update and download Kernels on Ubuntu just like any other package, here we will see how.
Steps to change default Kernel in Ubuntu 22.04 | 20.04 LTS
1. Check your current Kernel version
Before changing the default kernel of your Ubuntu Linux, let’s first check what exactly the current version is running on our system. For that open your command terminal, if you are using the GUI desktop version, then it can be opened using the keyboard shortcut – Ctrl+Alt+T.
2. Run system update & have wget
Let’s first make sure everything on our system is up to date and then we will move to the next step. Hence, first, run the apt update & upgrade command plus also install
wget tool as well.
sudo apt update && sudo apt upgrade
sudo apt install wget
3. Download the Bash script to change the kernel
Although, the user can directly download the Kernel Deb binary package from Ubuntu’s Linux repository; however, to easily install, update and uninstall Kernels on Ubuntu 22.04 | 20.04 LTS, we can use the script available on GitHub. Use the given command to download the script 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 ubuntu-mainline-kernel.sh
sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/
4. Check available Kernel versions to install
We have the script in its place, now we can use it to check what are versions available to install in addition to the one already existing on our system.
To find the latest version available to install:
Whereas to list all the available Kernel versions that you can install are:
5. Change or upgrade default Ubuntu 22.04 | 20.04 Kernel version
Well, now we can either update the default version or change it to any other available one we want but first, install it. Here is the command:
To install the latest available:
sudo ubuntu-mainline-kernel.sh -i
6. To install any specific or old version:
sudo ubuntu-mainline-kernel.sh -i version-number
Note: Replace the “version-number“ in the above command with the one you want to install, for example, to get the version v5.15.11 instead the latest one then the command will be:
sudo ubuntu-mainline-kernel.sh -i v5.15.1
Once the installation is completed, we can use the same script to list what are the available versions of Kernel on our system:
sudo ubuntu-mainline-kernel.sh -l
Reboot your system
Restart your system to let your system use the latest installed kernel version.
After the system reboot, check your current version by using:
This time you will see the latest one.
7. Change or Set Default Kernel Version
By default, Ubuntu will pick the latest installed version of Kernel automatically but if you want to set some other version choose that to start with the boot. In that case, we manually tell the system to choose which version.
Next, edit the Grub file.
sudo nano /etc/default/grub
Add the following two lines, to get an idea you can see the screenshot.
Save the file Ctrl+O, hit the Enter Key, and then exit it Ctrl+X.
Now reboot your system:
And 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.
8. Uninstall or Remove
To remove any existing kernel from your system, run:
sudo ubuntu-mainline-kernel.sh -u
Select the serial number of the version you want to completely remove from your system.
• How To Install Linux Kernel 5.x on Almalinux 8 or Rocky
• Install Bpytop on Ubuntu 22.04/20.04
• Whatsdesk- Install WhatsApp Client on Ubuntu 22.04 | 20.04
• 3 Ways to install and use HandBrake Video convertor on Ubuntu 20.04 / 22.04