linux修改默认启动内核
内核下载地址: https://opsx.alibaba.com/mirror/search?q=kernel&lang=zh-CN
1、安装新内核
rpm -ivh kernel-plus-3.10.0-957.el7.centos.plus.x86_64.rpm
2、查看此服务器现有内核
如果没有grub.cfg文件需要手动生成
命令如下:
grub2-mkconfig -o /boot/grub2/grub.cfg
[root@vultr ~]# 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 7 Rescue 391fb5ec18674feab90a950e28c02cc9 (3.10.0-957.el7.centos.plus.x86_64)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-e9842005-de6f-45ec-b782-a60f850f532d' { menuentry 'CentOS Linux (3.10.0-957.el7.centos.plus.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-e9842005-de6f-45ec-b782-a60f850f532d' { menuentry 'CentOS Linux (3.10.0-957.10.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-e9842005-de6f-45ec-b782-a60f850f532d' { menuentry 'CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-e9842005-de6f-45ec-b782-a60f850f532d' { menuentry 'CentOS Linux (0-rescue-0015f513be3040a285d18999909c4ca5) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-0015f513be3040a285d18999909c4ca5-advanced-e9842005-de6f-45ec-b782-a60f850f532d' {
3、设置默认启动内核
[root@vultr ~]# grub2-set-default "CentOS Linux (3.10.0-957.el7.centos.plus.x86_64) 7 (Core)"
4、验证是否设置成功
[root@vultr ~]# grub2-editenv list saved_entry=CentOS Linux (3.10.0-957.el7.centos.plus.x86_64) 7 (Core)
5、重启验证是否生效
[root@vultr ~]# reboot [root@vultr ~]# uname -r 3.10.0-957.el7.centos.plus.x86_64
可以看到默认内核已经修改成功
主题授权提示:请在后台主题设置-主题授权-激活主题的正版授权,授权购买:RiTheme官网
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。