1. 安装
git clone https://github.com/pimlie/ubuntu-mainline-kernel.sh.git && \
cd ubuntu-mainline-kernel.sh/ && \
mv ubuntu-mainline-kernel.sh /usr/local/bin/
  1. 更换内核版本:
root@x:~# ubuntu-mainline-kernel.sh -i
Finding latest version available on kernel.ubuntu.com
Latest version is: v6.8.0, continue? (y/N)
Will download 6 files from kernel.ubuntu.com:
Downloading amd64/linux-headers-6.8.0-060800-generic_6.8.0-060800.202403131158_amd64.deb: 100%
Downloading amd64/linux-headers-6.8.0-060800_6.8.0-060800.202403131158_all.deb: 100%
Downloading amd64/linux-image-unsigned-6.8.0-060800-generic_6.8.0-060800.202403131158_amd64.deb: 100%
Downloading amd64/linux-modules-6.8.0-060800-generic_6.8.0-060800.202403131158_amd64.deb: 100%
Downloading amd64/CHECKSUMS: 100%
Downloading amd64/CHECKSUMS.gpg: 100%
Signature of checksum file has been successfully verified
Checksums of deb files have been successfully verified with sha256sum
Installing 4 packages
Cleaning up work folder
  1. 如果要删除不要的内核:
root@x:~# ubuntu-mainline-kernel.sh -u
Which kernel version do you wish to uninstall?
[0]: v6.6.8-060608
[1]: v6.8.0-060800
type the number between []: 0
Are you sure you wish to remove kernel version v6.6.8-060608? (y/N)
The following packages will be removed:
linux-headers-6.6.8-060608:amd64 linux-headers-6.6.8-060608:all linux-headers-6.6.8-060608-generic:amd64 linux-headers-6.6.8-060608-generic:all linux-image-6.6.8-060608-generic:amd64 linux-image-unsigned-6.6.8-060608-generic:amd64 linux-modules-6.6.8-060608-generic:amd64
Are you really sure? Do you still have another kernel installed? (y/N)
Kernel v6.6.8-060608 successfully purged```
  1. 重启
reboot
  1. 查看内核版本
root@x:~# uname -r
6.8.0-060800-generic