[转] 测试环境下将centos6.8升级到centos7的操作记录

1)查看升级前的版本信息 lsb_release -a

 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
 Distributor ID: CentOS
 Description:    CentOS release 6.8 (Final)
 Release:    6.8
 Codename:   Final


2)在“/etc/yum.repos.d/”目录中创建文件upgradetool.repo
[root@openstack ~]# cd /etc/yum.repos.d/
[root@openstack yum.repos.d]# touch upgradetool.repo

把以下内容贴进upgradetool.repo
[root@openstack yum.repos.d]#vim 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

3)安装升级工具
[root@openstack ~]# yum install redhat-upgrade-tool preupgrade-assistant-contents

4)安装完后,运行
[root@openstack ~]# preupg -l
CentOS6_7

5)执行升级分析
preupg仅仅是分析系统而不会执行任何任务,执行后它会给出一些建议告诉更新程序在更新的时候去搜索什么。
[root@openstack ~]# preupg -s CentOS6_7
Preupg tool doesn't do the actual upgrade.
Please ensure you have backed up your system and/or data in the event of a failed upgrade
that would require a full re-install of the system from installation media.
Do you want to continue? y/n
y

直到完成(跑相当长的时间,请耐心等待)
如果没有提示出错,可以继续下一步。否则请检查!!!要全部PASS才可以。

6)导入centos7源
[root@openstack ~]# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

请看文章底部错误

7)升级系统

[root@openstack ~]#  **centos-upgrade-tool-cli --network 7 --instrepo=http://mirror.centos.org/centos/7/os/x86_64/**
国内比较慢,可以使用以下源  
[root@openstack ~]# centos-upgrade-tool-cli --network 7 --instrepo=http://mirrors.163.com/centos/7/os/x86_64/

8)重启系统

[root@openstack ~]# reboot

​ 重启系统,再次登录后就回发现系统已经升级到centos7了!
转自:https://www.cnblogs.com/kevingrace/p/5709571.html


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/
redhat-upgrade-tool --force --cleanup-post --network 7.0 --instrepo=http://vault.centos.org/centos/7.2.1511/os/x86_64/

Finally

清理el6的rpm包 rpm -qa | grep -i el6 ,具体删什么升级什么,视个人情况。 el6依赖包版本降级 yum downgrade grep

**更多请参考:https://wiki.centos.org/TipsAndTricks/CentOSUpgradeTool **

posted @ 2017-08-24 21:46  季文康  阅读(962)  评论(0编辑  收藏  举报