摘自 https://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/
1.檢查當前系統(tǒng)的內(nèi)核版本
uname -sr
2. 升級內(nèi)核
centos 允許使用第三方的庫ELRepo敞斋,來升級系統(tǒng)內(nèi)核到最近的版本。為了開啟centos7系統(tǒng)的ELRepo庫焰枢,執(zhí)行一下操作:
[root@localhost ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@localhost ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
一旦開啟第三方庫荐绝,我們就可以使用下面的命令列出可以使用的相關(guān)的包
[root@localhost ~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
接下來岩喷,就可以安裝當前主流的穩(wěn)定版本的內(nèi)核了
[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-ml
安裝完成后,重啟系統(tǒng)隶债,選擇新安裝的內(nèi)核死讹,使用下面的命令查看內(nèi)核版本
[root@localhost ~]# uname -sr
3.在 grub中設置默認的內(nèi)核版本
[root@localhost ~]# vi /etc/default/grub
修改GRUB_DEFAULT=0愧旦,這意味著第一個內(nèi)核作為默認的使用。
然后使用下面的命令重新創(chuàng)建內(nèi)核配置文件
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
重啟系統(tǒng)惠况,驗證默認使用的內(nèi)核版本罚拟!