1.1 进入grub.cfg配置文件存放目录/boot/grub2/并备份grub.cfg配置文件
[root@linux-node1 ~]# cd /boot/grub2/
[root@linux-node1 grub2]#
cp -
p grub.cfg grub.cfg.bak
[root@linux-node1 grub2]#
ls -
ld grub.cfg*
-rw-r--r--.
1 root root
5162 Aug
11 2018 grub.cfg
-rw-r--r--
1 root root
5162 Aug
11 2018 grub.cfg.bak
1.2 查看系统当前使用的默认启动项
[root@linux-node1 grub2]# grub2-
editenv list
saved_entry=CentOS Linux (
3.10.
0-
862.9.
1.el7.x86_64)
7 (Core)
1.3 修改默认启动项并验证
[root@linux-node1 grub2]# grub2-set-default
"CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)"
[root@linux-node1 grub2]# grub2-
editenv list
saved_entry=CentOS Linux (
3.10.
0-
693.el7.x86_64)
7 (Core)
1.4 查看/etc/default/grub 配置文件
可以配置grub2启动项的timeout,背景图片等
[root@linux-node1 grub2]#
cat /etc/default/
grub
GRUB_TIMEOUT=
5
GRUB_DISTRIBUTOR=
"$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=
saved
GRUB_DISABLE_SUBMENU=
true
GRUB_TERMINAL_OUTPUT=
"console"
GRUB_CMDLINE_LINUX=
"crashkernel=auto biosdevname=0 net.ifnames=0 rhgb quiet"
GRUB_DISABLE_RECOVERY=
"true"
1.5 生成并更新grub.cfg配置文件(编译安装内核是必选,修改启动项顺序可选)
下面的命令会使用/etc/grub.d下的自动配置脚本和/etc/default/grub中定义的变量,自动生成GRUB2配置文件(包括在/
boot目录下的内核),
[root@linux-node1 grub2]# grub2-mkconfig -o /boot/grub2/
grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-
3.10.
0-
862.9.
1.el7.x86_64
Found initrd image: /boot/initramfs-
3.10.
0-
862.9.
1.el7.x86_64.img
Found linux image: /boot/vmlinuz-
3.10.
0-
693.el7.x86_64
Found initrd image: /boot/initramfs-
3.10.
0-
693.el7.x86_64.img
Found linux image: /boot/vmlinuz-
0-rescue-
3396984d18374e7d9d83fab36044b7ec
Found initrd image: /boot/initramfs-
0-rescue-
3396984d18374e7d9d83fab36044b7ec.img
done
1.6 验证默认启动后的内核版本
[root@linux-node1 ~]#
uname -
r
3.10.
0-
693.el7.x86_64
注:之前系统默认启动的内核版本为3.10.0-862.9.1.el7.x86_64
1.7 参考文档
http:
//www.zhongruitech.com/500029444.html
转载于:https://www.cnblogs.com/Wolf-Dreams/p/10947799.html
相关资源:垃圾分类数据集及代码