1,首先查看當前系統有幾個內核
[root@21yunwei ~]# cat /boot/grub2/grub.cfg |grep menuentry
if
[ x
"${feature_menuentry_id}"
= xy ]; then
menuentry_id_option=
"--id"
menuentry_id_option=
""
export menuentry_id_option
menuentry
'CentOS Linux (3.10.0-327.22.2.el7.x86_64) 7 (Core)'
--
class
centos-----------------
menuentry
'CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)'
--
class
centos --
class---------------------
2,設置默認的啓動內核。比如我們選擇上邊中的CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)這個內核爲默認啓動。
[root@21yunwei ~]# grub2-set-default "CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)" 配置默認內核
驗證是否修改成功:
[root@21yunwei ~]# grub2-editenv list saved_entry=CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
3,重啓機器觀察。
重啓成功以後查看下機器的內核是不是該內核:
[root@21yunwei ~]# uname -r3.10.0-327.el7.x86_64