centos 6.5内核升级

今天想在centos6.5安装docker,在网上查了说centos6.5需要64位的,内核需要升级到3.x以上(centos6.5本来是2.6)

了解一下elrepo

elrepo是CentOS十分有用的稳定的软件源,与其他软件源不一样的是,这个第三方源主要是提供硬件驱动、内核更新方面的支持,如显卡、无线网卡、内核等等,现在已经支持centos7.x+,更新较快。

1、查看centos版本

[root@localhost ~]# cat /etc/centos-release 
CentOS release 6.4 (Final)

2、查看内核

[root@localhost ~]# uname -r
2.6.32-358.el6.x86_64

3、首先你要做的就是导入public key

[root@localhost ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

4、然后安装ELRepo到CentOS-6.x中

注意:
elrepo-release-6-6.el6.elrepo.noarch.rpm这是针对centos6.0+版本的,如果发现找不到包就到

http://www.elrepo.org 中去确认下即可: 
1、安装  ELRepo for RHEL-6, SL-6 or CentOS-6:
rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm

2、安装 ELRepo for RHEL-7, SL-7 or CentOS-7:

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm (external link)

3、安装 ELRepo for RHEL-5, SL-5 or CentOS-5:

rpm -Uvh http://www.elrepo.org/elrepo-release-5-5.el5.elrepo.noarch.rpm (external link)

执行安装!

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

返回:

Retrieving http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
Preparing...                ########################################### [100%]
   1:elrepo-release         ########################################### [100%]

5、安装kernel-lt(lt=long-term)

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

.............

.......
Installed:
  kernel-lt.x86_64 0:4.4.139-1.el6.elrepo                                                                                                                                                                                     
Complete!

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

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

二者任选其一!

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

vim /etc/grub.conf

按 i 把 default=1修改为 default=0,按esc 键,输入 :wq保存退出。

# 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。

7、重启centos

[root@localhost ~]# reboot

8、重新查看内核

[root@localhost ~]# uname -r
3.10.103-1.el6.elrepo.x86_64

升级成功!

猜你喜欢

转载自blog.csdn.net/u012762054/article/details/80980792