Install the latest kernel and enable BBR script with one click

888u

Last update at :2024-02-03,Edit by888u

This article is transferred to Teddy Bear Boss’s blog. The original link is https://teddysun.com/489.html. Google’s TCP BBR congestion control algorithm has been included in various versions starting from Linux 4.9. This article The key BBR installation package is only suitable for operating systems such as CentOS 6+, Debian 7+, Ubuntu 12+ and KVM, Xen, VMware and other virtual environments (excluding OpenVZ).

1. This script has been installed in Vultr passed. 2. When the script detects that the virtual mode of the VPS is OpenVZ, it will prompt an error and automatically exit the installation. 3. If you find that the computer cannot be started after restarting after running the script, open VNC in the VPS backend control panel, the computer will be stuck in grub boot, and you can manually select the kernel. 4. Since the latest version of the system kernel is used, it is best not to install it in a production environment to avoid unpredictable consequences.

How to use

Log in as root user and run the following command:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh

After the installation is complete, the script will prompt that you need to restart the VPS. Enter y and press Enter to restart. After the restart is complete, enter the VPS to verify whether the latest kernel is successfully installed and TCP BBR is enabled. Enter the following command:

uname -r

Check the kernel version. If it shows the latest version, it means OK

sysctl net.ipv4.tcp_available_congestion_control

The return value is generally: net.ipv4.tcp_available_congestion_control = bbr cubic reno Or for: net.ipv4.tcp_available_congestion_control = reno cubic bbr

sysctl net.ipv4.tcp_congestion_control

The return value is generally: net.ipv4.tcp_congestion_control = bbr

sysctl net.core.default_qdisc

The return value is generally: net.core.default_qdisc = fq

lsmod | grep bbr

If the tcp_bbr module is returned in the return value, it means that bbr has been started. Note: Not all VPS will have this return value. If not, it is normal.

How to install the latest version of kernel headers under CentOS

Originally I planned to install kernel-ml-headers directly in the script, but there would be conflicts with the original kernel headers. Therefore, add a tutorial here to manually install the latest version of kernel headers after the script is executed. Execute the following command

yum --enablerepo=elrepo-kernel -y install kernel-ml-headers

Depending on the CentOS version, an error message similar to the following will generally appear:

Error: kernel-ml-headers conflicts with kernel-headers-2.6.32-696.20.1.el6.x86_64 Error: kernel-ml-headers conflicts with kernel-headers-3.10.0-693.17.1.el7.x86_64

Therefore, you need to uninstall the original kernel headers first, and then install the latest kernel headers. Execute command:

yum remove kernel-headers

After confirming that everything is correct, enter y and press Enter to start uninstalling. Note that sometimes this operation will also uninstall some installation packages that depend on kernel headers, such as gcc, gcc-c++ and the like. But it doesn’t matter, we can install it again after installing the latest version of the kernel headers. After the uninstallation is complete, execute the installation command given above again.

yum --enablerepo=elrepo-kernel -y install kernel-ml-headers

After successful installation, just install the installation packages that previously relied on kernel headers, such as gcc, gcc-c++, etc.

Why do you need to install the latest version of kernel headers? This is because the shadowsocks-libev version has a tcp fast open function. If it is not installed, this function cannot be turned on.

Kernel upgrade method

If it is a CentOS system, execute the following command to upgrade the kernel:

yum -y install kernel-ml kernel-ml-devel

If you also manually installed the new version of kernel headers, you also need the following command to upgrade the headers:

yum -y install kernel-ml-headers

For CentOS 6, execute the command:

sed -i 's/^default=.*/default=0/g' /boot/grub/grub.conf

For CentOS 7, execute the command:

grub2-set-default 0

If it is a Debian/Ubuntu system, you need to manually download the latest version of the kernel to install the upgrade. Go here to download the latest version of the kernel deb installation package. If the system is 64-bit, the linux-image downloaded for amd64 contains the generic deb package; If the system is 32-bit, the linux-image downloaded for i386 contains the generic deb package; The installation command is as follows (the latest version of 64-bit 4.12.4 is used as an example, please replace it with the downloaded deb package):

dpkg -i linux-image-4.12.4-041204-generic_4.12.4-041204.201707271932_amd64.deb

After the installation is complete, execute the command:

/usr/sbin/update-grub

Finally, just restart the VPS.

Special instructions

If you are using Google Cloud Platform (GCP) to replace the kernel, sometimes the entire disk becomes read-only after restarting. Just execute the following command to restore:

mount -o remount rw /

Recommended site searches: domain name registration official website, US vps server, free space application, free personal cloud server outside mainland China, PHP space purchase, top ten server brands, asp host, free stable space, which Hong Kong space is better to register net,

Install the latest kernel and enable BBR script with one click

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码