CentOS7 升級內核


啟用 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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM