All Products
Search
Document Center

Server Migration Center:Migrate a Linux operating system

Last Updated:Oct 22, 2024

Due to reasons such as the end of operating system maintenance (meaning EOL) or the evolution of open-source projects, when you migrate or upgrade your operating system while retaining the data on the system disk of the ECS instance, you can achieve this through SMC. This document describes how to migrate or upgrade an operating system through SMC.

Note

Only specific users can use SMC to migrate a CentOS 7 or CentOS 8 operating system to RHEL 7 or RHEL 8. If you want to use this feature, submit a ticket.

Background information

Technical support may no longer be available for operating systems due to reasons such as the end of service lifecycle or end of third-party support. For example, CentOS has announced the end of life (EOL) for CentOS Linux versions, including CentOS 7 and CentOS 8. Such operating systems that enter the EOL may face security vulnerabilities. If the operating system of your Elastic Compute Service (ECS) instance meets the migration requirements, you can smoothly migrate or upgrade the operating system to another operating system by using Server Migration Center (SMC) for future maintenance and technical support. For more information, please see Image maintenance cycle and EOL guidance.

Migration and upgrade scenarios

Migrate CentOS 7 or CentOS 8

Operating system architecture

Source operating system

Destination operating system

x86

CentOS 7.x

  • AnolisOS 7

  • AnolisOS 8

  • Alibaba Cloud Linux 2

  • Alibaba Cloud Linux 3

    Note

    For more information about Alibaba Cloud Linux, see Overview.

CentOS 7.9

RHEL 7

CentOS 8.x

  • AnolisOS 8

  • Alibaba Cloud Linux 3

CentOS 8.5

RHEL 8

ARM64

CentOS 7.x

  • AnolisOS 7

  • AnolisOS 8

  • Alibaba Cloud Linux 3

CentOS 8.x

  • AnolisOS 8

  • Alibaba Cloud Linux 3

Migrate RHEL 7 or RHEL 8

Operating system architecture

Source operating system

Destination operating system

x86

RHEL 7.9

Alibaba Cloud Linux 3

RHEL 8.x

Upgrade Alibaba Cloud Linux 2

Operating system architecture

Source operating system

Destination operating system

x86

Alibaba Cloud Linux 2

Alibaba Cloud Linux 3

Usage notes

Item

Description

Comprehensive testing and verification

Before you migrate the operating system, we recommend that you test and verify that all your business applications are compatible with the destination operating system and run as expected in the destination operating system to ensure business continuity and functionality.

Meanwhile, before and during the migration and upgrade process, the system conducts migration condition detection and pre-evaluation on the source instance. If the source system does not meet the migration conditions or the pre-evaluation fails, the migration may encounter errors and interruptions. Therefore, successful migration and upgrade cannot be guaranteed. We recommend that you familiarize yourself with migration condition limitations and troubleshooting documentation in advance and conduct tests.

Back up your data

During the migration process, the system performs operations such as creating snapshots, reinstalling software packages, creating custom images of system disks, replacing system disks, stopping, and starting for ECS instances. We recommend that you back up important data and reasonably arrange the migration time to avoid any impact on business operations due to the aforementioned operations.

Do not officially use the ECS cloud server until migration is complete

Migration drills or the cancellation of the migration process may result in an automatic rollback to the snapshot taken before the migration, leading to the loss of data generated during the migration period. Do not officially use the ECS cloud server until the migration task is complete.

Ensure no snapshots are being created

If snapshots are currently being created, it will cause the migration to fail. Wait for the snapshot creation to complete before starting the migration.

Evaluate the impact on business

During the migration, the operating system kernel and software packages are installed or updated and the operating system is automatically restarted multiple times. In this process, business continuity cannot be ensured. We recommend that you assess the impact of migration on your business and suspend your business before you perform a migration job. We also recommend that you do not use the source operating system during the migration.

Billing

During the migration, the system creates snapshots for all disks of the ECS instance to back up data. You are charged for snapshots on a pay-as-you-go basis. For more information, see Billing.

Limits

Item

Description

General limit

  • Anolis OS and Alibaba Cloud Linux do not provide i686-based software packages. If your CentOS operating system is equipped with i386-based or i686-based software packages, you cannot migrate to Anolis OS or Alibaba Cloud Linux.

  • The operating systems of ECS instances that are created from custom images cannot be migrated.

  • The migration tool consumes resources when software packages are downloaded and installed during migration. Before you migrate an operating system of an ECS instance, make sure that the following resources are available:

    • Memory size: 600 MiB

    • Available disk capacity for the following directories:

      • /usr: 250 MiB.

      • /var: 4 GiB.

      • /boot: 100 MiB.

    Note

    If your ECS instance has a small number of vCPUs, a small amount of memory, and a small amount of storage capacity for the system disk and data disks, we recommend that you stop the services that run on the instance before you perform migration. This prevents migration failures caused by insufficient resources.

Limit on migrating from CentOS 7 to Alibaba Cloud Linux 2

Alibaba Cloud Linux 2 uses kernel version 4.19, which is incompatible with kernel version 3.10 of CentOS 7. If your business uses applications that depend on kernel APIs for different purposes, such as building out-of-tree kernel modules and using hardware resources, you must assess the applications in advance and determine whether the applications can run as expected after direct migration.

Limit on migrating from CentOS 7 to Alibaba Cloud Linux 3

Alibaba Cloud Linux 3 uses Linux Kernel 5.10 LTS, which is incompatible with kernel version 3.10 of CentOS 7. In addition, the GNU toolchain of Alibaba Cloud Linux 3 contains GCC 10.2, Binutils 2.35, and glibc 2.32. If your business uses applications that depend on kernel APIs for different purposes, such as building out-of-tree kernel modules and using hardware resources, you must assess the applications in advance and determine whether the applications can run as expected after direct migration.

Limit on migrating from CentOS 8 to Alibaba Cloud Linux 3

Alibaba Cloud Linux 3 uses Linux Kernel 5.10 LTS. The GNU toolchain of Alibaba Cloud Linux 3 contains GCC 10.2, Binutils 2.35, and glibc 2.32. Alibaba Cloud Linux 3 is compatible with the CentOS 8 ecosystem. When you use the migration tool to migrate from CentOS 8 to Alibaba Cloud Linux 3, the migration tool performs a basic assessment on the source operating system.

Prerequisites

  • The preparations for the migration are complete. For more information, see Before you begin.

  • The ECS instance is deployed in a virtual private cloud (VPC). If the ECS instance is in the classic network, you must migrate the ECS instance from the classic network to a VPC. For more information, see Migrate ECS instances from the classic network to a VPC.

  • Snapshots are created for the source operating system and data for backup, so that you can restore the source operating system and data if necessary. For more information, see Create a snapshot.

    Important

    If you migrate an operating system, the operating system kernel, software packages, and configurations are modified. The modifications are irreversible.

  • YUM or DNF is used for migration. Make sure that these two components run as expected.

  • After the migration, the original system disk is released. If the Delete Automatic Snapshots While Releasing Disk feature is enabled, the associated automatic snapshots are also released by default. The Delete Automatic Snapshots While Releasing Disk feature is manually disabled if you want to retain the snapshots that are associated with the original system disk. For more information, see Delete automatic snapshots while releasing a disk.

  • The source operating system can access the following public URLs if you want to migrate a CentOS 7 or CentOS 8 operating system to Red Hat 7 or Red Hat 8:

    • https://www.redhat.com

    • https://ftp.redhat.com

    • https://cdn-public.redhat.com

    • https://developer.aliyun.com

    • http://developer.aliyun.com

Procedure

  1. Optional. Perform the following operations if you want to migrate a CentOS 7 or CentOS 8 operating system to Red Hat 7 or Red Hat 8. Otherwise, skip this step.

    If the Security Center agent is installed on the source operating system, uninstall it.

    Note

    You can reinstall the Security Center agent after the migration and system upgrade are complete. For more information, see the "Manually install the Security Center agent" section of the Install the Security Center agent topic.

    1. Go to the Feature Settings page of the Security Center console. Find the server from which you want to uninstall the Security Center agent and uninstall the Security Center agent. For more information, see Uninstall the Security Center agent.

    2. Use a remote connection tool to connect to the server and run the following commands:

    3. wget "http://update2.aegis.aliyun.com/download/uninstall.sh" && chmod +x uninstall.sh && ./uninstall.sh
      if !  lsmod | grep AliSecGuard; then echo 'Uninstall Success'; else echo "Uninstall Failed"; fi
    4. If Uninstall Success is returned, the Security Center agent is uninstalled.

    Run the following command to upgrade the source operating system to the latest kernel version:

    CentOS 7

    # Back up the source YUM software repository and replace it with the Alibaba Cloud repository of CentOS 7.
    mv /etc/yum.repos.d/ /etc/yum.repos.d.backup/
    mkdir -p /etc/yum.repos.d/
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    yum clean all
    yum makecache
    # Upgrade and restart the operating system.
    yum -y update
    reboot

    CentOS 8

    # Back up the source YUM software repository and replace it with the Alibaba Cloud repository of CentOS 8.
    mv /etc/yum.repos.d/ /etc/yum.repos.d.backup/
    mkdir -p /etc/yum.repos.d/
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.aliyuncs.com/repo/Centos-8.repo
    wget -O /etc/yum.repos.d/epel-archive-8.repo http://mirrors.cloud.aliyuncs.com/repo/epel-archive-8.repo
    yum clean all
    yum makecache
    # Upgrade and restart the operating system.
    yum -y update
    reboot
  2. Migrate the operating system.

    (Recommended) Fast migration

    Note

    To use the SMC console to import the information about a migration source, make sure that the following conditions are met:

    • Internet access is enabled for the migration source.

    • Cloud Assistant Agent is installed on the migration source. By default, Cloud Assistant Agent is installed on ECS instances that are created based on public images after December 1, 2017.

    • If you want to import the information about a migration source as a Resource Access Management (RAM) user, make sure that the following permissions are granted to the RAM user:

      • AliyunRAMReadOnlyAccess. For more information, see Grant permissions to a RAM user.

      • The AliyunECSAssistantFullAccess policy is attached to the RAM user to grant the RAM user the permission to manage Cloud Assistant. For more information, see RAM overview.

    1. Log on to the SMC console.

    2. In the left-side navigation pane, choose Cloud Migration > OS Migration.

    3. On the OS Migration page, click Upgrade Operating System.

    4. In the Operating System Migration dialog box, configure the parameters that are described in the following table.

      Parameter

      Description

      Example

      Select Migration Source

      The migration source. Select the region of the ECS instance whose operating system you want to migrate and the ID or name of the ECS instance from the drop-down lists.

      • Region: China (Hangzhou)

      • Instance ID or name: i-2ze4looqfx**** or test

      Current Operating System

      The current operating system. By default, the current operating system is displayed and cannot be modified.

      CentOS 7

      Destination Operating System

      The operating system to which you want to migrate the source operating system. Select an operating system from the drop-down list.

      Alibaba Cloud Linux 3

    5. Select I acknowledge and accept these risks and authorize Alibaba Cloud to create snapshots for all disks on the instance and click Create.

    6. In the Migrate Operating System dialog box, read the messages and click Got It.

    7. In the Create Migration Job dialog box, click Go to the Migration Jobs page and wait until the migration job is complete.

      Warning

      During the migration, do not stop, restart, or release the Windows ECS instance manually or by using O&M scripts.

    Staged migration

    Step 1: Import the information about a migration source

    Migration sources can be servers of a variety of types, such as servers in data centers, VMs, and hosts on third-party cloud platforms. SMC supports multiple methods to import the information about migration sources. You can select a method based on your business requirements. For more information, see the How do I select the method to import the information about a migration source? section of the "FAQ" topic.

    (Recommended) Import the information about a migration source by using the CLI

    Important

    The source server must be accessible over the Internet.

    1. Log on to the SMC console.

    2. In the left-side navigation pane, choose Cloud Migration > OS Migration.

    3. On the OS Migration page, click Import Migration source.

    4. Configure the parameters as prompted and copy the activation code command. The following table describes the parameters.

      Parameter

      Description

      Migration Source Type

      The type of the migration source. Select ECS Instance.

      Import Method

      The method that is used to import the information about the migration source. Select Use CLI to Import Server.

      Migration Source Quota

      The number of migration sources whose information you want to import by using the activation code. Valid values: 1 to 1000. Default value: 10.

      Validity Period

      The validity period of the activation code. Unit: day. Valid values: 1 to 90. Default value: 30.

      Activation Code

      Generate the activation code and copy the generated command by performing the following steps:

      1. Click Generate.

      2. Click the Linux Shell tab.

      3. Click Copy to copy the activation code command.

    5. Log on to the source server and paste and run the copied command as an administrator to import the information about the migration source.

      1. Log on to the Linux server.

      2. Paste and run the copied command as an administrator to import the information about the migration source.

        image.png

        After the command is run, if a message similar to Import Source Server [s-bp18x8751kgz2oyh****] Successfully! is returned, the information about the migration source is imported.

    6. On the Server Migration page in the SMC console, view the status of the migration source in the Real-time Migration Status column.

      • If the status of the migration source is Online, the information about the migration source is imported.

      • If the migration source is in another state, the information fails to be imported. In this case, troubleshoot the failure based on the following solutions and import the information about the migration source again:

        • Troubleshoot the failure based on the message displayed in the SMC console or the log file in the directory where the SMC client is installed. By default, the SMC client is installed in the following directory:

          • Windows server: C:\smc

          • Linux server: /smc

        • Refer to the FAQ about Server Migration Center (SMC) and Troubleshooting topics for troubleshooting.

    Import the information about a migration source by using the SMC client

    For more information about the SMC client, see Use the Windows GUI version of an SMC client.

    1. Log on to the SMC console.

    2. In the left-side navigation pane, choose Cloud Migration > OS Migration.

    3. On the OS Migration page, click Import Migration source.

    4. On the Import Migration Source page, configure parameters. The following table describes the parameters.

      Parameter

      Description

      Migration Source Type

      The type of the migration source. Select ECS.

      Import Method

      The method that is used to import the information about the migration source. Select Use Client to Import Server.

      Description

      Read the information in the Description section and download the required version of the SMC client based on the CPU architecture (Arm or x86) and bit version (32-bit or 64-bit) of the operating system of the migration source.

    5. Import the information about the migration source.

      Important

      During the migration, do not shut down the SMC client until the migration is complete. Otherwise, the migration source is disconnected from the SMC console, and the migration fails.

      1. You can use a remote connection tool that supports file transfer. For example, you can use WinSCP to upload the SMC client package to the source Linux server.

      2. Connect to the source Linux server and decompress the SMC client package.

        Linux 64-bit Generic is used in the example. Run the following command to decompress the package. If you use another version of the SMC client, replace the package name in the command with the name of your SMC client.

        tar xf go2aliyun_client_linux_x86_64.tar.gz
        Note

        Linux ARM64 supports the g6r general-purpose instance family and the c6r compute-optimized instance family. For more information about instance types, see the "ARM-based enterprise-level computing instance families" section of the Overview of instance families topic.

      3. (Optional) Exclude the files or directories that you do not need from the migration. For more information, see the How do I exclude files or directories from a migration job? section of the "FAQ" topic.

        Important

        If you enable the block replication feature, you cannot exclude files or directories from the migration job.

      4. Obtain an activation code or AccessKey pair.

        • (Recommend) Obtain an activation code: In the Description section in the SMC console, click Generate and copy the generated activation code information.

        • Obtain an AccessKey pair: An AccessKey pair consists of an AccessKey ID and an AccessKey secret. If no AccessKey pair is created, create one first. For more information, see Obtain an AccessKey pair.

      5. In the SMC client folder, run the following commands to run the SMC client.

        Run the following commands as a root or sudo user based on whether you have root or sudo permissions on the operating system of the source server.

        Root user
        cd go2aliyun_client_linux_x86_64
        chmod +x go2aliyun_client
        ./go2aliyun_client
        Sudo user
        cd go2aliyun_client_linux_x86_64
        sudo chmod +x go2aliyun_client
        sudo ./go2aliyun_client
      6. Enter the activation code or AccessKey pair as prompted. In this example, an activation code is used, as shown in the following figure.adad

        The following messages may appear after you enter the activation code.

        • If no snapshot dependency is installed on your source server, a message appears. The following figure shows the details of the message. You can decide whether to install a snapshot dependency based on whether you enable the block replication feature.

          • If you want to enable block replication for the migration, enter yes to automatically install a snapshot dependency.

          • If you do not want to enable block replication for the migration, enter no.

          Important

          If the snapshot dependency fails to be installed, do not enable block replication when you create a migration job. Otherwise, the migration may fail.

          123

        • The rsync tool is installed on most mainstream migration sources. If rsync is not installed on the migration source, the SMC client displays a message. Enter yes to install rsync, as shown in the following figure.安装rsync

        • If SELinux is enabled on the migration source, a message that prompts you to disable SELinux appears. Enter yes to disable SELinux. The following figure shows how to disable SELinux.关闭SELinux

        If the information about the migration source is imported, a message similar to the following one is returned: Import Source Server [s-bp11npxndknsycqj****] Successfully!.

        Note

        If the information about the migration source fails to be imported, you can troubleshoot the issue based on the returned message. After you fix the issue, run the following commands to exit the background program and re-import the information about the migration source based on your permissions on the operating system of the migration source. For more information about frequently asked questions (FAQ) and solutions, see FAQ about Server Migration Center (SMC) and Troubleshooting.

        Sudo user
        sudo ./go2aliyun_client --abort
        sudo ./go2aliyun_client
        Root user
        ./go2aliyun_client --abort
        ./go2aliyun_client
    6. On the OS Migration page of the SMC console, view the status of the migration source in the Real-time Migration Status column.

      • If the status of the migration source is Online, the information about the migration source is imported.

      • If the migration source is in another state, the information fails to be imported. In this case, troubleshoot the failure based on the following solutions and import the information about the migration source again:

        • Troubleshoot the failure based on the message displayed in the SMC console or the log file in the directory in which the SMC client is installed. By default, the SMC client is installed in /smc.

        • Refer to the FAQ about Server Migration Center (SMC) and Troubleshooting topics for troubleshooting.

    Step 2: Create a migration job

    1. Find the migration source that you want to manage, click Create Migration Job in the Actions column.

    2. Configure the parameters as prompted and click Create.

      You can configure the following parameters to create an operating system migration job:

      • Current Operating System: By default, the current operating system is displayed and cannot be modified. Example: CentOS 7.

      • Destination Operating System: Select the operating system to which you want to migrate the source operating system from the drop-down list. Example: Alibaba Cloud Linux 3.

      • Migration Test:

        Optional. Turn on or off Migration Test to enable or disable the migration test feature. By default, the switch is turned on. You can use this feature only for Linux operating system migration. For more information, see Configure a migration test.

        Note

        A migration test is a process of simulating and verifying a migration solution before you perform an actual migration job. A migration test helps you fully understand the feasibility and risks of a migration solution before you perform an actual migration job. This reduces the issues and losses that may occur during the actual migration.

        A migration test helps you identify issues that may occur during the migration, provides solutions to the issues, and improves the migration success rate.

      • Execution Method:

        Optional. If you turn on Migration Test, you can select the mode in which you want to perform a migration test.Execution Method By default, Test and Migrate is selected.

        Valid values:

        • Test Only: The system performs only the migration test. After the migration test is complete, you must manually start the operating system migration job.

        • Test and Migrate: The system performs the migration test. After the migration test is complete, if no test items are in the Critical state, the system automatically starts the operating system migration job.

    3. In the Migrate Operating System message, read the messages and click Got It.

    4. In the Create Migration Job message, click Go to the Migration Jobs page and wait until the migration job is complete.

      Warning

      During the migration, do not stop, restart, or release the Linux ECS instance manually or by using O&M scripts.

Verify the migration result

  • If the migration job enters the Completed state, the operating system is migrated.

    image

    Note

    After the migration job is complete, the ECS instance automatically restarts. During the system initialization, operations such as software package updates are performed. Do not perform operations on the ECS instance until the operating system starts. The system initialization takes about 10 minutes. The actual time varies based on the number of system software packages to be processed.

    On the OS Migration page, find the migration source and click View Destination Instance in the Actions column. In the Configuration Information section of the Instance Details tab of the ECS instance, verify that the source operating system is migrated to the destination operating system.

    image

    Important

    After the migration is complete, the operating system kernel and software packages of the source operating system are upgraded. Original application data is retained. However, your applications may not run as expected due to changes in the environment or dependencies. In this case, business cannot run as expected. Therefore, you must test and verify a migration solution before you perform a migration job.

  • If the state of the migration job changes to Error, the migration job fails.

    In this case, you need to perform the following operations:

    1. Click Troubleshoot Errors in the Actions column and fix the failure based on the error code and error message. For more information, see FAQ about Server Migration Center (SMC) and Troubleshooting.

    2. On the Migration Jobs page, click Retry Migration Job.

      The migration job resumes from the point where it was suspended.

      Important

      If the intermediate instance is released, you must create another migration job. For more information, see the What do I do if I release an intermediate instance by accident? section of the "FAQ" topic.

    If you want to roll back the system disk on which the source operating system is installed, you can use the snapshots that are automatically created for the system disk. To roll back the system disk, perform the following steps:

    1. Log on to the ECS console.

    2. In the left-side navigation pane, choose Storage & Snapshots > Snapshots.

    3. On the Disk Snapshots tab of the Snapshots page, find the snapshot that you want to use to roll back the system disk, and click Roll Back Disk in the Actions column.

    4. In the Roll Back Disk dialog box, click Confirm.

Clear resources

During the migration, SMC creates two pay-as-you-go snapshots named SMC_Backup_Snapshot_XXX and SMC_Transition_Snapshot_XXX for disks of the ECS instance for backup and data transfer. The method of clearing the snapshots depends on whether the migration is successful.

  • If the migration is successful, the snapshots are automatically released. No manual operation is required.

  • If the migration fails, the snapshots are not automatically released and incur fees as long as the migration job exists. You can release the snapshots by using one of the following methods to reduce costs:

    • If you no longer need the migration job, click the ID of the migration job. On the job details page, click Clear migration task in the Actions column in the Migration Jobs section to delete the migration job and release the intermediate cloud disk at a time.

    • Manually delete the snapshots. For more information, see Delete a snapshot.