首先打开Ubuntu-Kernel官网如下:
https://kernel.ubuntu.com/~kernel-ppa/mainline/
往下翻,找到最新版内核,比如v5.8版,下面就以5.8版内核为范例演示,点开amd64,会看到一堆deb文件,如图:
选择图片中标记的3个文件下载:
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.8/amd64/linux-headers-5.8.0-050800_5.8.0-050800.202008022230_all.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.8/amd64/linux-image-unsigned-5.8.0-050800-generic_5.8.0-050800.202008022230_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.8/amd64/linux-modules-5.8.0-050800-generic_5.8.0-050800.202008022230_amd64.deb
然后执行安装:
dpkg -i *.deb
更新grub: update-grub
重启: /sbin/reboot
到此新内核安装完毕,下面就是删除旧内核了。
删除旧内核
首先查看一下内核有没有切换过来:
uname -r
再就是查看机器中存在的所有内核:
dpkg --get-selections |grep linux-
root@vultr:~# dpkg --get-selections |grep linux-
binutils-x86-64-linux-gnu install
linux-base install
linux-firmware install
linux-generic install
linux-headers-4.15.0-106 install
linux-headers-4.15.0-106-generic install
linux-headers-5.8.0-050800 install
linux-headers-5.8.0-050800-generic install
linux-headers-generic install
linux-image-4.15.0-106-generic install
linux-image-generic install
linux-image-unsigned-5.8.0-050800-generic install
linux-libc-dev:amd64 install
linux-modules-4.15.0-106-generic install
linux-modules-5.8.0-050800-generic install
linux-modules-extra-4.15.0-106-generic install
下面就是删除多余的内核了,比如上面的4.15.0-106内核
apt remove 内核版本号
#比如下面的4.15.0-106版内核
apt remove linux-headers-4.15.0-106 linux-headers-4.15.0-106-generic linux-image-4.15.0-106-generic linux-modules-4.15.0-106-generic linux-modules-extra-4.15.0-106-generic
删除之后我们再来查看一下内核:
dpkg --get-selections |grep linux-
root@vultr:~# dpkg --get-selections |grep linux-
binutils-x86-64-linux-gnu install
linux-base install
linux-firmware install
linux-generic install
linux-headers-5.8.0-050800 install
linux-headers-5.8.0-050800-generic install
linux-headers-generic install
linux-image-4.15.0-106-generic deinstall
linux-image-generic install
linux-image-unsigned-5.8.0-050800-generic install
linux-libc-dev:amd64 install
linux-modules-4.15.0-106-generic deinstall
linux-modules-5.8.0-050800-generic install
linux-modules-extra-4.15.0-106-generic deinstall
dpkg -P 版本号
#还是以上面的4.15.0-106版内核为例
dpkg -P linux-image-4.15.0-106-generic linux-modules-4.15.0-106-generic linux-modules-extra-4.15.0-106-generic
执行后,旧内核也就清理干净了。当然刚刚下载的deb包也可以删除掉,这个就不多说了。
开启BBR
自Linux内核4.9版以后已经是默认自带了bbr,所以升级内核后就不需要另外安装bbr。只需要配置一下sysctl文件即可。
添加bbr配置:
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
重载sysctl:
sysctl -p
检查bbr运行状态:
lsmod | grep bbr
出现bbr字样,也就说明开启成功了。