All Products
Search
Document Center

Server Migration Center:Migrate a Linux operating system

Last Updated:Jul 18, 2024

Technical support may no longer be available for operating systems due to reasons such as end of service lifecycle, end of third-party support, or evolution of open source projects. 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 seamlessly migrate the operating system to another operating system by using Server Migration Center (SMC) for future maintenance and technical support. This topic describes how to use SMC to migrate and upgrade operating systems.

Important

Migrating CentOS 7/8 to RedHat 7/8 through SMC is currently only available to some users. If you want to experience this feature, you can submit a ticket.

Scenarios

The following table describes the x86- or ARM64-based operating systems that can be migrated by using SMC and the corresponding operating systems to which they can be migrated.

Operating system architecture

Source operating system

Destination operating system

X86

CentOS 7

  • AnolisOS 7

  • AnolisOS 8

  • RedHat 7

    Important

    Only a CentOS 7.9 operating system can be migrated to Red Hat 7.

  • Alibaba Cloud Linux 2

  • Alibaba Cloud Linux 3

CentOS 8

  • AnolisOS 8

  • RedHat 8

    Important

    Only a CentOS 8.5 operating system can be migrated to Red Hat 8.

  • Alibaba Cloud Linux 3

  • RedHat 7

    Important

    Only Red Hat 7.9 is supported.

  • RedHat 8

Alibaba Cloud Linux 3

Alibaba Cloud Linux 2

Alibaba Cloud Linux 3

ARM64

CentOS 7

  • AnolisOS 7

  • AnolisOS 8

  • Alibaba Cloud Linux 3

CentOS 8

  • AnolisOS 8

  • Alibaba Cloud Linux 3

Important

The source operating system must be the operating system of an ECS instance in the current Alibaba Cloud account.

Usage notes

  • Before the migration, we recommend that you test and verify all business applications in the target OS environment in advance to ensure compatibility and performance between the applications and the target OS. This helps you avoid problems that may occur after the migration.

  • During the migration, the system creates basic disk snapshots, reinstalls software packages, creates a custom image of the system disk, replaces the system disk, stops, and starts the ECS instance. We recommend that you back up important data and plan a proper migration time to prevent the preceding operations from affecting your business.

  • If you perform a migration drill or cancel a migration process, the system may automatically roll back to the pre-migration snapshot. Data generated during the migration is lost. Do not use the ECS instance until the migration task is complete.

  • Before and during the migration and upgrade, the source instance will be checked for migration conditions and pre-evaluated. If the source system does not meet the migration conditions or fails the pre-evaluation, the migration will be interrupted. This does not guarantee that the migration and upgrade will be successful. We recommend that you familiarize yourself with the migration conditions and troubleshooting documents and perform testing.

  • During 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. We also recommend that you do not use the source operating system during migration.

Billing

During the migration, the system creates snapshots for all disks of the ECS instance to back up data. You are charged for the 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 instances that are created from custom images cannot be migrated.

  • The migration tool consumes resources to download and install software packages during migration. Before you perform a migration on an ECS instance, make sure that the following resources are available:

    • Memory size: 600 MiB

    • Amounts of disk space available for the following directories:

      • /usr: 250 MiB

      • /var: 4 GiB

      • /boot: 100 MiB

    Note

    If your 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 are running on the instance before you perform migration. This helps prevent 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 they can run as expected after a 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 they can run as expected after a 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. CentOS 8 software is compatible with Alibaba Cloud Linux 3. 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 operating system that you want to migrate.

Prerequisites

  • The preparations for the migration are complete. For more information, see Prepare for migration.

  • The ECS instance must be 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 taken for the source system and data. You can restore the snapshots if necessary. For more information, see Create a snapshot for a disk.

    Important

    The migration will make modifications to the operating system kernel, software packages, and configurations. 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, and the associated snapshots are also released by default. If you want to retain the snapshots, you can manually cancel the automatic snapshot release along with the 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. (Required) If you need to migrate CentOS 7/8 to RedHat 7/8, you must complete the following operations. 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.

    After the agent is uninstalled, Security Center still protects your server for 24 hours. If you want to reinstall the agent, install the agent 24 hours later. If you want to reinstall the agent within 24 hours after the agent is uninstalled, you must run the installation command at least three times and ignore the error messages during the installation. Otherwise, the reinstalled agent is automatically uninstalled.

    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 update 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
    # Update 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
    # Update and restart the operating system.
    yum -y update
    reboot
  2. OS migration.

    Quick Migration (recommend)

    Note

    To use this method, make sure that the following conditions are met:

    • The source server (the source ECS instance) must have the Internet access capability.

    • Install the Cloud Assistant Agent on the source server. By default, ECS instances created from public images after December 1, 2017 are pre-installed with the Cloud Assistant Agent.

    • If you use a RAM user to import data to a migration source, you must grant the following permissions to the RAM user.

      • You must grant the AliyunRAMReadOnlyAccess permission to the RAM user. For more information, see Attach a custom policy to a RAM user.

      • You must grant the Cloud Assistant management permission AliyunECSAssistantFullAccess to the RAM user. For more information, see RAM RAM.

    1. Log on to the SMC console.

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

    3. In the upper-left corner of the page, click Upgrade Operating System.

    4. In the Upgrade Operating System dialog box, set the parameters.

      Parameter

      Description

      Examples

      Select a migration source

      Select the region and ID /name of the ECS instance where the operating system to be migrated resides from the drop-down lists.

      • Region: East China (Hangzhou)

      • Instance ID /Name: i-2ze4looqfx****/test

      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

      Migration Test

      Specifies whether to enable the migration test feature. A migration test is a process of simulating and verifying a migration solution before you perform an actual migration. A migration test helps you fully understand the feasibility and risks of a migration solution before you perform an actual migration. 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.

      By default, the migration test feature is enabled. You can perform a migration test only on migration sources that run the Linux operating system. For more information, see Configure a migration test.

      Keep the default setting.

      Execution Method

      The mode in which you want to perform a migration test. 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.

      Keep the default setting.

    5. Select I am aware of the preceding risks and agree to authorize Alibaba Cloud to create snapshots for all disks of the instance and click Create.

    6. In the Confirm OS Migration dialog box, read the precautions and click OK.

    7. In the Create Migration Task dialog box, click View Now and wait until the migration task is complete.

      Warning

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

    Step-by-step migration

    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 migration sources. You can select a method to import migration sources based on your business requirements. For more information, see How do I select a method to import a migration source?

    Command line one-click import migration source (recommend)

    Important

    The source server must have Internet access.

    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.

      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: days. Valid values: 1 to 90. Default value: 30.

      Activation Code

      Generate the activation code and copy the generated command To roll back the system disk, perform 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 use the administrator permissions to paste and run the copied command to import the migration source.

      1. Log on to the Linux server.

      2. Use the administrator permission to paste and run the copied command to import the migration source.

        image.png

        After the command is executed, a similar Import Source Server [s-bp18x8751kgz2oyh****] Successfully! occurs A message is returned, indicating that the migration source is successfully imported.

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

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

      • If the migration source is in another state, the migration source fails to be imported. See the following solutions to resolve the issue and then re-import the migration source.

        • Solve the problem by following the error message in the console or by viewing the log file in the directory of the SMC client. By default, the SMC client is installed in the following directory:

          • Windows: C:\smc

          • Linux: /smc

        • For FAQ and solutions, see SMC FAQ and Troubleshooting.

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

    Important
    • The source server must have Internet access.

    • If you use a RAM user to import data to a migration source, you must grant the following permissions to the RAM user.

      • You must grant the AliyunRAMReadOnlyAccess permission to the RAM user. For more information, see Attach a custom policy to a RAM user.

      • You must grant the Cloud Shell management permission AliyunCloudShellFullAccess to the RAM user. For more information, see RAM RAM.

    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.

      Data import methods

      The method that is used to import the information about the migration source. Select Import through Console.

      Migration Source Name

      The name of the migration source. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), colons (:), underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (_), and hyphens (-).

      Operating system

      Select Linux.

      IP address

      The IPv4 address that is used to access the migration source over the Internet. Example: 120.55.XX.XX.

      Port

      The SSH port number of the migration source. Valid values: 1 to 65535. Default value: 22.

      Username

      Enter the user name of the operating system. The default value is root.

      Password

      Enter the password for the username of the operating system.

    5. After you configure the parameters, click Import.

      The import process takes about 3 to 10 minutes. Wait until the import is complete.

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

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

      • If the migration source is in another state, the migration source fails to be imported. See the following solutions to resolve the issue and then re-import the migration source.

        • Solve the problem by following the error message in the console or by viewing the log file in the directory of the SMC client. By default, the SMC client is installed in the following directory:

          • Windows: C:\smc

          • Linux: /smc

        • For FAQ and solutions, see SMC FAQ and Troubleshooting.

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

    For more information about the SMC client, see SMC client tools.

    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. In the Import Migration Source dialog box, configure the parameters. The following table describes the parameters.

      Parameter

      Description

      Migration Source Type

      The type of the migration source. Select ECS.

      Data import methods

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

      Description

      After Import Description, download the SMC client based on the architecture (Arm and x86) and 32-bit and 64-bit (64-bit) of the source server operating system.

    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) If you do not need to migrate some files or directories, you can exclude the files or directories from being migrated. 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 activation code: In the Import Instructions section of the SMC console, click Generate activation code and copy the activation code information.

        • AccessKey pair: The AccessKey pair consists of an AccessKey ID and an AccessKey secret. If no AccessKey pair is created, create one first. For more information, see Create 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, the 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 enable block replication when you create a migration task, enter yes to automatically install the snapshot driver.

          • If you do not want to enable block replication when you create a migration task, 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

        When a similar Import Source Server [s-bp11npxndknsycqj****] Successfully! appears in the echo indicates that the migration source is imported.

        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 SMC FAQ and Troubleshooting.

        Use sudo permissions
        sudo ./go2aliyun_client --abort
        sudo ./go2aliyun_client
        Run the following command as the root user:
        ./go2aliyun_client --abort
        ./go2aliyun_client
    6. On the OS Migration page in the SMC console, view the status of the migration source in the Migration Status column.

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

      • If the migration source is in another state, the migration source fails to be imported. See the following solutions to resolve the issue and then re-import the migration source.

        • Solve the problem by following the error message in the console or by viewing the log file in the directory of the SMC client. The default installation directory of the SMC client is /smc.

        • For FAQ and solutions, see SMC FAQ and Troubleshooting.

    Step 2: Create a migration task

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

    2. In the Create Migration Job dialog box, configure the parameters and click Create.

      You can set 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. In this example, CentOS 7 is selected.

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

    3. In the Confirm OS Migration dialog box, read the precautions and click OK.

    4. In the Create Migration Task dialog box, click View Now and wait until the migration task is complete.

      Warning

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

Verify the migration results

  • If the migration status is Completed, the OS is migrated.

    image

    Note

    After the migration task is complete, the ECS instance automatically restarts. You can perform operations such as updating software packages during system initialization. Do not perform operations on the ECS instance until the system starts successfully. The system initialization phase takes about 10 minutes. The actual time varies based on the number of system software packages to be processed.

    Find the source instance and click View Target Instance in the Actions column. In the Configuration Information section of the Instance Details tab, check whether the operating system is migrated to the destination instance.

    image

    Important

    After the migration and upgrade, the system of the source instance is upgraded to a new system kernel and software package, and the original application data remains unchanged. However, the application software may not run properly due to changes in the environment or dependencies, resulting in business failure. We recommend that you test and verify this.

  • If Migration Status is Error, the migration task fails.

    In this case, you need to troubleshoot the issue and try again:

    1. In the Actions column, click Troubleshoot Errors and fix the error based on the error code and error message. For more information, see FAQ and Errors occurred during a server migration.

    2. On the Migration Tasks page, click Retry Task.

      The migration task continues at the last completed progress.

      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 need to roll back the data of the source system disk, you can use the snapshots that are automatically created in the snapshot list to restore the data. 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, 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 message, click OK.

Resource cleanup

During migration, SMC creates two pay-as-you-go snapshots named SMC_Backup_Snapshot_XXX and SMC_Transition_Snapshot_XXX for the disks of the ECS instance to back up and transfer data. You need to select whether to manually clean up the snapshot based on whether the migration is successful:

  • Migration successful: The snapshot is automatically released. You do not need to manually clean it up.

  • Migration error: Snapshots always exist with the migration task and incur fees. You can use one of the following methods to release snapshots to avoid unnecessary fees:

    • If you no longer want to use the migration task, choose image > Delete in the Actions column to delete the task.

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