更新时间:2024-09-14 GMT+08:00
迁移操作
本节介绍从CentOS7.9迁移到HCE 1.1的操作过程。
准备迁移工具依赖的软件包
- 远程连接待迁移的操作系统。
根据弹性云服务器控制台操作指导,远程登录到待迁移虚拟机内部,远程登录的具体操作,请参见连接方式概述,并确保虚拟机内部与Internet相通。
- 先关闭CentOS系统/etc/yum.repos.d下的所有的repo配置,确保CentOS的repo源不与HCE的repo源发生冲突。
以Centos_Base.repo为例,将里面的每个子项原始的repo源里面添加enabled=0的配置项,如下图所示。
- 配置HCE的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的repo源。
执行命令curl https://repo.huaweicloud.com/hce/1.1/os/x86_64/命令检测是否能够访问HCE的repo源。若有类似如下输出信息,则能正常访问HCE的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的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。
附录:conf配置文件说明
#rpm lists for os migration [rpm_lists] #origin system must need rpms baserpms_list = "basesystem initscripts hce-logos plymouth grub2 grubby" //系统迁移依赖的RPM包 #old rpm and default conflict rpms //迁移过程中,原系统可能存在的冲突包 oldrpms_list = centos-backgrounds centos-release-cr desktop-backgrounds-basic \ centos-release-advanced-virtualization centos-release-ansible26 centos-release-ansible-27 \ centos-release-ansible-28 centos-release-ansible-29 centos-release-azure \ centos-release-ceph-jewel centos-release-ceph-luminous centos-release-ceph-nautilus \ centos-release-ceph-octopus centos-release-configmanagement centos-release-dotnet centos-release-fdio \ centos-release-gluster40 centos-release-gluster41 centos-release-gluster5 \ centos-release-gluster6 centos-release-gluster7 centos-release-gluster8 \ centos-release-gluster-legacy centos-release-messaging centos-release-nfs-ganesha28 \ centos-release-nfs-ganesha30 centos-release-nfv-common \ centos-release-nfv-openvswitch centos-release-openshift-origin centos-release-openstack-queens \ centos-release-openstack-rocky centos-release-openstack-stein centos-release-openstack-train \ centos-release-openstack-ussuri centos-release-opstools centos-release-ovirt42 centos-release-ovirt43 \ centos-release-ovirt44 centos-release-paas-common centos-release-qemu-ev centos-release-qpid-proton \ centos-release-rabbitmq-38 centos-release-samba411 centos-release-samba412 \ centos-release-scl centos-release-scl-rh centos-release-storage-common \ centos-release-virt-common centos-release-xen centos-release-xen-410 \ centos-release-xen-412 centos-release-xen-46 centos-release-xen-48 centos-release-xen-common \ python3-syspurpose python-oauth sl-logos yum-rhn-plugin centos-indexhtml \ libreport-centos libreport-web libreport-plugin-mantisbt libreport-plugin-rhtsupport \ libreport hunspell-en-US hunspell-en policycoreutils-gui libcanberra-gtk2 cups \ NetworkManager-libreswan-gnome plymouth-graphics-libs avahi cups-lpd pinentry-qt \ librsvg2-devel libcanberra-gtk3 gnome-themes-standard wodim gsettings-desktop-schemas-devel \ avahi-ui-gtk3 freerdp-libs pulseaudio-utils gstreamer1-plugins-bad-free-gtk ghostscript-cups \ setools-console libxkbcommon-x11 cups plymouth-plugin-two-step pulseaudio-module-x11 ImageMagick-c++ \ cups-devel policycoreutils-sandbox PackageKit-gstreamer-plugin gtk3-immodule-xim avahi-glib avahi-autoipd \ mesa-libGLES foomatic libcanberra-devel plymouth-plugin-label PackageKit-gtk3-module colord avahi-gobject \ pinentry-qt4 avahi-ui-gtk3 plymouth-plugin-two-step ghostscript-cups ImageMagick-perl firewall-config \ plymouth-plugin-label redhat-redhat-lsb-corelsb vim-X11 dbus-x11 pulseaudio PackageKit-command-not-found libproxy-mozjs \ pinentry-gtk nm-connection-editor gtk2-immodule-xim wireshark-gnome pulseaudio-module-bluetooth pidgin-sipe freerdp kmod-kvdo \ redhat-lsb-core #The following list contains the same symbol as centos/redhat dstrpms_list = "hce-release hce-repos" [log_conf] # migration tool log common dir migrate_common_dir = "/var/log/migrate-tool/" //日志存放路径 # migration tool classification log dir migrate_classification_dir = %(migrate_common_dir)s/centos2hce1/ #iso as yum source link [repo_info] base_yum_url =https://repo.huaweicloud.com/hce/1.1/os/x86_64/ //基础yum源路径,用于检查网络状态 #iso as yum source repostr_hce1_1 = //提供迁移模式的源路径 [base] name=hceversion baseurl=https://repo.huaweicloud.com/hce/1.1/os/x86_64/ //基础yum源路径,用于获取RPM包 gpgcheck=0 enabled=1 gpgkey= #released updates [updates] name=hce1_updates baseurl= gpgcheck=0 enabled=0 gpgkey= #additional packages that may be useful [extras] name=hce1_extras baseurl= gpgcheck=0 enabled=0 gpgkey= # plus packages provided by Huawei Linux dev team [plus] name=hce1_plus baseurl= gpgcheck=0 enabled=0 gpgkey=
父主题: 将操作系统迁移至HCE 1.1