Sometimes when running Ubuntu you need to use a different kernel than comes with the default installation. Only upgrade the kernel if you have a specific reason, such as needing a new driver or CPU support. But if you are an advanced user and know exactly what kernel you need, the following procedure makes it easy.
1. SSH into the Ubuntu server that you want to upgrade the kernel. Run the following commands to download a script and change the permissions:
wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh chmod +x ubuntu-mainline-kernel.sh sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/
2. If you want to find the latest version available, run the following command:
3. If you want to list all possible kernel options, run the command below:
4. To install a specific kernel version use the following command but substitute the kernel version you want to use.
sudo ubuntu-mainline-kernel.sh -i v5.19.17
5. After the install is complete, reboot.
6. SSH back into your VM and run the following command to verify you are running the kernel you selected:
Sometimes advanced users need to deviate from the default kernel that comes with Ubuntu. Maybe you need a new driver, or better CPU support for the latest generation of processors. The procedure I outlined above makes it quick and easy. If your server is a VM, I would suggest taking a snapshot or backup prior to the upgrade incase something goes wrong.