1.查看服務(wù)器已安裝的所有內(nèi)核版本
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (3.10.0-1160.83.1.el7.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1160.80.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-1127.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-1160.83.1.el7.x86_64.debug) 7 (Core)
4 : CentOS Linux (3.10.0-1160.80.1.el7.x86_64.debug) 7 (Core)
5 : CentOS Linux (0-rescue-0e5781d77781441b97290d7bad5663e2) 7 (Core)
2.修改版本配置
vi /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=3
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet intel_iommu=on iommu=pt"
GRUB_DISABLE_RECOVERY="true"
將配置文件中的GRUB_DEFAULT
的值改為上面查看的對應(yīng)值ID,根據(jù)自己的所需修改;我這里要改為CentOS Linux (3.10.0-1160.80.1.el7.x86_64) 7 (Core)
則修改為:
GRUB_DEFAULT=1
3.編譯配置
grub2-mkconfig -o /boot/grub2/grub.cfg
4.重啟系統(tǒng)
編譯完成之后需要重新系統(tǒng)方則生效
reboot
5.重啟后查看內(nèi)核版本
等待重啟完成命令查看當(dāng)前內(nèi)核版本
uname -a
uname -r
完成版本切換。文章來源:http://www.zghlxwxcb.cn/news/detail-503134.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-503134.html
到了這里,關(guān)于【Linux】切換內(nèi)核版本(Centos)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!