由于 centos官网将要停止对centos6的支持 导致下面连接不能访问,网上大多用的下面的连接找了半天找了个能用的记录下
http://dev.centos.org/centos/6/upg/x86_64/ ×
CentOS 6升级至Centos7
1.查看下当前的系统版本
cat /etc/redhat-release
2.配置更新源
vi /etc/yum.repos.d/upgrade.repo
[upgrade]name=upgrade
baseurl=https://buildlogs.centos.org/centos/6/upg/x86_64/
enable=1
gpgcheck=0
安装更新助手
由于centos 6.5自带的助手之一版本较高,所以需要卸载了装个更老的:
yum erase openscap -y
yum install redhat-upgrade-tool preupgrade-assistant-contents -y
升级前检查潜在问题
preupg -s CentOS6_7
在线更新,在线更新会比较慢。可以先下载好镜像,进行本地更新。
centos-upgrade-tool-cli --network 7 --instrepo=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
本地更新。
cd /tmp
wget https://mirrors.aliyun.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso
centos-upgrade-tool-cli --iso=/tmp/CentOS-7-x86_64-DVD-1810.iso
(如果有问题可以加--force参数,但生产环境不建议)
设置好之后,执行重启系统, 重启系统会进入更新的操作
界面可以看到需要更新软件包,有进度条。此外有部分报错也是正常,因为版本不同软件路径也不一样
更新完成之后,进入系统界面。再次查看版本确认
I/O warning : failed to load external entity "/usr/share/openscap/xsl/security-guide.xsl"
compilation error: file /usr/share/preupgrade/xsl/preup.xsl line 40 element import
xsl:import : unable to load /usr/share/openscap/xsl/security-guide.xsl
I/O warning : failed to load external entity "/usr/share/openscap/xsl/oval-report.xsl"
compilation error: file /usr/share/preupgrade/xsl/preup.xsl line 41 element import
xsl:import : unable to load /usr/share/openscap/xsl/oval-report.xsl
I/O warning : failed to load external entity "/usr/share/openscap/xsl/sce-report.xsl"
compilation error: file /usr/share/preupgrade/xsl/preup.xsl line 42 element import
xsl:import : unable to load /usr/share/openscap/xsl/sce-report.xsl
OpenSCAP Error:: Could not parse XSLT file '/usr/share/preupgrade/xsl/preup.xsl' [oscapxml.c:416]
Unable to open file /root/preupgrade/result.html
Usage: preupg [options]
preupg: error: [Errno 2] No such file or directory: '/root/preupgrade/result.html'
遇到问题那么就找原因和解决方法,通过搜索引擎搜索,找到 CentOS 官方论坛的一篇帖子,帖子中有一回复如下:
Erase the existing version of openscap (I had openscap 1.2) and install openscap-1.0.8-1.0.1 from http://dev.centos.org/centos/6/upg and redo the upgrade.
根据他的方法,把 openscap 软件包的版本降低之后,重新再安装此工具及其预升级助手:
[root@allen05ren ~]# yum erase openscap
[root@allen05ren ~]# yum install https://buildlogs.centos.org/centos/6/upg/x86_64/Packages/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm
[root@allen05ren ~]# yum install redhat-upgrade-tool preupgrade-assistant-contents