CentOS_7升级系统内核
最近,在虚拟机中安装docker成功之后,尝试运行docker run hello-world时出现以下错误:
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for hello-world:latest
docker: Error response from daemon: OCI runtime create failed: container_linux.go:: starting container process caused "process_linux.go:293: copying bootstrap data to pipe caused \"write init-p: broken pipe\"": unknown.
查资料得知,这是CentOS内核系统与docker版本不匹配所导致的问题,下面介绍一下如何升级系统内核。
升级系统版本
首先,查看当前系统版本
$ uname -r
3.10.-.el7.x86_64
然后进行升级
$ yum update
# 之后重启虚拟机
$ reboot
# 查看系统内核
$ uname -r
3.10.-.el7.x86_64
# 内核并未升级,升级的其实是系统版本
# 因为 CentOS 为了安全和稳定并不会把系统内核升级到最新的版本,所以 yum update 命令只会升级系统版本和更新软件
$ cat /etc/redhat-release
CentOS Linux release 7.6. (Core)
升级内核版本
升级内核
$ rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
$ rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
上述命令为启用elrepo仓库,我们可以使用以下命令列出可用的系统内核相关包:
$ yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
之后,就可以安装最新的稳定内核:
$ yum --enablerepo=elrepo-kernel install kernel-ml
重启机器,并选择最新安装的内核(第一个)
进入系统之后,查看内核版本uname -r
设置GRUB默认的内核版本
启动系统时,系统默认选择之前的版本,所以我们需要设置一下GRUB
$ vi /etc/default/grub GRUB_TIMEOUT=
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
重新创建内核配置
$ grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.0.-.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.0.-.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.-.el7.x86_64
Found initrd image: /boot/initramfs-3.10.-.el7.x86_64.img
Found linux image: /boot/vmlinuz--rescue-16053a12b3234d688858493442d3b11e
Found initrd image: /boot/initramfs--rescue-16053a12b3234d688858493442d3b11e.img
done
重启,不进行选择内核操作,验证更新后的内核为默认内核
$ uname -r
5.0.-.el7.elrepo.x86_64
删除旧版本内核(可选)
查看当前全部内核
$ rpm -qa | grep kernel
kernel-tools-3.10.-.el7.x86_64
kernel-ml-5.0.-.el7.elrepo.x86_64
kernel-tools-libs-3.10.-.el7.x86_64
kernel-3.10.-.el7.x86_64
使用yum remove删除旧版本内核
yum remove kernel-tools-3.10.-.el7.x86_64 kernel-tools-libs-3.10.-.el7.x86_64 kernel-3.10.-.el7.x86_64
重启之后,发现没有其他内核可以选择。
CentOS_7升级系统内核的更多相关文章
- centos6升级系统内核
1.升级系统内核查看内核版本: uname -r 2.6.32-573.8.1.el6.x86_64 导入elrepo的key: rpm --import https://www.elrepo.org ...
- centos6安装docker,先升级系统内核
安装docker,其他的源可能导致你的内核和docker的版本不一致,需要将系统内核升级至3.x 查看当前系统版本 cat /etc/issue 查看当前内核版本 uname -r #uname -a ...
- centos7升级系统内核
1)升级 方法一: rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.or ...
- CentOS 6.9安装docker之前升级系统内核版本
问题描述:安装docker,官方文档要求Linux kernel至少3.8以上,且docker只能运行在64位的系统中(这个很重要,搞了个i386的系统升级了半天没成功) 升级步骤: 1.因位安装服务 ...
- CentOS6下用yum升级系统内核版本至最新
首先当你决定升级内核时,要想清楚为什么升级内核,因为升级内核会带来很多麻烦.所以这种事情能避免就避免 导入 Public Key rpm --import https://www.elrepo.org ...
- CentOS7升级系统内核至4.4.xx版本
CentOS7.x系统自带的3.10.x内核存在一些Bugs,导致运行的Docker.kubernetes不稳定,建议升级内核,容器使用的坑会少很多 下载内核源 rpm -Uvh http://www ...
- Centos 下面升级系统内核(转)
1.导入public key 1 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org 2.安装ELRepo到CentOS 6. ...
- linux 升级系统内核linux-4.10版本
http://blog.csdn.net/steven_liwen/article/details/68487241
- centos7.5升级系统内核版本
1.yum update curl nss 2.yum install wget 3.rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.or ...
随机推荐
- Bable实现由ES6转译为ES5
Babel是一个广泛使用的转码器,可以将ES6代码转译为ES5代码,从而在现有环境下执行. 举例说明: 转译前(ES6格式)代码如下: let User = { name : '张三', age : ...
- finereport报表--动态格间运算 二
报表输出
- 浏览器登录Dynamics 365 CE没毛病,程序连接却报错。
摘要: 微软动态CRM专家罗勇 ,回复308或者20190308可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!我的网站是 www.luoyong.me . 今天我做实验 ...
- 如何解决Dynamics 365的错误:用户身份验证无效,MSIS0006
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复246或者20170312可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!我的网站是 www.luoyong. ...
- 解决注册并发问题并提高QPS
前言:前面在本地的windows通过apache的ab工具测试了600并发下“查询指定手机是否存在再提交数据”的注册功能会出现重复提交的情况,并且在注册完成时还需要对邀请人进行奖励,记录邀请记录,对该 ...
- SuperMap iClient 如何使用 WMTS 地图服务(转载)
原文链接: WMTS服务初步理解与读取 https://blog.csdn.net/supermapsupport/article/details/76806670 SuperMap iClient ...
- git 的 origin 的含义
我们从progit 一书中可以看到: 远程仓库名字 “origin” 与分支名字 “master” 一样,在 Git 中并没有任何特别的含义一样. 同时“master”是当你运行git init时默认 ...
- js调用浏览器打印指定div内容
--打印按钮事件 function printForm(){ var headstr = '<html xmlns:th="http://www.thymeleaf.org&qu ...
- c/c++ 多线程 等待一次性事件 异常处理
多线程 等待一次性事件 异常处理 背景:假设某个future在等待另一个线程结束,但是在被future等待的线程里发生了异常(throw一个异常A),这时怎么处理. 结果:假设发生了上面的场景,则在调 ...
- 建立第一个SpringBoot小列子(碰到的错误)
当加入@SpringBootApplication注解时,无法得到解析 错误提示:SpringBootApplication cannot be resolved to a type 错误原因是因为s ...