升级Centos6到Centos7错误记录

入了一个HK的kvm,但是预置镜像都是老版本:centos6,debian7。因为只是为了做个DOCKER REGESTRY和扶墙,想升级下系统版本和内核,折腾了debian7无果,折腾下centos升级版本,再换内核。

网上找了一下,按照说明升级,发现已经不支持从6.x升级到最新的7.3了。

详情链接

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吧。参照官方指导


添加源

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’

参看错误说明

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的。

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