centos7升级内核版本

本文转载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内核。

posted @ 2017-10-10 11:55  无踪无影  阅读(1650)  评论(0编辑  收藏  举报