CentOS6.x升级到CentOS7.x

官方升级教程:http://wiki.centos.org/TipsAndTricks/CentOSUpgradeTool

1、在”/etc/yum.repos.d/”目录中创建文件upgradetool.repo

# cd /etc/yum.repos.d/

# touch upgradetool.repo

2、把以下内容贴进upgradetool.repo

# vi 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、安装升级工具

# yum install redhat-upgrade-tool preupgrade-assistant-contents

4、安装完后,运行

# preupg -l

查看支持的升级

5、执行升级分析

# 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源

# rpm –import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

7、升级系统

# centos-upgrade-tool-cli –network 7 –instrepo=http://mirror.centos.org/centos/7/os/x86_64/

国内比较慢,可以使用以下源

# centos-upgrade-tool-cli –network 7 –instrepo=http://mirrors.163.com/centos/7/os/x86_64/

8、重启系统,完成