centos升级内核
centos内核升级缓慢,Ubuntu16已经更新到最新的4.4!!!不过也得益于软件的依赖和稳定性,centos7还在用3.10内核。记录下centos7更换内核的过程,同时开启谷歌最新TCP BBR拥塞控制算法。
一、升级系统
1 2 |
yum update -y yum upgrade -y |
二、安装elrepo并升级内核
1 2 3 |
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm yum --enablerepo=elrepo-kernel install kernel-ml -y |
输出如下,会输出最新的内核(现在最新为4.10)安装成功:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Transaction Summary ================================================================================ Install 1 Package Total download size: 39 M Installed size: 169 M Downloading packages: kernel-ml-4.9.0-1.el7.elrepo.x86_64.rpm | 39 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. Installing : kernel-ml-4.9.0-1.el7.elrepo.x86_64 1/1 Verifying : kernel-ml-4.9.0-1.el7.elrepo.x86_64 1/1 Installed: kernel-ml.x86_64 0:4.9.0-1.el7.elrepo Complete! |
三、查看内核,并更新grub文件,然后重启
1 2 3 |
egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \' grub2-set-default 0 reboot |
四、查看内核是否替换成功
1 |
uname -a |
输出如下,则成功:
1 |
4.10.0-1.el7.elrepo.x86_64 |
五、开启BBR算法,vi /etc/sysctl.conf,增加
1 2 |
net.core.default_qdisc = fq net.ipv4.tcp_congestion_control = bbr |
六、生效
1 |
sysctl -p |
七、检查是否开启成功
1 2 3 4 5 6 7 8 9 |
# 输入 sysctl net.ipv4.tcp_available_congestion_control # 输出 net.ipv4.tcp_available_congestion_control = bbr cubic reno # 或输入 lsmod | grep bbr # 输出类似 tcp_bbr 16384 1 # 成功 |