cnetos升级内核玩docker

最近在学习docker容器。在阿里云上的服务器内核版本比较低。所以,需要先升级。

查看内核命令:uname -r

升级内核,网上也有很多种方式。一般都是下载内核包,然后自己编译。不过这种方式需要注意的是相关的依赖。

嫌下载编译麻烦,可以使用这种方式。

在yum的ELRepo源中,有 m ain l ine(3.13.1)、 l ong- t erm(3.10.28)这2个内核版本,考虑到long-term更稳定,会长期更新,所以选择这个版本。

1、导入public key

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
2、安装ELRepo到CentOS-6.5中

rpm -ivh http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
3、安装 kernel-lt(lt=long-term)

yum --enablerepo=elrepo-kernel install kernel-lt -y
4、编辑grub.conf文件,修改Grub引导顺序

vim /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.10.28-1.el6.elrepo.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-3.10.28-1.el6.elrepo.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=en_US.UTF-8
rd_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-3.10.28-1.el6.elrepo.x86_64.img
title CentOS (2.6.32-431.3.1.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-431.3.1.el6.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=en_US.UTF-8 r
d_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-2.6.32-431.3.1.el6.x86_64.img
title CentOS (2.6.32-431.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=0a05411f-16f2-4d69-beb0-2db4cefd3613 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO
_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-2.6.32-431.el6.x86_64.img
确认刚安装好的内核在哪个位置,然后设置default值(从0开始),一般新安装的内核在第一个位置,所以设置default=0。

5、重启(reboot),查看内核版本号

[root@dev ~]# uname -r
3.10.28-1.el6.elrepo.x86_64

方式还比较简单,亲测没问题。。。

(方式来源:http://ljf.me/archives/use-yum-to-quickly-upgrade-centos-6-5-kernel-3-10-28)
---------------------
作者:hudan2714
来源:CSDN
原文:https://blog.csdn.net/hudan2714/article/details/53709400
版权声明:本文为博主原创文章,转载请附上博文链接!

原文地址:https://www.cnblogs.com/toov5/p/10340400.html