1、添加升级工具的源
[root@localhost ~]# more /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
2、安装升级工具
yum install redhat-upgrade-tool preupgrade-assistant-contents
3、导入GPG-KEY
sudo rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
4、进行系统升级评估,看升级有无风险
查看升级可用的目录
preupg -l
如果结果为CentOS6_7 ,继续执行:
preupg -s CentOS6_7
5、升级工具(force强制升级)
sudo centos-upgrade-tool-cli --network 7 --force --instrepo=http://mirror.centos.org/centos/7/os/x86_64/
如果出现下面error 再执行下sudo centos-upgrade-tool-cli --network 7 --force --instrepo=http://mirror.centos.org/centos/7/os/x86_64/
Downloading failed: Errors were encountered while downloading packages.
全部完成后会提示重启
testing upgrade transaction
rpm transaction 100% [===============================================================================================]
rpm install 100% [===================================================================================================]
setting up system for upgrade
Finished. Reboot to start upgrade.
6、软件包下载完成后,按照提示重启机器,等待升级完成。
本文出自 “Linux安全顾问” 博客,转载请与作者联系!
原文地址:http://chengyangyang.blog.51cto.com/9473151/1653506