❤️ AZDIGI has officially updated to a new blog system. However, some posts may have incorrect or mismatched images. Please click the Report article button at the bottom of the post so AZDIGI can update as quickly as possible. Thank you!
This guide only applies to SSD KVM VPS service.
By default, Ubuntu 16.04 now comes with a kernel version 4.4.0-21-generic . You can manually check the kernel version on the VPS using the following command:
uname -r
To change another kernel version for Ubuntu 16.04 operating system, you can follow the following instructions.
Find kernel versionFirst, we will find the kernel version available in the apt package with the following two commands:
sudo apt-get update apt-cache search --names-only linux-imageA list of kernel versions will appear, you just need to find the version you need to install and change the version number in the installation command below:
sudo apt-get install linux-image-4.4.0-75-generic linux-headers-4.4.0-75-genericIf the system asks you to create the file
/boot/grub/menu.lst , please choose Y .
For kernel version not in library
If you need to install a kernel version that is unavailable in the library, find the kernel version at http://kernel.ubuntu.com/~kernel-ppa/mainline/. You choose the folder for the version you want to download and download the two filesgeneric and all for amd64. For example:
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.24/linux-headers-4.9.24-040924-generic_4.9.24-040924.201704210431_amd64.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.24/linux-image-4.9.24-040924-generic_4.9.24-040924.201704210431_amd64.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.24/linux-headers-4.9.24-040924_4.9.24-040924.201704210431_all.debThen install all the downloaded files:
sudo dpkg -i *.debNow you can follow the steps below to finish.
Set kernel version at boot
Edit the/etc/default/grub file
nano /etc/default/grubFind
GRUB_DEFAULT=0 and change to GRUB_DEFAULT=saved . Then add the following 2 sentences below:
GRUB_SAVEDEFAULT=true GRUB_DISABLE_SUBMENU=yThen recreate the
grub.cfg file:
export GRUB_CONFIG=sudo find /boot -name "grub.cfg"And rebuild this file:
sudo update-grubNext, we will use the following command to display the list of installed kernel versions:
grep 'menuentry ' $GRUB_CONFIG | cut -f 2 -d "'" | nl -v 0Now, if you need to use which kernel version, you just need to use the grub-set-default command to set it up. For example, if you want to use the kernel version with the ordinal number 0, use the command:
grub-set-default 0Note that we do not use recovery mode versions.
And reboot the VPS.
rebootAfter the VPS reboot is complete, log in to VPS again and check the kernel version with the
uname -rcommand. You might also like
About the author
Thạch Phạm
Đồng sáng lập và Giám đốc điều hành của AZDIGI. Có hơn 15 năm kinh nghiệm trong phổ biến kiến thức liên quan đến WordPress tại thachpham.com, phát triển website và phát triển hệ thống.