Preparing Linux VMs

Linux VMs migrating to Google Cloud with Migrate for Compute Engine need a prep package installed to automatically handle configuration changes.

This page describes how to install the Migrate for Compute Engine prep package on VMs you intend to run on Google Cloud.

This package makes changes at boot after detecting that the VM is running on Google Cloud. It must remain installed until after the VM is detached and cleanup is complete. For more information on the changes made by the package, see VM adaptations.

RHEL/CentOS/Oracle Linux

Use the following steps to prepare Red Hat Enterprise Linux (RHEL), CentOS, and Oracle Linux.

You can install the Migrate for Compute Engine RPM package in two ways:

  1. Install the package using Yum. This automatically fetches and installs the required prerequisites.
  2. Download and install the prerequisites, and then install the RPM package.

Installing using Yum

  1. Sign in to the workload VM.
  2. From the VM, download the latest Migrate for Compute Engine RPM package from the Downloads page.
  3. Install the prep package using yum:

    yum install migrate-for-gce-prep-version.redhat.x86_64.rpm
    

Downloading and installing prerequisites

  1. Log in to the workload VM.
  2. From the VM, download the latest Migrate for Compute Engine RPM package from the Downloads page.
  3. Check for the list of prerequisites by running:

    rpm -qpR migrate-for-gce-prep-version.redhat.x86_64.rpm
    

    For example:

    rpm -qpR migrate-for-gce-prep-4.11.0-0.redhat.x86_64.rpm
    
  4. Install the prerequisites individually.

  5. Install the migrate-for-gce-prep RPM package using Yum.

    yum install migrate-for-gce-prep-version.redhat.x86_64.rpm
    

If the installation is unsuccessful or if there are any warnings, ensure that you address them prior to executing the run-in-cloud operation.

SuSE SLES

Use the following steps to prepare SuSE Enterprise Linux Server (SLES) 11/12 for running in Google Cloud.

  1. Log in to the SLES virtual machine as the root user.
  2. Install the Migrate for Compute Engine SUSE RPM package from the Downloads page using a command such as the following.

    zypper install migrate-for-gce-prep-version.suse.x86_64.rpm
    

    For example:

    zypper install migrate-for-gce-prep-4.11.0-0.suse.x86_64.rpm
    

If the installation is unsuccessful or if there are warnings during installation, address them prior to migrating this VM.

Ubuntu/Debian

Use the following steps to prepare Ubuntu 14/16/18 or Debian 8.5/9.

  1. Sign in to the Ubuntu or Debian virtual machine as a user with sudo privileged access.
  2. Install the Migrate for Compute Engine .deb package (available at the Downloads page) using a command such as the following:

    sudo dpkg -i migrate-for-gce-prep-version.deb
    

    For example:

    sudo dpkg -i migrate-for-gce-prep-4.11.0-0.deb
    
  3. Complete installation of all required or missing prerequisites for the migrate-for-gce-prep package.

    sudo apt-get update && sudo apt-get install -f -y
    

If the installation is unsuccessful or if there are warnings during installation, address them prior to migrating this VM using Migrate for Compute Engine.

Amazon Linux

Use the following steps to prepare Amazon Linux or Amazon Linux 2.

  1. Check if the kernel includes VirtIO drivers by running the following command:

    grep -i virtio /boot/config-$(uname -r)
    
    If the VirtIO drivers are included, you see a response similar to the following:
    CONFIG_BLK_MQ_VIRTIO=y
    CONFIG_VIRTIO_VSOCKETS=m
    CONFIG_VIRTIO_VSOCKETS_COMMON=m
    CONFIG_VIRTIO_BLK=m
    CONFIG_SCSI_VIRTIO=m
    CONFIG_VIRTIO_NET=m
    CONFIG_VIRTIO_CONSOLE=m
    CONFIG_HW_RANDOM_VIRTIO=m
    # CONFIG_DRM_VIRTIO_GPU is not set
    CONFIG_VIRTIO=m
    CONFIG_VIRTIO_MENU=y
    CONFIG_VIRTIO_PCI=m
    CONFIG_VIRTIO_PCI_LEGACY=y
    # CONFIG_VIRTIO_BALLOON is not set
    CONFIG_VIRTIO_MEM=m
    # CONFIG_VIRTIO_INPUT is not set
    CONFIG_VIRTIO_MMIO=m
    # CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set`
    # CONFIG_RPMSG_VIRTIO is not set
    CONFIG_VIRTIO_FS=m
    

    If you don't see any information, it means that the VirtIO drivers are missing and need to be installed. If you need to install the VirtIO drivers, complete the following steps:

    1. Edit the /etc/dracut.conf.d/ec2.conf file and comment out the following line:
      omit_dracutmodules+="dm dmraid i18n plymouth crypt lvm mdraid qemu terminfo kernel-modules"
      
    2. Edit the /etc/dracut.conf file as follows:

      1. Add the line:
        add_drivers+="virtio virtio_scsi virtio_net"
      2. Uncomment the line hostonly=yes and change the value to no.
        hostonly=no
    3. Rebuild the initial RAM disk (initrd).

      dracut -f -v
      

    4. Run the following command to confirm that the initrd includes VirtIO drivers.

      lsinitrd /boot/initramfs-$(uname -r).img | grep virtio
      

  2. Run offline migration on the VM (as-is).

  3. Install the Google guest environment. For more information, see Installing the guest environment.

  4. Remove the amazon-ssm-agent and awscli packages by running the following commands:

    rpm -e amazon-ssm-agent
    rpm -e awscli
    rpm -e aws-cli
    rpm -e rh-amazon-rhui-client
  5. Configure the ntp package:

    yum install -y ntp
    sed -i 's/^pool /#pool /g' /etc/ntp.conf
    echo "server metadata.google.internal" >> /etc/ntp.conf
  6. Enable and restart the ntp service based on your operating system type.