CentOS 7 升级内核及修改默认启动内核
CentOS 7 的内核升级及修改默认启动的内核,操作备档
http://elrepo.org/tiki/HomePage
导入公钥:
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
To install ELRepo for RHEL-9:
To install ELRepo for RHEL-8:
To install ELRepo for RHEL-7, SL-7 or CentOS-7:
查看内核:
yum --disablerepo=* --enablerepo=elrepo-kernel list kernel*
安装内核:
yum --disablerepo=\* --enablerepo=elrepo-kernel install kernel-ml.x86_64
查看GRUB缺省启动顺序
# cat /etc/default/grub | grep GRUB_DEFAULT
GRUB_DEFAULT=saved
如果是saved,就是按照指定保存的内核启动,如果为数字(0/1/2等),就是/boot/grub2/grub.cfg中对应位置的内核,建议设置为saved。
查看当前使用的内核:
# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-957.21.3.el7.x86_64) 7 (Core) with debugging
查看可以使用的内核:
# cat /boot/grub2/grub.cfg | grep 'menuentry '
menuentry 'CentOS Linux (5.18.1-1.el7.elrepo.x86_64) 7 (Core) with debugging' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-a1003f9f-2f89-4a7d-baea-d7e2d6b5088a' {
menuentry 'CentOS Linux (5.18.1-1.el7.elrepo.x86_64) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-a1003f9f-2f89-4a7d-baea-d7e2d6b5088a' {
menuentry 'CentOS Linux (3.10.0-957.21.3.el7.x86_64) 7 (Core) with debugging' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-a1003f9f-2f89-4a7d-baea-d7e2d6b5088a' {
menuentry 'CentOS Linux (3.10.0-957.21.3.el7.x86_64) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-a1003f9f-2f89-4a7d-baea-d7e2d6b5088a' {
设置默认启动的内核:
# grub2-set-default 'CentOS Linux (5.18.1-1.el7.elrepo.x86_64) 7 (Core) with debugging'
查看设置后的结果:
# grub2-editenv list
saved_entry=CentOS Linux (5.18.1-1.el7.elrepo.x86_64) 7 (Core)
重启生效。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!