当前位置: > CentOS > CentOS教程 >

centos6 yum升级内核到4.4

时间:2016-06-04 22:12来源:linux.it.net.cn 作者:IT

 

 最近看到一篇文章Linux内核4.4版本带来的网络新特性,感觉还不错,想马上试试新内核,但又不想手动去编译内核,还好被我发现原来yum也可以升级内核到4.4了,马上行动.下面这篇文章是介绍怎么手动升级到内核4.4的,有兴趣的朋友可以看看,但不建议马上用到生产环境上.
 系统:centos 6.5(64位)
1.先查看内核
uname -r
2.6.32-431.el6.x86_64

2.查看系统版本
cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

3.安装推荐的key和扩展源
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

RHEL-7, SL-7 or CentOS-7使用下面的:
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

RHEL-6, SL-6 or CentOS-6使用下面的:
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm

4.升级内核
yum --enablerepo=elrepo-kernel install kernel-ml kernel-ml-headers

5.修改/etc/grub.conf文件
vi /etc/grub.conf
01 # grub.conf generated by anaconda
02 #
03 # Note that you do not have to rerun grub after making changes to this file
04 # NOTICE:  You have a /boot partition.  This means that
05 #          all kernel and initrd paths are relative to /boot/, eg.
06 #          root (hd0,0)
07 #          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
08 #          initrd /initrd-[generic-]version.img
09 #boot=/dev/sda
10 default=1
11 timeout=5
12 splashimage=(hd0,0)/grub/splash.xpm.gz
13 hiddenmenu
14 title CentOS (4.4.0-1.el6.elrepo.x86_64)
15     root (hd0,0)
16     kernel /vmlinuz-4.4.0-1.el6.elrepo.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
17     initrd /initramfs-4.4.0-1.el6.elrepo.x86_64.img
18 #title CentOS (2.6.32-431.el6.x86_64)
19 #    root (hd0,0)
20 #    kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
21 #    initrd /initramfs-2.6.32-431.el6.x86_64.img


这里我禁掉了旧的内核,我这是实验环境不存在,但我建议还是改default吧,毕竟有问题的话,还可以切换回老的内核.

6.验证
重启服务器后,查看内核:
[root@slogra ~]# uname -a
Linux localhost.localdomain 4.4.0-1.el6.elrepo.x86_64 #1 SMP Sun Jan 10 23:12:35 EST 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@slogra ~]# uname -r
4.4.0-1.el6.elrepo.x86_64
[root@slogra ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

好了,内核升级就到这里.


(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容