查看内核版本

$ uname-r
3.10.0-1160.53.1.el7.x86_64

安装elrepo的yum源

# 在线地址
yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
# rpm文件
yum install elrepo-release-7.el7.elrepo.noarch.rpm

查询可用的内核

$ yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
已加载插件: fastestmirror
Loading mirror speeds from cached hostfile
* elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
可安装的软件包
kernel-lt.x86_64                    5.4.251-1.el7.elrepo    elrepo-kernel
kernel-t-devel.x86_64               5.4.251-1.el7.elrepo    elrepo-kernel
kernel-It-doc.noarch                5.4.251-1.el7.elrepo    elrepo-kernel
kernel-lt-headers.x86_64            5.4.251-1.el7.elrepo    elrepo-kernel
kernel-lt-tools.x86_64              5.4.251-1.el7.elrepo    elrepo-kernel
kernel-lt-tools-libs.x86_64         5.4.251-1.el7.elrepo    elrepo-kernel
kernel-lt-tools-libs-devel.x86_64   5.4.251-1.el7.elrepo    elrepo-kernel
kernel-ml-doc.noarch                6.4.7-1.el7.elrepo      elrepo-kernel
kernel-ml-headers.x86_64            6.4.7-1.el7.elrepo      elrepo-kernel
kernel-ml-tools.x86_64              6.4.7-1.el7.elrepo      elrepo-kernel
kernel-ml-tools-libs.x86_64         6.4.7-1.el7.elrepo      elrepo-kernel
kernel-ml-tools-libs-devel.x86_64   6.4.7-1.el7.elrepo      elrepo-kernel
perf.x86_64                         5.4.251-1.el7.elrepo    elrepo-kernel
python-perf.x86_64                  5.4.251-1.el7.elrepo    elrepo-kernel

安装最新的主线稳定内核

yum -y --enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64

修改内核启动顺序

$ awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
Centos Linux (6.4.7-1.el7.elrepo.x86 64) 7 (Core)                   # 0
Centos Linux (3.10.0-1160.92.1.el7.x86 64) 7 (Core)                 # 1
CentOs Linux (3.10.0-1160.53.1.el7.x86 64) 7 (Core)                 # 2
CentOs Linux (3.10.0-1160.el7.x86 64) 7 (Core)                      # 3
CentOs Linux (0-rescue-acca19161ce94d449c58923b12797030) 7 (Core)   # 4
$ grub2-set-default 0 # 设置默认选择第0个 重新启动时生效
# 重启后使用`uname-r`检查内核版本是否正确