centos6.4或者6.5使用yum的elrepo源升级内核

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

[size=large][color=darkblue][b]1、查看centos版本[/b][/color][/size]
[quote]# cat /etc/centos-release
CentOS release 6.5 (Final)[/quote]
[size=large][color=darkblue][b]2、查看内核[/b][/color][/size]
[quote]# uname -r
2.6.32-358.el6.x86_64[/quote]
[size=large][color=darkblue][b]3、首先你要做的就是导入public key[/b][/color][/size]
[quote]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org[/quote]
[size=large][color=darkblue][b]4、然后安装ELRepo到CentOS-6.x中[/b][/color][/size]
注意:
[color=darkred][b]elrepo-release-6-6.el6.elrepo.noarch.rpm[/b][/color]这是针对centos6.0+版本的,网上的很多的文章都是错误的-6-5

[list]
[*]1、安装 [color=darkred][b]ELRepo for RHEL-6, SL-6 or CentOS-6:[/b][/color]
[quote]rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm[/quote]
[*]2、安装 [color=darkred][b]ELRepo for RHEL-7, SL-7 or CentOS-7:[/b][/color]
[quote]rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm (external link)[/quote]
[*]3、安装 [color=darkred][b]ELRepo for RHEL-5, SL-5 or CentOS-5:[/b][/color]
[quote]rpm -Uvh http://www.elrepo.org/elrepo-release-5-5.el5.elrepo.noarch.rpm (external link)[/quote]
[/list]
[size=medium][color=black][b]执行安装![/b][/color][/size]
[quote]# rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm[/quote]
[size=medium][color=black][b]返回:[/b][/color][/size]
[quote]Retrieving http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
Preparing... ########################################### [100%]
1:elrepo-release ########################################### [100%][/quote]

[size=medium][color=black][b]5、安装kernel-lt(lt=long-term)[/b][/color][/size]
[quote]# yum --enablerepo=elrepo-kernel install kernel-lt -y[/quote]
国外网速较慢,耐心等待....返回:
[quote]........
* base: mirror.bit.edu.cn
* elrepo: repos.lax-noc.com
* elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.sina.cn
* updates: mirror.bit.edu.cn
base | 3.7 kB 00:00
elrepo | 2.9 kB 00:00
elrepo/primary_db | 716 kB 00:45
https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.tuna.tsinghua.edu.cn'"
Trying other mirror.
elrepo-kernel | 2.9 kB 00:00
elrepo-kernel/primary_db | 19 kB 00:00
extras | 3.4 kB 00:00
extras/primary_db | 37 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 2.0 MB 00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
.....
Total download size: 33 M
Installed size: 154 M
Downloading Packages:
http://repos.lax-noc.com/elrepo/kernel/el6/x86_64/RPMS/kernel-lt-3.10.103-1.el6.elrepo.x86_64.rpm: [Errno 12] Timeout on http://repos.lax-noc.com/elrepo/kernel/el6/x86_64/RPMS/kernel-lt-3.10.103-1.el6.elrepo.x86_64.rpm: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds')
Trying other mirror.
kernel-lt-3.10.103-1.el6.elrepo.x86_64.rpm | 33 MB 68:27
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : kernel-lt-3.10.103-1.el6.elrepo.x86_64 1/1
Verifying : kernel-lt-3.10.103-1.el6.elrepo.x86_64 1/1

Installed:
kernel-lt.x86_64 0:3.10.103-1.el6.elrepo

Complete!
You have new mail in /var/spool/mail/root[/quote]
[size=large][color=darkred][b]或者安装kernel-ml(ml=mainline)[/b][/color][/size]
[quote]yum --enablerepo=elrepo-kernel install kernel-ml -y[/quote]
二者任选其一!
[size=large][color=darkblue][b]6、编辑grub.conf文件,修改Grub引导顺序[/b][/color][/size]
[quote]vim /etc/grub.conf[/quote]
按 [color=red][b]i[/b][/color] 把[color=red][b] default=1[/b][/color]修改为 [color=red][b]default=0,[/b][/color]按[color=red][b]esc [/b][/color]键,输入 [color=red][b]:wq[/b][/color]保存退出。
[quote]# 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[/quote]

[size=medium][color=black][b]注意:[/b][/color][/size]

确认刚安装好的内核在哪个位置,然后设置default值(从0开始),一般新安装的内核在第一个位置,所以设置default=0。
[size=large][color=darkblue][b]7、重启centos[/b][/color][/size]
[quote]# reboot[/quote]
[size=large][color=darkblue][b]8、重新查看内核[/b][/color][/size]
[quote]# uname -r
3.10.103-1.el6.elrepo.x86_64[/quote]

参考:[url]http://www.511yj.com/centos-yum-kernel.html[/url]

你可能感兴趣的:(linux)