×
Community Blog Detailed Guide for Migrating from CentOS to Anolis OS

Detailed Guide for Migrating from CentOS to Anolis OS

How do CentOS users migrate smoothly to Anolis OS? Read this blog to find out.

By Chunmei Xu, Maintainer and SIG head of the Anolis Migration in OpenAnolis Community.

CentOS 8 has ceased maintenance at the end of 2021. To cope with this change, the OpenAnolis Community has launched the "Centos End of Life Zone" to provide migration solutions and long-term stable support for users affected by it. Anolis OS 8 is compatible with the CentOS 8 software ecosystem and other mainstream Linux distributions. It is an open-source, neutral, and open distribution.

To facilitate the smooth migration of CentOS users to Anolis OS and reduce the migration cost, the following migration manual and precautions are presented.

1. Migration Principles and Precautions

Anolis OS 8 is compatible with CentOS 8.x in terms of ecology and dependency management while making differential development. Therefore, in migration from CentOS 8.x to the latest version of Anolis OS 8, the tool makes full use of compatible attributes and provides a one-click migration script.

CentOS 8.x migration uses packages related to the Anolis OS distribution instead of the CentOS distribution, and reinstalls all system packages in the current system by yum distro-sync.

The software reinstallation does not modify the current system basic configuration, so the system configuration, business configuration, and business data will not be cleared. Therefore, these data need not be reset after the migration.

Before you proceed, please pay attention to the following points before using the migration script:

  • The migration involves software package reinstallation which is an irreversible process. Do make backups before the migration.
  • The migration involves accessing the official repo of Anolis OS. Users need to ensure that the network can access the Anolis OS repo normally.
  • Root user execution is needed. Currently, only the CentOS8.x system migration is supported while the CentOS stream system migration is not supported.
  • The migration depends on yum/dnf to ensure that these two components can run properly.
  • The migration script provides the Anolis OS repo access acceleration function. If the access speed of the Anolis OS official repo is slow, users can use -s option to accelerate the access.
  • Anolis OS does not provide packages of the i686 architecture. If a package of the i686 architecture of CentOS is installed on your system, it fails to be migrated normally.

2. Deploy the Migration Tool

Download the migration script:

wget https://gitee.com/anolis/centos2anolis/raw/master/centos2anolis.py

Install the migration script to run dependencies:

yum -y install python3

3. Executing the Migration

python3 centos2anolis.py

After the migration is complete, the system will prompt the following message. The message indicates that the migration is successful and users can restart to enter the Anolis OS.

1

The centos2anolis.py provides -V option to record the software package information before and after migration. You can determine whether to add the option as needed. Add -V option. The rpm information before and after the migration is generated in the /var/tmp directory after migration. The name format is:

# Before migration
$(hostname)-rpms-list-before.log
$(hostname)-rpms-verified-before.log
# After migration
$(hostname)-rpms-list-after.log
$(hostname)-rpms-verified-after.log

4. Post-Migration Configuration Check

Maintenance of CentOS was stopped on December 31, 2021, and the corresponding CentOS source was deleted from the official website on January 31, 2022. Because of this, the CentOS instance could not use the repo normally. To rectify this, Alibaba Cloud provides a detailed guide on switching to using the CentOS Vault source.

If you follow the instructions to switch to the CentOS Vault source or configure the Vault source on your own, and then migrate the Anolis OS, you need to check whether the CentOS Vault source remains in the current system after migration.

You can mandate yum repolist to check:

# yum repolist
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; Configuration: OptionBinding with ID "failovermethod" does not exist
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
Repository id      Repository name
AppStream    AnolisOS-8 - AppStream
BaseOS       AnolisOS-8 - BaseOS
Extras       AnolisOS-8 - Extras
PowerTools   AnolisOS-8 - PowerTools
base         CentOS-8.5.2111 - Base - mirrors.aliyun.com
epel         Extra Packages for Enterprise Linux 8 - x86_64
extras       CentOS-8.5.2111 - Extras - mirrors.aliyun.com

As shown in the preceding results, "CentOS-8.5.2111-Base-mirrors.aliyun.com" is the residual CentOS repo and it needs to be deleted. Otherwise, Anolis OS and CentOS sources will coexist. Once the yum update is executed, CentOS packages may be installed erroneously.

To delete the CentOS source, perform the following steps:

1.  Find the configuration file that provides the CentOS repo

# grep -rn "CentOS-8.5.2111" /etc/yum.repos.d/*.repo
/etc/yum.repos.d/Centos-vault-8.5.2111.repo:14:name=CentOS-8.5.2111 - Base - mirrors.aliyun.com
/etc/yum.repos.d/Centos-vault-8.5.2111.repo:24:name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com
/etc/yum.repos.d/Centos-vault-8.5.2111.repo:34:name=CentOS-8.5.2111 - Plus - mirrors.aliyun.com
/etc/yum.repos.d/Centos-vault-8.5.2111.repo:43:name=CentOS-8.5.2111 - PowerTools - mirrors.aliyun.com
/etc/yum.repos.d/Centos-vault-8.5.2111.repo:53:name=CentOS-8.5.2111 - AppStream - mirrors.aliyun.com

2.  Rename the configuration file found in step 1

mv /etc/yum.repos.d/Centos-vault-8.5.2111.repo /etc/yum.repos.d/Centos-vault-8.5.2111.repo.bak

5. Post-Migration Verification

View the OS version:

# cat /etc/os-release
NAME="Anolis OS"
VERSION="8.4"
ID="anolis"
ID_LIKE="rhel fedora centos"
VERSION_ID="8.4"
PLATFORM_ID="platform:an8"
PRETTY_NAME="Anolis OS 8.4"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"

Run the command to check whether the CentOS software package remains in the current system. Normally, the kernel package remains. The kernel package supports the coexistence of multiple versions.

rpm -qa --qf "%{NAME} %{VENDOR}\n" | grep CentOS

6. FAQ

1.  Can I perform a rollback after an in-place migration failure?

The migration tool does not support rollback. If the migration fails, you are not able to restore to the initial state. Therefore, you should make sure to back up your system before migration.

2.  What should I do when something goes wrong during the migration?

Save the migration tool, execute the error message, provide the initial system information (including system version, kernel, software package list, etc.), and attach the migration log file /var/log/centos2anolis.log and reach out to the OpenAnolis team for support.

Related Links

OpenAnolis Community: https://openanolis.cn/download?lang=en

0 1 1
Share on

OpenAnolis

85 posts | 5 followers

You may also like

Comments

OpenAnolis

85 posts | 5 followers

Related Products