yum安装编译内核
升级前环境:
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cat /etc/*release
CentOS release 6.8 (Final)
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
CentOS release 6.8 (Final)
CentOS release 6.8 (Final)
[root@localhost ~]#
导入public key
这步必须要执行的,rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@localhost ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@localhost ~]#
安装ELRepo到CentOS
可以去http://elrepo.org/tiki/tiki-index.php 选择要安装的ELRepo
若只想升级至当前的最新稳定内核,只需要执行下面命令
[root@localhost ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
[root@localhost ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
Retrieving http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
curl: (22) The requested URL returned error: 404 Not Found
error: skipping http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm - transfer failed
[root@localhost ~]# rz
-bash: rz: command not found
[root@localhost ~]# rpm -Uvh elrepo-release-6-8.el6.elrepo.noarch.rpm
Preparing... ########################################### [100%]
1:elrepo-release ########################################### [100%]
[root@localhost ~]#
如果失败可以先下载下来再更新
[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-lt -y 安装 kernel-lt
[root@localhost ~]# yum --enablerepo=elrepo-kernel install -y kernel-ml 或者 安装kernel-ml(ml=mainline)
[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-lt -y
Warning: RPMDB altered outside of yum.
Installing : kernel-lt-4.4.111-1.el6.elrepo.x86_64 1/1
Verifying : kernel-lt-4.4.111-1.el6.elrepo.x86_64 1/1
Installed:
kernel-lt.x86_64 0:4.4.111-1.el6.elrepo
Complete!
[root@localhost ~]#
编辑grub.conf文件,修改Grub引导顺序
[root@localhost ~]# vim /etc/grub.conf
#boot=/dev/sda
default=0
#default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
一般新安装的内核在第一个位置,所以设置default=0,表示启动新内核,修改后重启系统
[root@localhost ~]# uname -a
Linux localhost.localdomain 4.4.111-1.el6.elrepo.x86_64 #1 SMP Wed Jan 10 14:56:14 EST 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#
若只想升级只指定的内核,或者由于不能访问到源地址,也可以用以下方法。
在以下两个网址中找到想要的内核:
1、http://elrepo.reloumirrors.net/kernel/el7/x86_64/RPMS/ //官方源
2、http://hkg.mirror.rackspace.com/elrepo/kernel/el7/x86_64/RPMS/ //香港镜像,最新版本会比官网延迟1、2天
上图中显示当前最新版本是http://elrepo.reloumirrors.net/kernel/el7/x86_64/RPMS/kernel-ml-devel-4.14.13-1.el7.elrepo.x86_64.rpm ( MainLine = ml ),
yum install -y http://elrepo.reloumirrors.net/kernel/el7/x86_64/RPMS/kernel-ml-devel-4.14.13-1.el7.elrepo.x86_64.rpm
本文转自 justin_peng 51CTO博客,原文链接:http://blog.51cto.com/ityunwei2017/2060549,如需转载请自行联系原作者