Learn the steps to install the Linux kernel 5.19 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.
Steps to change default Kernel in Ubuntu 22.04 | 20.04 LTS
1. 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. Update & install 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 a tool as well.
sudo apt update && sudo apt upgrade
sudo apt install wget
3. 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. Install Linux 5.19 Kernel on Ubuntu 22.04 | 20.04
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:
sudo ubuntu-mainline-kernel.sh -i v5.19.1
(optional) To install the latest available:
sudo ubuntu-mainline-kernel.sh -i
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
6. 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 kernel v5.19.1
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.