查看内核
[root@node1 ~]# uname -sr
Linux 3.10.0-1160.42.2.el7.x86_64
启用 ELRepo 仓库
[root@node1 KubeSphere]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@node1 KubeSphere]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
列出可用的内核相关包
[root@node1 KubeSphere]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
安装最新的主线稳定内核
[root@node1 KubeSphere]# yum --enablerepo=elrepo-kernel install kernel-ml
================================================
修改默认启动的内核
查看所有可用内核
[root@node1 grub2]# cat /boot/grub2/grub.cfg |grep "menuentry "
menuentry 'CentOS Linux (5.14.12-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-5.14.12-1.el7.elrepo.x86_64-advanced-01b2a18c-69e0-424e-9d71-4f2caf288a06' {
menuentry 'CentOS Linux (3.10.0-1160.42.2.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.42.2.el7.x86_64-advanced-01b2a18c-69e0-424e-9d71-4f2caf288a06' {
menuentry 'CentOS Linux (3.10.0-1160.el7.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-01b2a18c-69e0-424e-9d71-4f2caf288a06' {
menuentry 'CentOS Linux (0-rescue-4f8b1c881dde49c6b539500ce65ca48a) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-4f8b1c881dde49c6b539500ce65ca48a-advanced-01b2a18c-69e0-424e-9d71-4f2caf288a06' {
[root@node1 grub2]# grub2-set-default 'CentOS Linux (5.14.12-1.el7.elrepo.x86_64) 7 (Core)'
[root@node1 grub2]# grub2-editenv list
saved_entry=CentOS Linux (5.14.12-1.el7.elrepo.x86_64) 7 (Core)
[root@node1 grub2]# reboot
Connection closing...Socket close.
Connection closed by foreign host.
设置默认启动的内核
[root@node1 grub2]# grub2-set-default 'CentOS Linux (5.14.12-1.el7.elrepo.x86_64) 7 (Core)'
查看内核修改结果
[root@node1 ~]# grub2-editenv list
saved_entry=CentOS Linux (5.14.12-1.el7.elrepo.x86_64) 7 (Core)
重启
[root@node1 grub2]# reboot
查看内核
[root@node1 ~]# uname -sr
Linux 5.14.12-1.el7.elrepo.x86_64