Centos7修改默认启动内核
1,查看当前内核
[root@centos7 ~]# uname -r
2、查看启动配置里有哪些内核
[root@centos7 ~]# 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 (5.5.3) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-5.5.3-advanced-6f7f36a5-b362-4eea-8401-0198f71af7c1' { menuentry 'CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1062.el7.x86_64-advanced-6f7f36a5-b362-4eea-8401-0198f71af7c1' { menuentry 'CentOS Linux (0-rescue-d45ac2c225fa4e8299b70b9f76a0dde9) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-d45ac2c225fa4e8299b70b9f76a0dde9-advanced-6f7f36a5-b362-4eea-8401-0198f71af7c1' { [root@centos7 ~]#
3, 修改默认启动项
[root@centos7 ~]# grub2-set-default 1 [root@centos7 ~]#
在查看启动配置里,第一个内核的序号是 0 ,第二个是 1 ,...........以此往后数字,以此选择需要的数字
4,查看设置的结果
[root@centos7 ~]# grub2-editenv list
saved_entry=1
[root@centos7 ~]# uname -r
3.10.0-1062.el7.x86_64
[root@centos7 ~]#
5,最后,更新grub.cfg后 ,,,,重新启动
[root@centos7 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.5.3 Found initrd image: /boot/initramfs-5.5.3.img Found linux image: /boot/vmlinuz-3.10.0-1062.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-1062.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-d45ac2c225fa4e8299b70b9f76a0dde9 Found initrd image: /boot/initramfs-0-rescue-d45ac2c225fa4e8299b70b9f76a0dde9.img done [root@centos7 ~]# reboot