Linux小玩意之使用 convert2rhel 工具做系统迁移

1. conert2rhel简介

1.1 通过conert2rhel工具, 我们可以方便的从 CentOS 直接迁移到 Red Hat Enterprise Linux (RHEL).

重要: 在进行convert之前,强烈建议做好相应的备份. 当然,我们也可以联系Red Hat尝试获取支持

2. conert2rhel 迁移的步骤

注意: 使用的时候,建议做一个版本的对应. 比如我用CentOS 6.10 迁移到RHEL 6.10 作为一个例子

2.1 在原有的CentOS 6.10 上安装 Fedora EPEL repository

1
# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

2.2 安装 convert2rhel 工具.

1
# yum install -y convert2rhel

2.3 使用RHEL6.10 ISO 作为本地的 repo (我们也可以使用http/ ftp 配合RHEL 6.10搭建的源). 这个例子将 RHEL6.10 的ISO 挂载在”/mnt/iso”下. 并建立一个本地repo 文件.

1
2
3
4
5
6
# vi /etc/yum.repos.d/rhel-6-server-rpms.repo
[rhel-6-server-rpms]
name = rhel-6-server-rpms
baseurl = file:///mnt/iso
enabled = 1
gpgcheck = 0

2.4 建立完毕, 使用 “yum repolist” 就可以看到我们建立的repo了

1
2
3
4
5
# yum repolist
......
repo id repo name status
rhel-6-server-rpms rhel-6-server-rpms 0
......

2.5 开始进行系统的迁移

2.5.1 执行命令进行系统的迁移 ( “–enablerepo” 参数后面 接我们local repo的源的名字 “rhel-6-server-rpms”). 过程中,会有5次需要确认, 输入”y”的地方. 以安装为 “Desktop, Server Platform Development, X Window System” 的CentOS6.10系统,整个切换大约需要10分钟.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# convert2rhel --disable-submgr --disablerepo "*" --enablerepo rhel-6-server-rpms --debug
......

WARNING - By continuing you accept this EULA.
Continue with the system conversion? [y/n]: y
...
WARNING - The following packages will be removed...
Continue with the system conversion? [y/n]: y
...
WARNING - Only packages signed by CentOS are to be reinstalled. Red Hat support won't be provided for the following third party packages:
Continue with the system conversion? [y/n]: y
...
WARNING - The tool allows rollback of any action until this point.
WARNING - By continuing all further changes on the system will need to be reverted manually by the user, if necessary.
Continue with the system conversion? [y/n]: y
...
WARNING - The convert2rhel is going to force-replace the only kernel installed, which has the same NEVRA as the only available RHEL kernel. If anything goes wrong with such replacement, the system will become unbootable. If you want the convert2rhel to install the RHEL kernel in a safer manner, you can install a different version of kernel first and then run convert2rhel again.

Continue with the system conversion? [y/n]: y

2.5.2 切换完毕之后,重启加载新的内核. 整个切换的过程就结束了.(简单好用吧 :P)

1
2
WARNING - In order to boot the RHEL kernel, restart of the system is needed.
[root@localhost ~]#reboot

我们也可以打开下面的链接,找到更多的参考信息.

https://access.redhat.com/articles/2360841