查看系统可用内核:
cat /boot/grub2/grub.cfg |grep menuentry
...
menuentry 'CentOS Linux (4.17.8-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.17.8-1.el7.elrepo.x86_64-advanced-fe0109f2-6f34-48ae-b51e-1f5fa78305b5' {
menuentry 'CentOS Linux (3.10.0-862.9.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-862.9.1.el7.x86_64-advanced-fe0109f2-6f34-48ae-b51e-1f5fa78305b5' {
...
查看当前内核:
uname -r
3.10.0-862.9.1.el7.x86_64
修改开机时默认使用的内核:
grub2-set-default 'CentOS Linux (4.17.8-1.el7.elrepo.x86_64) 7 (Core)'
查看内核修改结果:
grub2-editenv list
saved_entry=CentOS Linux (4.17.8-1.el7.elrepo.x86_64) 7 (Core)
查看系统安装了哪些内核包:
rpm -qa |grep kernel
kernel-tools-libs-3.10.0-862.9.1.el7.x86_64
kernel-ml-4.17.8-1.el7.elrepo.x86_64
kernel-tools-3.10.0-862.9.1.el7.x86_64
kernel-headers-3.10.0-862.9.1.el7.x86_64
kernel-devel-3.10.0-862.9.1.el7.x86_64
kernel-3.10.0-862.9.1.el7.x86_64
使用yum remove 或rpm -e 删除无用内核:
yum remove kernel-ml-3.10.0-862.9.1.el7.x86_64