centos 内核升级

CentOS 7 的内核一般都是3.10的,而CentOS 6.X 的内核一般都是2.6,在2.6的内核下,Docker运行会比较卡,所以一般会选择升级到3.10版本。

升级内核的方式,网上有很多方法是下载内核然后编译,这样需要安装很多必备的环境和工具,比较麻烦,但是也有助于我们了解内核的编译 
1. 查看当前内核版本

[root@localhost ~]# more /etc/issue
CentOS release 6.5 (Final)
Kernel 
 on an m
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
  • 1
  • 2
  • 3
  • 4
  • 5
  1. 导入public key
[root@localhost ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
  • 1

3.安装ELRepo到CentOS 
可以去http://elrepo.org/tiki/tiki-index.php 选择要安装的ELRepo 
这里写图片描述
一般会安装到最新版内核

[root@localhost ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
  • 1

4.安装 kernel-lt(lt=long-term)

[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-lt -y
  • 1

或者 安装kernel-ml(ml=mainline)

[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-ml -y
  • 1

5.编辑grub.conf文件,修改Grub引导顺序

[root@localhost ~]# vim /etc/grub.conf
  • 1

这里写图片描述 
因为一般新安装的内核在第一个位置,所以设置default=0,表示启动新内核 
6.重启 
查看此时内核版本:

 1. [root@localhost ~]# uname -r
 2. 3.10.105-1.el6.elrepo.x86_64
  • 1
  • 2

成功!

原文地址:https://www.cnblogs.com/zhaobin-diray/p/9927803.html