CentOS 7 的内核升级及修改默认启动的内核,操作备档
http://elrepo.org/tiki/HomePage
导入公钥:
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
To install ELRepo for RHEL-9:
yum install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpmTo install ELRepo for RHEL-8:
yum install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpmTo install ELRepo for RHEL-7, SL-7 or CentOS-7:
yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
查看内核:
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)
重启生效。
标签:x86,CentOS,--,elrepo,默认,el7,64,内核,class From: https://www.cnblogs.com/xiedy001/p/16820785.html