升级原因

随着技术升级,新科技的更新换代,操作系统的版本到现在也从Centos5.X过度到了最新的Centos7.5。
近期计划要使用Kubernetes服务,最新版本更好的兼容Centos7.X系列系统,由于远程Server都是通过私有云提供的,这样我们重新安装Centos7.X系统需要各种申请操作,没办法,个人怕麻烦还对这个技术需求有强烈的好奇心,所以准备探讨技术如何远程升级。

预置条件:

  • 安装Centos6.5系统的服务器
  • Centos7.2系统的DVD文件
  • Centos7.4的YUM源
  • Centos6.5-upg的YUM源

升级过程

安装升级工具

. 添加一个Centos6.5-upg的源

[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

安装升级需要的工具组件

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

注:如果下面升级检查出现问题,请查看系统openscap版本,如果不一致请更换右侧openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm

执行升级前检查

preupg

出现如下结果代表正常

094/096 ...done (NIS server maps check)
095/096 ...done (NIS server MAXUID and MAXGID limits check)
096/096 ...done (NIS server config file back-up)
Assessment finished (time 02:15s)
Result table with checks and their results for main contents:
....
 
|Content for enabling and disabling services based on CentOS 6 system |needs_action |
---------------------------------------------------------------------------------------------------------------
Tarball with results is stored here /root/preupgrade-results/preupg_results-170510111635.tar.gz .
The latest assessment is stored in directory /root/preupgrade .
Summary information:
We found some potential in-place upgrade risks.
Read the file /root/preupgrade/result.html for more details.
Upload results to UI by command:
e.g. preupg -u http://127.0.0.1:8099/submit/ -r /root/preupgrade-results/preupg_results-*.tar.gz .

导入RPM签名证书

rpm --import https://mirrors.ustc.edu.cn/epel/RPM-GPG-KEY-EPEL-7

上传Centos7.2-DVD.iso文件

执行升级操作

centos-upgrade-tool-cli  --iso=/path/centos7.2-dvd.iso  --force

结束后进行重启

setting up repos...
.treeinfo | 1.1 kB 00:00
Preupgrade assistant risk check found risks for this upgrade.
You can run preupg --riskcheck --verbose to view these risks.
Addressing high risk issues is required before the in-place upgrade
and ignoring these risks may result in a broken upgrade and unsupported upgrade.
Please backup your data.
...
...
 
(276/277): zlib-1.2.7-17.el7.x86_64.rpm | 90 kB 00:00
(277/277): zlib-devel-1.2.7-17.el7.x86_64.rpm | 50 kB 00:00
testing upgrade transaction
rpm transaction 100% [======================================================================================================================================================]
rpm install 100% [==========================================================================================================================================================]
setting up system for upgrade
Finished. Reboot to start upgrade.

查看升级后的系统版本

cat /etc/redhat-release
#CentOS Linux release 7.2.1511 (Core)

配置Centos7.4的yum源地址

执行升级命令即可

yum upgrade

完活,期待自己的系统升级到Centos7.4吧。
注:如升级在升级Centos7.2进行reboot后无法连接系统,请通过直连或者是虚拟化的view界面的方式访问系统,登录后修改网卡名为Centos7.2系统的网卡名,这里是ens32,修改完后重启网络服务即可。

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐