elrepo是CentOS十分有用的稳定的软件源,与其他软件源不一样的是,这个第三方源主要是提供硬件驱动、内核更新方面的支持,如显卡、无线网卡、内核等等,现在已经支持centos7.x+,更新较快。
1、查看centos版本
引用
[root@localhost ~]# cat /etc/centos-release
CentOS release 6.5 (Final)
CentOS release 6.5 (Final)
2、查看内核
引用
[root@localhost ~]# uname -r
2.6.32-358.el6.x86_64
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+版本的,网上的很多的文章都是错误的-6-5
- 1、安装 ELRepo for RHEL-6,SL-6 or CentOS-6:
- 2、安装 ELRepo for RHEL-7,SL-7 or CentOS-7:
- 3、安装 ELRepo for RHEL-5,SL-5 or CentOS-5:
引用
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
引用
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm (external link)
引用
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-6.el6.elrepo.noarch.rpm
返回:
引用
Retrieving http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
Preparing... ########################################### [100%]
1:elrepo-release ########################################### [100%]
Preparing... ########################################### [100%]
1:elrepo-release ########################################### [100%]
5、安装kernel-lt(lt=long-term)
引用
[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-lt -y
国外网速较慢,耐心等待....返回:
引用
........
* 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
* 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
或者安装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
#
# 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
3.10.103-1.el6.elrepo.x86_64
参考: http://www.511yj.com/centos-yum-kernel.html