载入公钥
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
安装 ELRepo 最新版本
yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
列出可以使用的 kernel 包版本
yum list available --disablerepo=* --enablerepo=elrepo-kernel
kernel-lt-devel.x86_64 5.4.267-1.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 5.4.267-1.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 5.4.267-1.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 5.4.267-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 5.4.267-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 5.4.267-1.el7.elrepo elrepo-kernel
kernel-ml.x86_64 6.7.1-1.el7.elrepo elrepo-kernel
kernel-ml-devel.x86_64 6.7.1-1.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 6.7.1-1.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 6.7.1-1.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 6.7.1-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 6.7.1-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 6.7.1-1.el7.elrepo elrepo-kernel
perf.x86_64 5.4.267-1.el7.elrepo elrepo-kernel
python-perf.x86_64 5.4.267-1.el7.elrepo elrepo-kernel
安装指定的 kernel 版本:
yum install -y kernel-lt.x86_64 --enablerepo=elrepo-kernel
yum --enablerepo=elrepo-kernel install kernel-ml -y
查看系统可用内核
cat /boot/grub2/grub.cfg | grep menuentry
menuentry 'CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)' --class centos (略)
menuentry 'CentOS Linux (4.4.218-1.el7.elrepo.x86_64) 7 (Core)' --class centos ...(略)
menuentry 'CentOS Linux (5.4.162-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.el7.x86_64-advanced-3153fb87-fd2a-4cca-b938-8a2a97f7ffcd' {
menuentry 'CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentr_id_option 'gnulinux-3.10.0-1160.el7.x86_64-advanced-3153fb87-fd2a-4cca-b938-8a2a97f7ffcd' {
menuentry 'CentOS Linux (0-rescue-8703a975bb214778a37caadda8ee332d) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-8703a975bb214778a37caadda8ee332d-advanced-3153fb87-fd2a-4cca-b938-8a2a97f7ffcd' {
# 看起来ml版本的内核比较满足我们的需求,直接使用yum进行安装
sudo yum --enablerepo=elrepo-kernel install kernel-ml -y
# 使用grubby工具查看系统中已经安装的内核版本信息
sudo grubby --info=ALL
# 设置新安装的6.1.4版本内核为默认内核版本,此处的index=0要和上面查看的内核版本信息一致
sudo grubby --set-default-index=0
# 查看默认内核是否修改成功
sudo grubby --default-kernel
# 重启系统切换到新内核
init 6
# 重启后检查内核版本是否为新的6.1.4
uname -a
设置开机从新内核启动
grub2-set-default 'CentOS Linux (5.4.162-1.el7.elrepo.x86_64) 7 (Core)'
查看内核启动项
grub2-editenv list
saved_entry=CentOS Linux (5.4.162-1.el7.elrepo.x86_64) 7 (Core)
评论区