本文轉載http://blog.csdn.net/nciasd/article/details/51490146,大神非常厲害!!!!!
查看當前系統的內核版本
# 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.查看默認啟動順序
#awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg 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 debugging CentOS Linux 7 (Core), with Linux 3.10.0-229.el7.x86_64 CentOS Linux 7 (Core), with Linux 0-rescue-c25a1eaf12bd4a3f9235a3a124d0d4c8
默認啟動的順序是從0開始,但我們新內核是從頭插入(目前位置在0,而3.10的是在1),所以需要選擇0,如果想生效最新的內核,需要
grub2-set-default 0
5.查看內核版本
然后reboot重啟,使用新的內核,下面是重啟后使用的內核版本
# uname -r
為最新的linux內核。