CentOS7 升級核心
阿新 • • 發佈:2021-11-30
啟用 ELRepo 倉庫
在 CentOS 7 上啟用 ELRepo 倉庫,請執行:
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
倉庫啟用後,你可以使用下面的命令列出可用的核心相關包:
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
轉載請在文章開頭附上原文連結地址:https://www.cnblogs.com/Sunzz/p/15624582.html
安裝核心
安裝最新的主線穩定核心
yum --enablerepo=elrepo-kernel install kernel-ml -y
或者安裝長期支援版
yum --enablerepo=elrepo-kernel install kernel-lt -y
設定預設核心
設定 GRUB 預設的核心版本
grub2-set-default 0
重啟
init 6
檢視核心版本
uname -r
或者通過以下方式修改預設核心
1.為了讓新安裝的核心成為預設啟動選項,你需要如下修改 GRUB 配置:
開啟並編輯/etc/default/grub並設定
GRUB_DEFAULT=0。意思是 GRUB 初始化頁面的第一個核心將作為預設核心。 GRUB_TIMEOUT=5 GRUB_DEFAULT=0 GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet" GRUB_DISABLE_RECOVERY="true"
2.執行下面的命令來重新建立核心配置。
可不執行
grub2-mkconfig -o /boot/grub2/grub.cfg
3.重啟
init 6
4.檢視核心版本
uname -r