一、下载内核文件
[root@host ~]# uname -sr #查看内核版本
[root@host ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org #安装秘钥文件
[root@host ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm #下载elrepo包
[root@host ~]# yum --enablerepo=elrepo-kernel install kernel-ml -y #安装内核
二、修改默认启动内核版本,将启动时内核选择为最新版内核
- 第一种方式:
[root@host ~]# sed -i s/saved/0/g /etc/default/grub
[root@host ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
- 第二种方式:
显示开机时显示的所有选项
[root@host ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux 7 (Core), with Linux 3.10.0-229.14.1.el7.x86_64
1 : CentOS Linux 7 (Core), with Linux 3.10.0-229.4.2.el7.x86_64
2 : CentOS Linux 7 (Core), with Linux 3.10.0-229.el7.x86_64
3 : CentOS Linux 7 (Core), with Linux 0-rescue-605f01abef434fb98dd1309e774b72ba
如果没有grub.cfg,生成他:
[root@host ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
查看default:
[root@host ~]# grub2-editenv list
#设置default
[root@host ~]# grub2-set-default "CentOS Linux 7 (Core), with Linux 3.10.0-229.14.1.el7.x86_64"
安装BBR模块,bbr算法,提高系统吞吐量。
运行 lsmod | grep bbr,如果结果为空,则需先加载BBR模块并设置自动加载:
[root@host ~]# modprobe tcp_bbr
[root@host ~]# echo "tcp_bbr" >> /etc/modules-load.d/modules.conf
在sysctl.conf中配置BBR,在 /etc/sysctl.conf文件末尾添加两行
[root@host ~]# vi /etc/sysctl.conf
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
然后执行 sysctl -p让配置生效。