cntos6x升级centos 7

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cntos6x升级centos 7相关的知识,希望对你有一定的参考价值。

**入了一个HK的kvm,但是预置镜像都是老版本:centos6,debian7。因为只是为了做个DOCKER REGESTRY和扶墙,想升级下系统版本和内核,折腾了debian7无果,折腾下centos升级版本,再换内核。**
网上找了一下,按照说明升级,发现已经不支持从6.x升级到最新的7.3了。
[详情链接](http://www.shaunfreeman.name/upgrading-centos-6-5-to-centos-7-2/)
```
WARNING! Do not use this method to upgrade from CentOS 6.7 or higher as several system critical packages are of a higher version number than they are in centos 7 so those do not get upgraded correctly. This renders the system broken and several system tools non-functional. You will not be able to login in or use networking.
Also CentOS 6.6 fails now with the upgrade with error “Downloading failed: invalid data in .treeinfo: No section: ‘checksums‘ ” so this is also broken on CentOS 6.6 now and can ONLY be done on CentOS 6.5.
```
那就先升级到7.2吧。[参照官方指导](https://wiki.centos.org/TipsAndTricks/CentOSUpgradeTool)
---
## 添加源
`vi /etc/yum.repos.d/upgradetool.repo`
```
[upg]
name=CentOS-$releasever - Upgrade Tool
baseurl=http://dev.centos.org/centos/6/upg/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
```
---
## Install Old Version OpenSCP
因为如果不重新装旧版本的openscp就会提示错误:*preupg: error: [Errno 2] No such file or directory: ‘/root/preupgrade/result.html‘*
[参看错误说明](https://centos.org/forums/viewtopic.php?f=13&t=59763#p252751)
``` bash
yum erase openscap
yum install http://dev.centos.org/centos/6/upg/x86_64/Packages/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm
yum install redhat-upgrade-tool preupgrade-assistant-contents
```
---
## 导入RPM KEY升级
这里不可以导入最新的,因为最新版的.treeinfo中没有upgrade项了,所以这里导入7.2的。
``` bash
rpm --import http://vault.centos.org/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7
centos-upgrade-tool-cli --network 7 --instrepo=http://vault.centos.org/centos/7.2.1511/os/x86_64/
```
## Finally
清理el6的rpm包 `rpm -qa | grep -i el6` ,具体删什么升级什么,视个人情况。
el6依赖包版本降级 `yum downgrade grep`
参考:
[远程升级云服务器系统 CentOS 6.x 至 CentOS 7.x](https://blog.ibills.cn/?p=138)








































以上是关于cntos6x升级centos 7的主要内容,如果未能解决你的问题,请参考以下文章

Linux-升级内核

CentOS7CentOS7各个版本镜像下载地址(转)

centOS7centOS7上普通用户切换root用户,相互切换

工作总结之linux防火墙配置命令适用centos7centos8

RHEL 7CentOS 7 忘记root密码如何重置

centOS7centOS7上普通用户切换root用户,相互切换