此方法适用于CENTOS7-8
更新前,内核版本为:
uname -r
3.10.0-327.10.1.el7.x86_64
升级的方法:
- 导入key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
- 安装elrepo的yum源
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
- 替换国内elrepo源
mv /etc/yum.repos.d/elrepo.repo /etc/yum.repos.d/elrepo.repo.bak
vi /etc/yum.repos.d/elrepo.repo
### Name: ELRepo.org Community Enterprise Linux Repository for el7
### URL: https://mirrors.ustc.edu.cn/elrepo/
[elrepo]
name=ELRepo.org Community Enterprise Linux Repository - el7
baseurl=https://mirrors.ustc.edu.cn/elrepo/elrepo/el7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0
[elrepo-testing]
name=ELRepo.org Community Enterprise Linux Testing Repository - el7
baseurl=https://mirrors.ustc.edu.cn/elrepo/testing/el7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0
[elrepo-kernel]
name=ELRepo.org Community Enterprise Linux Kernel Repository - el7
baseurl=https://mirrors.ustc.edu.cn/elrepo/kernel/el7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0
[elrepo-extras]
name=ELRepo.org Community Enterprise Linux Extras Repository - el7
baseurl=https://mirrors.ustc.edu.cn/elrepo/extras/el7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0
- 安装内核
yum --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml
当前为4.14.12:
===================================================================================================
Package 架构 版本 源 大小
===================================================================================================
正在安装
kernel-ml x86_64 4.14.12-1.el7.elrepo elrepo-kernel 43 M
kernel-ml-devel x86_64 4.14.12-1.el7.elrepo elrepo-kernel 11 M
- 查看默认启动顺序
awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
CentOS Linux (4.14.12-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-693.11.6.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-86c958f6cabe420a9e1d369335737991) 7 (Core)
- 设置默认的启动内核
grub2-set-default "CentOS Linux (4.14.12-1.el7.elrepo.x86_64) 7 (Core)"
grub2-mkconfig -o /boot/grub2/grub.cfg
配置默认内核
验证是否修改成功:
grub2-editenv list
saved_entry=CentOS Linux (4.14.12-1.el7.elrepo.x86_64) 7 (Core)