升级Ubuntu内核的几种方法
注意:
Ubuntu主线内核由 Ubuntu 内核团队提供,用于测试和调试目的。
它们不受支持且不适合生产使用。
仅当它们可以解决当前内核遇到的关键问题时,才应该安装它们。
1、手动下载deb文件升级内核
来源:kernel.ubuntu.com/mainline
linux-image-X.Y.Z-generic-*.deb
linux-modules-X.Y.Z-generic-.deb
$ sudo dpkg --install *.deb
$ sudo reboot
2、用apt升级内核(推荐)
来源:Ubuntu 官方仓库,/etc/apt/sources.list 和 /etc/apt/sources.list.d/中记录的URL
http://cn.archive.ubuntu.com/ubuntu
升级包括内核的整个系统:
$ sudo apt-get update
$ sudo apt-get upgrade
只升级内核:
$ sudo apt-get upgrade linux-image-generic
$ sudo reboot
3、使用第三方工具升级内核
(1)Ukuu
Ubuntu kernel update utility,Gtk GUI和命令行工具,Ukuu19.01版本开始收费
来源:kernel.ubuntu.com
获取最新主线内核并自动安装。
(2)Mainline
Mainline (Ubuntu Mainline Kernel Installer) 是免费版 Ukuu 的开源分支
(3)UKTools
git clone https://github.com/usbkey9/uktools & cd uktools & make
来源:kernel.ubuntu.com/~kernel-ppa/mainline/
获取最新的稳定内核并自动安装
(4)LKU
git clone https://github.com/mtompkins/linux-kernel-utilities.git
update_ubuntu_kernel.sh - download and install a precompiled Ubuntu kernel from kernel.ubuntu.com
compile_linux_kernel.sh - poll www.kernel.org for available kernels and present the user with an xconfig GUI for manually selecting options.
remove_old_kernels.sh - purge ALL inactive kernels.
4、通过实时补丁服务升级内核(收费)
好处:不需要重启
(1)Canonical 实时补丁服务
从https://auth.livepatch.canonical.com/ 获取一个密钥
$ sudo snap install canonical-livepatch
$ sudo canonical-livepatch enable your-key
(2)KernelCare 实时补丁
从https://cloudlinux.com/kernelcare-free-trial5 获取一个30天免费试用密钥
$ sudo wget -qq -O - https://repo.cloudlinux.com/kernelcare/kernelcare_install.sh | bash
$ sudo /usr/bin/kcarectl --register KEY