迁移操作
本节介绍从CentOS7.9迁移到HCE OS 1.1的操作过程。
准备迁移工具依赖的软件包
- 远程连接待迁移的操作系统。
根据弹性云服务器控制台操作指导,远程登录到待迁移虚拟机内部,远程登录的具体操作,请参见连接方式概述,并确保虚拟机内部与Internet相通。
- 先关闭CentOS系统/etc/yum.repos.d下的所有的repo配置,确保CentOS的repo源不与HCE OS的repo源发生冲突。
以Centos_Base.repo为例,将里面的每个子项原始的repo源里面添加enabled=0的配置项,如下图所示。
- 配置HCE OS的repo源。
将如下内容添加到hce.repo中,并将hce.repo配置文件存放在/etc/yum.repos.d/目录下。
[centos7_everything] name=centos7_everything baseurl=https://repo.huaweicloud.com/hce/1.1/os/x86_64/ enable=1 gpgcheck=0 priority=1 #released updates [updates] name=hce1_updates baseurl=https://repo.huaweicloud.com/hce/1.1/updates/x86_64/ gpgcheck=0 enabled=1 gpgkey=
- 检查CentOS7.9系统网络是否能够正常访问HCE OS的repo源。
执行命令curl https://repo.huaweicloud.com/hce/1.1/os/x86_64/命令检测是否能够访问HCE OS的repo源。若有类似如下输出信息,则能正常访问HCE OS的repo源。
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3417 0 3417 0 0 373 0 --:--:-- 0:00:09 --:--:-- 696 <!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="/repository/static/css/style.css" type="text/css"/> <style> * { font-family: 'Verdana', sans-serif; margin: 0; padding: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } ......
- 执行如下命令安装python3。
[root@localhost ~]# yum install -y python3 //任意目录执行安装命令
如果CentOS 7.9系统已经安装python3,请忽略此步骤。
- 关闭selinux。
安装迁移工具
- 从华为云开源镜像站下载迁移工具安装包centos2hce1-*.rpm。
*表示迁移工具版本,本节以centos2hce1-1.0.0-0.0.2.x86_64.rpm安装包示例。
[root@localhost test]# wget https://repo.huaweicloud.com/hce/1.1/updates/x86_64/Packages/centos2hce1-1.0.0-0.0.2.x86_64.rpm //下载centos2hce1-*.rpm [root@localhost test]# ls //检查是否下载成功 centos2hce1-1.0.0-0.0.2.x86_64.rpm
- 安装迁移工具。
- 配置centos2hce1.conf文件。
配置HCE OS的repo源地址,用于检测repo源是否能够正常访问,并更新RPM包。
#iso as yum source link [repo_info] base_yum_url =https://repo.huaweicloud.com/hce/1.1/os/x86_64/ #iso as yum source repostr_hce1_1 = [base] name=hceversion baseurl=https://repo.huaweicloud.com/hce/1.1/os/x86_64/ gpgcheck=0 enabled=1 #released updates [updates] name=hce1_updates baseurl=https://repo.huaweicloud.com/hce/1.1/updates/x86_64/ gpgcheck=0 enabled=1 gpgkey=
centos2hce1.conf配置文件说明详见附录:conf配置文件说明。
系统迁移
- 备份操作系统。
- 执行centos2hce1.py命令,进行系统迁移。
系统迁移的耗时受更新的RPM包数量、大小和从repo源下载速度等影响,一般会在20分钟到1个小时左右完成,具体时间视实际环境确定,执行操作时注意预留足够的时间。
[root@localhost home]# centos2hce1.py
有如下回显信息,表示迁移完成。若迁移失败请使用备份数据恢复。
CentOS含有某些HCE 1.1不提供的RPM包,执行centos2hce1.py命令迁移系统后,迁移工具会自动清除这些RPM包。如果您想保留这些RPM包,请使用-s skip参数进行系统迁移。
- (可选)删除无用的RPM包。
如下两个RPM包在迁移过程中并没有使用,也不会对系统运行产生任何影响。在此对您可能产生的疑惑进行解释。
- 执行reboot命令重启操作系统。
- 执行cat /etc/os-release命令检查是否迁移成功。
显示如下Huawei Cloud EulerOS信息表示迁移成功。
- (可选)开启selinux。