前面在CentOS6中搭建了SSR+BBR。最近Vultr VPS换成了CentOS7,安装BBR的时候提示错误
Error: Install latest kernel failed, please check it.
网上搜索了下,需要升级内核。
1.查看内核版本
[root@zjwx ~]# uname -sr
Linux 3.10.0-957.1.3.el7.x86_64
2.在CentOS7上启用ELRepo仓库
[root@zjwx ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@zjwx ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
3.查看elrepo仓库相关内核包
[root@zjwx ~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* elrepo-kernel: repos.lax-noc.com
elrepo-kernel | 2.9 kB 00:00:00
elrepo-kernel/primary_db | 1.8 MB 00:00:00
Available Packages
kernel-lt.x86_64 4.4.174-1.el7.elrepo elrepo-kernel
kernel-lt-devel.x86_64 4.4.174-1.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 4.4.174-1.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 4.4.174-1.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 4.4.174-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 4.4.174-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 4.4.174-1.el7.elrepo elrepo-kernel
kernel-ml.x86_64 4.20.10-1.el7.elrepo elrepo-kernel
kernel-ml-devel.x86_64 4.20.10-1.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 4.20.10-1.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 4.20.10-1.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 4.20.10-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 4.20.10-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 4.20.10-1.el7.elrepo elrepo-kernel
perf.x86_64 4.20.10-1.el7.elrepo elrepo-kernel
python-perf.x86_64 4.20.10-1.el7.elrepo
4.安装仓库中最新稳定内核
yum --enablerepo=elrepo-kernel install kernel-ml.x86_64
5.修改grub配置,将新内核设为默认启动项:GRUB_DEFAULT=0
[root@zjwx ~]# vim /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="consoleblank=0 crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
6.重新生成内核配置文件
[root@zjwx ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.20.10-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.20.10-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.5.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.5.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.1.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.1.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-84d6e1c3c43d427ab345edad898ac223
Found initrd image: /boot/initramfs-0-rescue-84d6e1c3c43d427ab345edad898ac223.img
Found linux image: /boot/vmlinuz-0-rescue-5f700273a9ae476faf579fb70f2aa7a0
Found initrd image: /boot/initramfs-0-rescue-5f700273a9ae476faf579fb70f2aa7a0.img
done
7.重启
[root@zjwx ~]# reboot
8.检查内核,升级到4表明成功
[root@zjwx ~]# uname -sr
Linux 4.20.10-1.el7.elrepo.x86_64
9.安装BBR
[root@zjwx ~]# wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh
---------- System Information ----------
OS : CentOS 7.6.1810
Arch : x86_64 (64 Bit)
Kernel : 4.20.10-1.el7.elrepo.x86_64
----------------------------------------
Auto install latest kernel for TCP BBR
URL: https://teddysun.com/489.html
----------------------------------------
Press any key to start...or Press Ctrl+C to cancel
Info: Your kernel version is greater than 4.9, directly setting TCP BBR...
Info: Setting TCP BBR completed...
内核大于4.9可直接开启BBR!
10.验证BBR是否开启
[root@zjwx ~]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic bbr
结果中显示包含bbr则成功。
至此,在CentOS7中升级内核安装BBR完成!