歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> CentOS7升級內核到最新版本

CentOS7升級內核到最新版本

日期:2017/3/6 9:49:41   编辑:學習Linux

CentOS7升級內核到最新版本


CentOS7升級內核到最新版本


查看當前系統的內核版本

# uname -r 

1、導入key

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

2、安裝elrepo的yum源

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

如果安裝過程中出現yum提示的錯誤

Another app is currently holding the yum lock

執行如下語句

# rm -f /var/run/yum.pid

就可以繼續執行更新了。

3、安裝內核

在yum的ELRepo源中,有最新內核版本,目前4.6dev

yum --enablerepo=elrepo-kernel install  kernel-ml-devel kernel-ml -y

更新後查看內核版本 [root@ip-10-10-17-4 tmp]# uname -r 3.10.0-123.el7.x86_64

重要:目前內核還是默認的版本,如果在這一步完成後你就直接reboot了,重啟後使用的內核版本還是默認的3.10,不會使用新的內核,想修改啟動的順序,需要進行下一步

4.查看默認啟動順序

CentOS Linux (4.6.0-1.el7.elrepo.x86_64) 7 (Core)CentOS Linux (4.6.0-1.el7.elrepo.x86_64) 7 (Core) with debuggingCentOS Linux 7 (Core), with Linux 3.10.0-229.el7.x86_64CentOS Linux 7 (Core), with Linux 0-rescue-c25a1eaf12bd4a3f9235a3a124d0d4c8

默認啟動的順序是從0開始,但我們新內核是從頭插入(目前位置在0,而3.10的是在1),所以需要選擇0,如果想生效最新的內核,需要

grub2-set-default 0

5.查看內核版本

然後reboot重啟,使用新的內核,下面是重啟後使用的內核版本

# uname -r 

為最新的linux內核。

http://xxxxxx/Linuxjc/1134126.html TechArticle

Copyright © Linux教程網 All Rights Reserved