diff --git a/0022-add-migrate-to-2403.patch b/0022-add-migrate-to-2403.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6825fb93b124c6b3f9e68584088583890e4dec3 --- /dev/null +++ b/0022-add-migrate-to-2403.patch @@ -0,0 +1,192 @@ +From b5342ffac0a1b9ed94e1d5017a536f0fc172435a Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Tue, 4 Mar 2025 11:00:54 +0800 +Subject: [PATCH] add migrate to 2403 + +--- + README_zh.md | 71 +++++-------------- + .../centos7/openeuler/centos72openeuler.py | 21 ++++-- + 2 files changed, 30 insertions(+), 62 deletions(-) + +diff --git a/README_zh.md b/README_zh.md +index 4709db3..fe977f5 100644 +--- a/README_zh.md ++++ b/README_zh.md +@@ -12,12 +12,12 @@ migration-tools工具提供网页界面方式进行操作,以供使用者在 + #### 支持迁移的系统 + + 1.支持将AMD64和ARM64架构的CentOS系列系统迁移到UOS系统,迁移前需自行准备目标系统的全量源。 +-2.openeuler迁移:目前仅支持centos 7.4 cui系统迁移至openeuler 20.03-LTS-SP1 ++2.openeuler迁移:目前仅支持centos 7.4 cui系统迁移至openeuler 20.03-LTS-SP1,openEuler-22.03-LTS-SP4,openEuler-24.03-LTS版本。 + 3.不建议对安装了i686架构的rpm包的原系统进行迁移,如果对这种原系统进行迁移会出现迁移失败的结果。 + + |原系统|目标系统|使用的软件源| + |---|---|---| +-|centos 7.4 cui|openeuler 20.03-LTS-SP1|使用openeuler外网源| ++|centos 7.4 cuiopeneuler 20.03-LTS-SP1,openEuler-22.03-LTS-SP4,openEuler-24.03-LTS版本。| |使用openeuler外网源| + |centos 7.0~7.7|UOS 1002a|UOS 1002a(全量源)| + |centos 8.0~8.2|UOS 1050a|UOS 1050a(全量源)| + +@@ -55,66 +55,16 @@ systemctl restart migration-tools-server + + - 分发agent软件包 + +-- 根据迁移系统的版本选择分发的软件包 +-- centos7系列: +-xx.xx.xx.xx表示迁移机器IP +- +-``` shell +-scp -r /usr/lib/migration-tools-server/agent-rpm/el7 root@xx.xx.xx.xx:/root +-``` +- +-- centos8系列: +- +-``` shell +-scp -r /usr/lib/migration-tools-server/agent-rpm/el8 root@xx.xx.xx.xx:/root +-``` +- +-#### 迁移openeuler系统 +- +-> +- +-- 安装migration-tools-agent包 +-- 从server端分发迁移配置文件至agent端 +- +-``` shell +-cd /usr/lib/migration-tools-server/ut-Migration-tools-0.1/centos7/ +-scp openeuler/centos72openeuler.py root@10.12.23.106:/root +- +-scp /etc/migration-tools/migration-tools.conf root@10.12.23.106:/etc.migration- +-``` +- +-- 安装迁移所需依赖 +- +-``` shell +-yum install python3 dnf rsync yum-utils -y +-``` +- +-- 开始迁移 +- +-``` shell +-python3 centos7/openeuler/centos72openeuler.py +-``` +- +-- +- +-#### 迁移UOS/系统 +- +-**注意:** ++#### 迁移UOS/openEuler系统 + + ##### 安装migration-tools-agent端 + + 在准备迁移的centos机器上执行以下步骤 +->**注意:** 目前migration-tools仅支持centos7.4 cui迁移至openeuler 20.03-LTS-SP1,openeuler系统目前仅支持迁移,无日志和迁移报告。 + +-- 关闭防火墙 +- +-``` shell +-systemctl stop firewalld +-``` ++>**注意:** 目前migration-tools仅支持centos7.4 cui迁移至openeuler,目前仅支持迁移,无日志和迁移报告。 + + - 配置运行系统的软件源并安装migration-tools-agent软件包。 + +-- centos7: + + ``` shell + yum install migration-tools-agent +@@ -128,12 +78,21 @@ vim /etc/migration-tools/migration-tools.conf + + ![配置文件](./figures/migration-tools-conf.png) + ++ ++ ++- 在Agent端,默认迁移到2003版本,如需迁移其他版本或修改本地源则修改软件源仓库(openEuler-23.09,openEuler-24.03-LTS版本) ++ ++``` shell ++vim /usr/lib/migration-tools-agent/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py +11 ++修改:openeuler_repo软件源 ++``` + - 重启migration-tools-agent服务 + + ``` shell + systemctl restart migration-tools-agent + ``` + ++ + ##### UOS系统迁移步骤 + + - 登录web端 +@@ -217,5 +176,7 @@ Build : UnionTech OS Server 20 1050a 20220214 x86_64 + ################################################# + ``` + +-迁移完成后需要手动重启系统,重启完成后即迁移完成。 ++openEuler: + ![openeuler迁移完成](./figures/openeuler-migration-complete.png) ++ ++迁移完成后需要手动重启系统,重启完成后即迁移完成。 +diff --git a/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py b/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py +index f7918b4..a0014d3 100644 +--- a/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py ++++ b/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py +@@ -8,7 +8,7 @@ import sys, re + + openeuler_repo = '''[openeuler] + name = openeuler +-baseurl = https://repo.openeuler.openatom.cn/openEuler-20.03-LTS-SP4/OS/$basearch ++baseurl = https://mirrors.tuna.tsinghua.edu.cn/openeuler/openEuler-20.03-LTS-SP4/OS/$basearch + enabled = 1 + gpgcheck = 0 + ''' +@@ -287,10 +287,16 @@ def main(): + nodeps_cmd = "rpm -q " + package + " && rpm -e --nodeps " + package + os.system(nodeps_cmd) + ++ if os.path.exists('/etc/yum.repos.d/openEuler.repo'): ++ os.remove('/etc/yum.repos.d/openEuler.repo') + if system_sync(): ++ if not os.path.exists('/usr/bin/dnf'): ++ run_subprocess('/usr/bin/dnf-3 install dnf -y'.split()) + subprocess.run('dnf -y groupinstall "Minimal Install"', shell=True) + else: + print("Removing confilct package yum...") ++ if not os.path.exists('/usr/bin/dnf'): ++ run_subprocess('/usr/bin/dnf-3 install dnf -y'.split()) + error_remove = ['gdbm-libs', 'cockpit-ws', 'shadow-utils', 'python-libs', 'python2-libcomps', 'python-gobject-base', 'libselinux-python', + 'libxml2-python', 'rpm-python', 'newt-python', 'bind-export-libs', 'pygpgme', 'python-slip', + 'systemd-sysv', 'pyliblzma', 'python-perf', 'pyxattr', 'yum-metadata-parser', +@@ -307,7 +313,8 @@ def main(): + print("set boot target to cui") + cmd = 'systemctl set-default multi-user.target' + run_subprocess(cmd.split()) +- ++ if not os.path.exists('/usr/bin/dnf'): ++ run_subprocess('/usr/bin/dnf-3 install dnf -y'.split()) + if not os.path.exists('/usr/bin/python3'): + cmd = 'ln -s /usr/bin/python3.7 /usr/bin/python3' + print("Create symlink for python3") +@@ -321,14 +328,14 @@ def main(): + print("Installing yum...") + if not check_udev_id_net_name_path(): + set_grub_biosdev_rules() +- conf_grub() +- os.system("chmod 600 /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_rsa_key") +- run_subprocess("sed -i -E 's/^#?\s*PasswordAuthentication(\s+).*/PasswordAuthentication\1yes/gi' /etc/ssh/sshd_config".split()) ++ # configure_ssh() ++ if os.path.exists('/etc/openEuler_security/security.conf'): ++ shutil.move('/etc/openEuler_security/security.conf', '/etc/openEuler_security/security.conf.bak') + run_subprocess('dnf install -y yum'.split()) +- ++ run_subprocess("chmod 600 /etc/ssh/*key".split()) ++ conf_grub() + print("System migration completed, rebooting system") + + + if __name__ == '__main__': + main() +- +-- +2.20.1 + diff --git a/README.md b/README.md index 4709db377451027ad526b9ae3858e178f8c9a403..b9a21e2d3a89f5926df9a8d56d7a5ca1a0d804de 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,14 @@ migration-tools工具提供网页界面方式进行操作,以供使用者在 #### 支持迁移的系统 1.支持将AMD64和ARM64架构的CentOS系列系统迁移到UOS系统,迁移前需自行准备目标系统的全量源。 -2.openeuler迁移:目前仅支持centos 7.4 cui系统迁移至openeuler 20.03-LTS-SP1 +2.openeuler迁移:目前仅支持centos 7.4 cui系统迁移至openeuler 20.03-LTS-SP1,openEuler-22.03-LTS-SP4,openEuler-24.03-LTS版本。 3.不建议对安装了i686架构的rpm包的原系统进行迁移,如果对这种原系统进行迁移会出现迁移失败的结果。 -|原系统|目标系统|使用的软件源| -|---|---|---| -|centos 7.4 cui|openeuler 20.03-LTS-SP1|使用openeuler外网源| -|centos 7.0~7.7|UOS 1002a|UOS 1002a(全量源)| -|centos 8.0~8.2|UOS 1050a|UOS 1050a(全量源)| +| 原系统 | 目标系统 | 使用的软件源 | +| ------------------------------------------------------------ | --------- | ------------------- | +| centos 7.4 cuiopeneuler 20.03-LTS-SP1,openEuler-22.03-LTS-SP4,openEuler-24.03-LTS版本。 | | 使用openeuler外网源 | +| centos 7.0~7.7 | UOS 1002a | UOS 1002a(全量源) | +| centos 8.0~8.2 | UOS 1050a | UOS 1050a(全量源) | ### 使用方法 @@ -45,7 +45,7 @@ yum install migration-tools-server -y vim /etc/migration-tools/migration-tools.conf ``` -![配置文件](./figures/migration-tools-conf.png) +![配置文件](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/migration-tools-conf.png) - 重启migration-tools-server服务 @@ -55,66 +55,16 @@ systemctl restart migration-tools-server - 分发agent软件包 -- 根据迁移系统的版本选择分发的软件包 -- centos7系列: -xx.xx.xx.xx表示迁移机器IP - -``` shell -scp -r /usr/lib/migration-tools-server/agent-rpm/el7 root@xx.xx.xx.xx:/root -``` - -- centos8系列: - -``` shell -scp -r /usr/lib/migration-tools-server/agent-rpm/el8 root@xx.xx.xx.xx:/root -``` - -#### 迁移openeuler系统 - -> - -- 安装migration-tools-agent包 -- 从server端分发迁移配置文件至agent端 - -``` shell -cd /usr/lib/migration-tools-server/ut-Migration-tools-0.1/centos7/ -scp openeuler/centos72openeuler.py root@10.12.23.106:/root - -scp /etc/migration-tools/migration-tools.conf root@10.12.23.106:/etc.migration- -``` - -- 安装迁移所需依赖 - -``` shell -yum install python3 dnf rsync yum-utils -y -``` - -- 开始迁移 - -``` shell -python3 centos7/openeuler/centos72openeuler.py -``` - -- - -#### 迁移UOS/系统 - -**注意:** +#### 迁移UOS/openEuler系统 ##### 安装migration-tools-agent端 在准备迁移的centos机器上执行以下步骤 ->**注意:** 目前migration-tools仅支持centos7.4 cui迁移至openeuler 20.03-LTS-SP1,openeuler系统目前仅支持迁移,无日志和迁移报告。 - -- 关闭防火墙 -``` shell -systemctl stop firewalld -``` +>**注意:** 目前migration-tools仅支持centos7.4 cui迁移至openeuler,目前仅支持迁移,无日志和迁移报告。 - 配置运行系统的软件源并安装migration-tools-agent软件包。 -- centos7: ``` shell yum install migration-tools-agent @@ -126,7 +76,14 @@ yum install migration-tools-agent vim /etc/migration-tools/migration-tools.conf ``` -![配置文件](./figures/migration-tools-conf.png) +![配置文件](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/migration-tools-conf.png) + +- 在Agent端,默认迁移到2003版本,如需迁移其他版本或修改本地源则修改软件源仓库(openEuler-22.03,openEuler-24.03-LTS版本) + +``` shell +vim /usr/lib/migration-tools-agent/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py +11 +修改:openeuler_repo软件源 +``` - 重启migration-tools-agent服务 @@ -134,58 +91,59 @@ vim /etc/migration-tools/migration-tools.conf systemctl restart migration-tools-agent ``` + ##### UOS系统迁移步骤 - 登录web端 -在server端和agent端服务均启动后,打开浏览器(建议使用:Chrome),在浏览器导航栏中输入`https://SERVER_IP:9999`即可。 + 在server端和agent端服务均启动后,打开浏览器(建议使用:Chrome),在浏览器导航栏中输入`https://SERVER_IP:9999`即可。 - 点击“我已阅读并同意此协议”,然后点击下一步 -![许可协议](./figures/许可协议.png) + ![许可协议](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/许可协议.png) - 迁移提示页面内容如下,点击下一步 -![提示](./figures/提示.png) + ![提示](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/提示.png) - 环境检测页面会检查系统版本和系统剩余空间大小,在检测完成后点击下一步 >**注意:** 如果出现检测长时间无反应,请检查agent防火墙是否关闭,server与agent服务是否开启。 -> 如需重新检测,在浏览器中刷新即可。 +>如需重新检测,在浏览器中刷新即可。 -![环境检测](./figures/环境检测.png) +![环境检测](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/环境检测.png) - 用户检测页面会检查用户名以及密码,推荐使用root用户,迁移到UOS则点击下一步开始检测,检测完成后自动进入repo源配置页面。迁移openEuler系统可直接跳转迁移页面。 -![用户检测](./figures/选择目标系统.png) + ![用户检测](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/选择目标系统.png) repo源配置页面 - 请根据要迁移的系统输入对应的repo源 - centos7:1002a,centos8:1050a + centos7:1002a,centos8:1050a - 确保使用的软件源为全量源,否则迁移会失败 - 输入栏中只需输入1个软件仓库路径即可 -![repo](./figures/repo.png) + ![repo](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/repo.png) - 输入完成后点击下一步,等待软件源连通性检测完毕后,进入kernel版本选择页面,选择4.19内核,点击下一步 -![kernel](./figures/kernel.png) + ![kernel](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/kernel.png) - 迁移环境检查界面可以对比迁移前后的软件包差异,并输出检测报告,检查完成后可以导出检测报告, > **注意:** 检测时间大约为1个小时,请耐心等待 -![迁移检查](./figures/迁移检查.png) +![迁移检查](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/迁移检查.png) - 检测完成后,点击下一步会弹出系统迁移确认窗口,请确保系统已做好备份,准备完成后点击确认开始系统迁移 -![迁移确认](./figures/迁移确认.png) + ![迁移确认](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/迁移确认.png) - 点击确认后,进入系统迁移页面 -![迁移开始](./figures/迁移开始.png) + ![迁移开始](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/迁移开始.png) - 可以点击查看详情,来查看迁移情况 -![迁移中](./figures/迁移中.png) + ![迁移中](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/迁移中.png) - 迁移完成后,页面会跳转至迁移完成页面,可在该页面导出迁移后检测报告及迁移日志。 - 导出后,可在server端/var/tmp/migration-tools/目录下找到报告和日志的压缩包,解压后即可查看 -![迁移完成](./figures/迁移完成.png) + ![迁移完成](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/迁移完成.png) - 迁移完成后,需手动重启agent机器,并验证是否迁移完成。 @@ -209,6 +167,7 @@ Build : UnionTech OS Server 20 1002c 20211228 x86_64 ``` 1050a: + ``` shell ################################################# Release: UnionTech OS Server release 20 (kongzi) @@ -217,5 +176,7 @@ Build : UnionTech OS Server 20 1050a 20220214 x86_64 ################################################# ``` +openEuler: +![openeuler迁移完成](/home/xzx/nfs/xzx/gitee/src_commit/migration-tools-src/README.assets/openeuler-migration-complete.png) + 迁移完成后需要手动重启系统,重启完成后即迁移完成。 -![openeuler迁移完成](./figures/openeuler-migration-complete.png) diff --git a/migration-tools-1.0.3.tar.gz b/migration-tools-1.0.3.tar.gz index 2f14dc2c2e38ed992ca14c36d8c38dd4b9458872..03b3768eb30964b40b009df8456f5d62e83eae9a 100644 Binary files a/migration-tools-1.0.3.tar.gz and b/migration-tools-1.0.3.tar.gz differ diff --git a/migration-tools.spec b/migration-tools.spec index 0128e1b82a4f4951a9e7d43e2b315e34f97f61f9..f8ab999822f0a025b79547fe75a2f7c6feb0f6a7 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.3 -Release: 21 +Release: 22 License: MulanPSL-2.0 Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system Source0: %{name}-%{version}.tar.gz @@ -29,6 +29,8 @@ Patch019: 0019-update-the-initilization-repo-file.patch Patch020: 0020-rebrand-for-openeuler.patch Patch021: 0021-Solve-startup-issues.patch Patch022: 0001-modify-web-success-migration-page.patch +Patch023: 0022-add-migrate-to-2403.patch + BuildArch: noarch BuildRequires: systemd @@ -130,6 +132,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Thu Feb 27 2025 xuezhixin - 1.0.3-22 +- 0022-add-migrate-to-2403.patch + * Thu Feb 27 2025 xuezhixin - 1.0.3-21 - 0021-Solve-startup-issues.patch - 0001-modify-web-success-migration-page.patch