一、Debian/Ubuntu TCP BBR 改进版/增强版
这是啥玩意,我就不仔细介绍了.
自动选择最新的非rc版本(候选发布版),进行安装.
安装时会自动卸载旧内核,不会弹出任何窗口,无需人工干预.
更新:
[2017.07.12]
支持用户自行指定内核版本(需要与 -f 命令同时使用).
下载地址:
wget --no-check-certificate -qO \'BBR.sh\' \'https://moeclub.org/attachment/LinuxShell/BBR.sh\' && chmod a x BBR.sh
使用方法:
//普通模式,最后需要按下回车才会重启. bash BBR.sh //强制模式,全自动(如果中间不报错),不需要按下回车. bash BBR.sh -f //指定安装内核版本,以4.11.9为例. bash BBR.sh -f v4.11.9
检测:
//重启后运行以下命令,结果不为空,则开启BBR成功. lsmod |grep \'bbr\'
代码
#!/bin/bash [ "$EUID" -ne \'0\' ] && echo "Error,This script must be run as root! " && exit 1 [ $# -gt \'1\' ] && [ "$1" == \'-f\' ] && tmpKernelVer="$2" || tmpKernelVer=\'\'; KernelVer=\'\'; KernelBitVer=\'\'; [ -z "$(dpkg -l |grep \'grub-\')" ] && echo "Not found grub." && exit 1 MainURL=\'http://kernel.ubuntu.com/~kernel-ppa/mainline\' [ -n "$tmpKernelVer" ] && { wget -qO /dev/null "$MainURL/$tmpKernelVer" [ $? -ne \'0\' ] && echo \'Please input a vaild kernel version! exp: v4.11.9.\' && exit 1 KernelVer="$tmpKernelVer" } [ -z "$tmpKernelVer" ] && { KernelVerBIG="$(wget -qO- "$MainURL" |awk -F \'/">|href="\' \'{print $2}\' |sed \'/rc/d;/^$/d\' |tail -n1)" [ -n "$KernelVerBIG" ] && KernelVer="$(wget -qO- "$MainURL" |awk -F \'/">|href="\' \'{print $2}\' |sed \'/rc/d;/^$/d\' |grep \'\'${KernelVerBIG}\'\' |sort -n |tail -n1)" } [ -z "$KernelVer" ] && echo \'Error,Get Kernel fail! \' && exit 1 ReleaseURL="$(echo -n "$MainURL/$KernelVer")" KernelBit="$(getconf LONG_BIT)" [ "$KernelBit" == \'32\' ] && KernelBitVer=\'i386\' [ "$KernelBit" == \'64\' ] && KernelBitVer=\'amd64\' [ -z "$KernelBitVer" ] && echo "Error! " && exit 1 KernelFile="$(wget -qO- "$ReleaseURL" |awk -F \'">|href="\' \'/generic.*.deb/{print $2}\' |grep \'image\' |grep "$KernelBitVer" |head -n1)" echo -ne "Download New Kernel\n\t$KernelFile\n" wget -qO "$KernelFile" "$ReleaseURL/$KernelFile" echo -ne "Install New Kernel\n\t$KernelFile\n" dpkg -i "$KernelFile" >/dev/null 2>&1 Newest="$(echo "$KernelFile" |awk -F \'_\' \'{print $1}\')" KernelList="$(dpkg -l |grep \'linux-image\' |awk \'{print $2}\')" [ -z "$(echo $KernelList |grep -o "$Newest")" ] && echo "Install error." && exit 1 for KernelTMP in `echo "$KernelList"` do [ "$KernelTMP" != "$Newest" ] && echo -ne "Uninstall Old Kernel\n\t$KernelTMP\n" && DEBIAN_FRONTEND=noninteractive dpkg --purge "$KernelTMP" >/dev/null 2>&1 done [ "$(dpkg --get-selections |grep \'linux-image\' |awk \'{print $2}\' |grep \'^install\' |wc -l)" != \'1\' ] && echo "Error, uninstall old Kernel." && exit 1 update-grub >/dev/null 2>&1 echo "pre-Loading TCP BBR ..." [ ! -f /etc/sysctl.conf ] && touch /etc/sysctl.conf sed -i \'/net.core.default_qdisc.*/d\' /etc/sysctl.conf sed -i \'/net.ipv4.tcp_congestion_control.*/d\' /etc/sysctl.conf echo "net.core.default_qdisc=fq" >>/etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" >>/etc/sysctl.conf echo "Finish! " [ "$1" == \'-f\' ] && { echo "It will reboot now..." } || { read -n 1 -p "Press Enter to reboot..." INP if [ "$INP" != \'\' ] ; then echo -ne \'\b \n\' fi } sleep 3 && reboot
二、增强版/改进版/魔改版bbr安装
一键地址:
wget --no-check-certificate -qO \'BBR_POWERED.sh\' \'https://moeclub.org/attachment/LinuxShell/BBR_POWERED.sh\' && chmod a x BBR_POWERED.sh && bash BBR_POWERED.sh //指定内核版本(以v4.11.9内核版本为例): wget --no-check-certificate -qO \'BBR_POWERED.sh\' \'https://moeclub.org/attachment/LinuxShell/BBR_POWERED.sh\' && chmod a x BBR_POWERED.sh && bash BBR_POWERED.sh -f v4.11.9
说明:
执行过程中会重新编译模块.
模块默认为开机自动加载.
模块名称:tcp_bbr_powered
可用 modprobe tcp_bbr_powered 命令进行加载模块.
可执行 lsmod |grep \'bbr_powered\'
结果不为空,则加载模块成功
可执行 sysctl -w net.ipv4.tcp_congestion_control=bbr_powered 使用此模块.
以上只是说明,直接使用一键脚本即可.
完整代码
#!/bin/bash [ "$EUID" -ne \'0\' ] && echo "Error,This script must be run as root! " && exit 1 [ $# -gt \'1\' ] && [ "$1" == \'-f\' ] && tmpKernelVer="$2" || tmpKernelVer=\'\'; [ -z "$(dpkg -l |grep \'grub-\')" ] && echo "Not found grub." && exit 1 which make >/dev/null 2>&1 [ $? -ne \'0\' ] && { echo "Install make..." DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make >/dev/null 2>&1 which make >/dev/null 2>&1 [ $? -ne \'0\' ] && { echo "Error! Install make. " exit 1 } } which awk >/dev/null 2>&1 [ $? -ne \'0\' ] && { echo "Install awk..." DEBIAN_FRONTEND=noninteractive apt-get install -y -qq gawk >/dev/null 2>&1 which awk >/dev/null 2>&1 [ $? -ne \'0\' ] && { echo "Error! Install awk. " exit 1 } } which gcc >/dev/null 2>&1 [ $? -ne \'0\' ] && { echo "Install gcc..." DEBIAN_FRONTEND=noninteractive apt-get install -y -qq gcc >/dev/null 2>&1 which gcc >/dev/null 2>&1 [ $? -ne \'0\' ] && { echo "Error! Install gcc. " echo "Please \'apt-get update\' and try again! " exit 1 } } GCCVER="$(readlink `which gcc` |grep -o \'[0-9].*\')" GCCVER1="$(echo $GCCVER |awk -F. \'{print $1}\')" GCCVER2="$(echo $GCCVER |awk -F. \'{print $2}\')" [ -n "$GCCVER1" ] && [ "$GCCVER1" -gt \'4\' ] && CheckGCC=\'0\' || CheckGCC=\'1\' [ "$CheckGCC" == \'1\' ] && [ -n "$GCCVER2" ] && [ "$GCCVER2" -ge \'9\' ] && CheckGCC=\'0\' [ "$CheckGCC" == \'1\' ] && { echo "The gcc version require gcc-4.9 or higher. " echo "You can try apt-get install -y gcc-4.9 or apt-get install -y gcc-6" echo "Please upgrade it manually! " exit 1 } KernelVer=\'\'; KernelBitVer=\'\'; MainURL=\'http://kernel.ubuntu.com/~kernel-ppa/mainline\' [ -n "$tmpKernelVer" ] && { wget -qO /dev/null "$MainURL/$tmpKernelVer" [ $? -ne \'0\' ] && echo \'Please input a vaild kernel version! exp: v4.11.9.\' && exit 1 KernelVer="$tmpKernelVer" } [ -z "$tmpKernelVer" ] && { KernelVerBIG="$(wget -qO- "$MainURL" |awk -F \'/">|href="\' \'{print $2}\' |sed \'/rc/d;/^$/d\' |tail -n1)" [ -n "$KernelVerBIG" ] && KernelVer="$(wget -qO- "$MainURL" |awk -F \'/">|href="\' \'{print $2}\' |sed \'/rc/d;/^$/d\' |grep \'\'${KernelVerBIG}\'\' |sort -n |tail -n1)" } [ -z "$KernelVer" ] && echo \'Error,Get Kernel fail! \' && exit 1 ReleaseURL="$(echo -n "$MainURL/$KernelVer")" KernelBit="$(getconf LONG_BIT)" [ "$KernelBit" == \'32\' ] && KernelBitVer=\'i386\' [ "$KernelBit" == \'64\' ] && KernelBitVer=\'amd64\' [ -z "$KernelBitVer" ] && echo "Error! " && exit 1 HeadersFile="$(wget -qO- "$ReleaseURL" |awk -F \'">|href="\' \'/generic.*.deb/{print $2}\' |grep \'headers\' |grep "$KernelBitVer" |head -n1)" [ -n "$HeadersFile" ] && HeadersAll="$(echo "$HeadersFile" |sed \'s/-generic//g;s/_\'${KernelBitVer}\'.deb/_all.deb/g\')" [ -z "$HeadersAll" ] && echo "Error! Get Linux Headers for All." && exit 1 echo "$HeadersFile" | grep -q "$(uname -r)" [ $? -ne \'0\' ] && echo "Error! Header not be matched by Linux Kernel." && exit 1 echo -ne "Download Kernel Headers for All\n\t$HeadersAll\n" wget -qO "$HeadersAll" "$ReleaseURL/$HeadersAll" echo -ne "Install Kernel Headers for All\n\t$HeadersAll\n" dpkg -i "$HeadersAll" >/dev/null 2>&1 echo -ne "Download Kernel Headers\n\t$HeadersFile\n" wget -qO "$HeadersFile" "$ReleaseURL/$HeadersFile" echo -ne "Install Kernel Headers\n\t$HeadersFile\n" dpkg -i "$HeadersFile" >/dev/null 2>&1 echo -ne "Download BBR POWERED Source code\n" [ -e ./tmp ] && rm -rf ./tmp mkdir -p ./tmp && cd ./tmp [ $? -eq \'0\' ] && { wget --no-check-certificate -qO- \'https://moeclub.org/attachment/LinuxSoftware/bbr/tcp_bbr_powered.c.deb\' >./tcp_bbr_powered.c echo \'obj-m:=tcp_bbr_powered.o\' >./Makefile make -s -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=`which gcc` echo "Loading TCP BBR POWERED..." [ -f ./tcp_bbr_powered.ko ] && [ -f /lib/modules/$(uname -r)/modules.dep ] && { cp -rf ./tcp_bbr_powered.ko /lib/modules/$(uname -r)/kernel/net/ipv4 depmod -a >/dev/null 2>&1 } modprobe tcp_bbr_powered [ ! -f /etc/sysctl.conf ] && touch /etc/sysctl.conf sed -i \'/net.core.default_qdisc.*/d\' /etc/sysctl.conf sed -i \'/net.ipv4.tcp_congestion_control.*/d\' /etc/sysctl.conf echo "net.core.default_qdisc = fq" >>/etc/sysctl.conf echo "net.ipv4.tcp_congestion_control = bbr_powered" >>/etc/sysctl.conf } lsmod |grep -q \'bbr_powered\' [ $? -eq \'0\' ] && { sysctl -p >/dev/null 2>&1 echo "Finish! " exit 0 } || { echo "Error, Loading BBR POWERED." exit 1 }
三、锐速/lotserver/serversprrder安装
update:2017.5.26
*.修改官方update源码,现在可以正常使用,可更新到最新二进制文件.
用法:
bash /appex/bin/serverSpeeder.sh update
*.可以通过renewLic自定义宽带,可自行尝试.
用法:
bash /appex/bin/serverSpeeder.sh renewLic 1000G
—–
update:2017.5.21
*.添加大量lotServer二进制文件,更新版本号到 3.11.20.10 .
*.加速效果更明显,减少崩溃几率.
—–
update:2017.3.8
*.完整的屏蔽验证,解决断流现象.
*.完善锐速启动脚本,修正Debian/Ubuntu不能正常自启动.
—–
1.支持自动检测公网网卡,采用官方检测网卡的方式.
2.支持自动匹配内核(可强制安装指定内核版本的锐速,此项专为CentOS设置,仅需查看锐速支持状况).
3.添加询问是否开启accppp功能.
(实测并开启后没有效果,开启前请确认安装了相关软件,否则会出现报错.)
4.默认设置为G口宽带.(听说设置大点可以提高速度)
5.支持一键完全卸载(此脚本安装的无残留).
6.完美支持官方renewLic命令.
7.所需文件均来自GitHub,完全公开.
8.不支持自动更换内核,请自行更换.(网上教程非常多)
9.不支持OpenVZ,不需要尝试,会告诉你找不到网卡.
#.吐槽:CentOS居然连which都要自己安装,内核那么多!
心好累.脚本将就着看吧.
—–
##.除此脚本外,所有内容均来自互联网.本人不负任何法律责任,仅供学习使用.
#1.使用前请日常update.
#2.如果您是最小化安装系统,请确认您的系统能够执行ifconfig等命令.
#3.关于配置,请查看文章最后手册调教手册,调教后效果更好.
#4.如遇许可证错误,请用/appex/bin/serverSpeeder.sh renewLic命令更新许可证.
#5.如需加速更大带宽,请点此自定义许可证,并手动替换.(默认带宽:1G.)
CentOS如有安装困难,请参照: CentOS不换内核安装锐速 .
GitHub项目地址:
https://github.com/0oVicero0/serverSpeeder_Install
serverSpeeder support:
https://github.com/0oVicero0/serverSpeeder_kernel/blob/master/SystemList.md
安装脚本
wget --no-check-certificate -qO /tmp/appex.sh "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh" && bash /tmp/appex.sh \'install\'
卸载脚本
wget --no-check-certificate -qO /tmp/appex.sh "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh" && bash /tmp/appex.sh \'uninstall\'
高级自定义安装
wget --no-check-certificate -qO /tmp/appex.sh "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh" && bash /tmp/appex.sh \'{serverSpeeder of Kernel Version}\'
使用方法:
启动命令 /appex/bin/serverSpeeder.sh start
停止加速 /appex/bin/serverSpeeder.sh stop
状态查询 /appex/bin/serverSpeeder.sh status
更新许可 /appex/bin/serverSpeeder.sh renewLic
重新启动 /appex/bin/serverSpeeder.sh restart
调教手册:
https://github.com/0oVicero0/serverSpeeder_Install/blob/master/lotServer.pdf
文章评论