Centos7 切换内核

发布时间: 更新时间: 总字数:162 阅读时间:1m 作者: IP上海 分享 网址

在使用 Linux 系统时,会有切换操作系统内核版本的需求,不同的系统有不同的处理方法,下面介绍 Centos7 切换内核的方法。

当前系统内核版本

$ uname -r
3.10.0-1062.9.1.el7.x86_64

查看内核列表

$ awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (3.10.0-1062.9.1.el7.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)
2 : CentOS Linux (0-rescue-cd1adecdcc094ebba45927ac448242da) 7 (Core)

当前默认内核

$ grub2-editenv list
saved_entry=CentOS Linux (3.10.0-1062.9.1.el7.x86_64) 7 (Core)

切换默认启动内核

$ grub2-set-default 1

再次查看默认内核启动项:

$ grub2-editenv list
saved_entry=1

重启系统

重启后可以看到内核已经切换:

reboot
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数