内核更新
-
查看内核
# 查看系统 cat /etc/redhat-release # 查看内核 cat /proc/version
-
升级内核为 5.x
2.1 替换 yum 源
# 无 wget 命令 yum -y install wget yum -y install setup yum -y install perl # 替换源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum clean all && yum -y update
2.2 安装最新版本内核
# 启用 elrepo 仓库 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm yum --enablerepo=elrepo-kernel install kernel-ml # k8s yum --enablerepo=elrepo-kernel install kernel-lt-devel kernel-lt -y # 查看已安装 rpm -qa | grep kernel
查看启动顺序
awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg CentOS Linux (5.4.204-1.el7.elrepo.x86_64) 7 (Core) CentOS Linux (3.10.0-1160.71.1.el7.x86_64) 7 (Core) CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core) CentOS Linux (0-rescue-b3316c44f07e4e06adef8f0b01ae4a3e) 7 (Core)
报错
awk: fatal: cannot open file `/etc/grub2.cfg' for reading (No such file or directory)
解决
grub2-mkconfig -o /boot/grub2/grub.cfg
设置启动顺序
grub2-set-default 0
# 重启 reboot # 查看内核 uname -r # 升级成功 5.4.204-1.el7.elrepo.x86_64