Upgrading Kernel and Enabling BBR on Linode CentOS 7

Publish: 2017-02-21 | Modify: 2017-03-22

Linode has launched a $5 package (1 core, 1GB RAM), which offers great value for money. If you need it, you can click here for more information: Linode推出5$套餐,新用户注册送20$. If you want to use it for running ss, the speed may not be sufficient, but fortunately, there is a black technology called Google BBR.

centos7_small

I have previously shared a one-click script by 秋水逸冰 in the article CentOS一键升级内核并开启Google BBR, but I found that the script cannot upgrade the kernel for Linode VPS because the Linode kernel is modified by the official. The correct method is to first install Grub2 and then upgrade the kernel. Let me share the implementation method.

安装elrepo提供的kernel4.9

Add elrepo source by copying and pasting the following code into the SSH terminal and press Enter:

cat > /etc/yum.repos.d/elrepo.repo << EOF
[elrepo-kernel]
name=ELRepo.org Community Enterprise Linux Kernel Repository - el7
baseurl=http://elrepo.org/linux/kernel/el7/\$basearch/
        http://mirrors.coreix.net/elrepo/kernel/el7/\$basearch/
        http://jur-linux.org/download/elrepo/kernel/el7/\$basearch/
        http://repos.lax-noc.com/elrepo/kernel/el7/\$basearch/
        http://mirror.ventraip.net.au/elrepo/kernel/el7/\$basearch/
enabled=1
gpgcheck=0
EOF

Then, install elrepo to replace the 4.9 kernel and Grub2. Copy the command yum -y install kernel-ml grub2 and execute it. Use the command ls -l /boot/vmlinuz* to check if the kernel is successfully installed.

替换CentOS7内核

Copy and execute the following command:

[root@linode1495332 etc]# mkdir /boot/grub
[root@linode1495332 etc]# grub2-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.9.0-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.9.0-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-72863e389b584a4dab36fae7f3bffda2
Found initrd image: /boot/initramfs-0-rescue-72863e389b584a4dab36fae7f3bffda2.img
done

修改内核启动方式

Next, go to Linode Dashboard - Edit and select GRUB 2 as the boot method, as shown in the screenshot below.

linodedash

grub2

Then, reboot the server using the reboot command or restart it through the Linode dashboard. Login to the server again and use the command uname -r to check the kernel. If it displays > 4.9, the upgrade is successful.

[root@li1571-47 ~]# uname -r
4.9.10-1.el7.elrepo.x86_64
[root@li1571-47 ~]#

开启Google BBR

Execute the following command to add the configuration to the file:

cat >>/etc/sysctl.conf << EOF
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
EOF

Then execute sysctl -p to make the configuration file take effect. BBR has been successfully enabled. You can use the following methods to check.

[root@linode1495332 ~]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = bbr cubic reno
[root@linode1495332 ~]# lsmod | grep bbr
tcp_bbr                16384  70

Linode invitation registration: Linode注册, and enter the promo code: podcastinit2017 to get $20. This article refers to: Linode CentOS7开启Google TCP-BBR优化算法.


Comments