Migrating a Rocky Linux KVM VM to Microsoft Azure
Introduction
This article provides step-by-step instructions for migrating a local Rocky Linux 8.10
KVM
virtual machine to Microsoft Azure
using Azure Migrate
and the Azure Site Recovery
replication appliance.
The migration process involves preparing your source VM
, setting up the necessary Azure
infrastructure, configuring the replication appliance, and performing the actual migration.
Problem
Organizations need to migrate on-premises virtual machines often running on KVM
to Microsoft Azure
for cloud adoption, disaster recovery, or infrastructure modernization purposes. The amount of VMs to migrate to the cloud can range in the thousands and services such as Azure Migrate
help to make the transition smoother.
The migration process requires specific configuration steps for both the source VM
and Azure
environment to ensure successful replication and migration.
Symptoms
You have a fleet of Rocky Linux
VM
s running on KVM
that needs to be migrated to Azure
.
The VM
requires migrating to the cloud whilst maintaining its configuration and data integrity.
Resolution
Prerequisites
Rocky Linux
-
A
Rocky Linux 8.10
KVM
VM
(as an example, but Rocky Linux 9 and Rocky Linux 10 are also fine) with a minimum of: -
4096 MB of
RAM
-
2
vCPUs
-
16GB of disk space
-
SCSI
disk type
Windows Server
-
A
Windows Server 2022
VM
onKVM
, also with a minimum of: -
16GB of
RAM
-
8
vCPUs
-
700GB of disk space (the replication appliance requires at least 600GB of disk space cache available)
Please check Azure Appliance requirements
Azure
-
An active
Azure
subscription with appropriate permissions -
Access to the
Azure Portal
Step 1: prepare the source Rocky Linux VM
-
Deploy a local
Rocky Linux 8.10
KVM
and upgrade all packages. -
Provide the
VM
with 4096 MB ofRAM
, 2vCPUs
and 16GB of disk as listed in the Prerequisites. -
Change the bus type to
SCSI
before installing theOS
. This is performed underHardware
-->VirtIO Disk 1
-->Disk bus
and changing the bus type toSCSI
-
In the
KVM
VM
, enable the following firewall ports for communication with the replication appliance:
sudo firewall-cmd --add-port=135/tcp --permanent
sudo firewall-cmd --add-port=443/tcp --permanent
sudo firewall-cmd --add-port=1024-65535/tcp --permanent
sudo firewall-cmd --add-port=443/udp --permanent
sudo firewall-cmd --reload
-
Shut down the
VM
-
Remove the
SATA CDROM 1
hardware. -
Change the
SCSI Disk 1
XML
to the following:
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/PATH/TO/<YOUR_QCOW2_IMAGE>.qcow2"/>
<target dev="sda" bus="scsi"/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
- Power up the
VM
and verify it boots successfully.
Step 2: prepare the Windows Server 2022 VM for the replication appliance
-
Deploy a
Windows Server 2022
VM
onKVM
with 16GB ofRAM
, 8vCPUs
and 700GB of disk space. Choose theStandard Desktop
installation. -
Set a password and then login to the Windows Server.
Step 3: configure the Azure virtual network
-
Go to
Virtual Networks
in theAzure Portal
and clickCreate
-
Under
Basics
, select yourResource Group
, enter aVirtual network name
and choose your region. -
For
Security
, leave all options at default and clickNext
-
For
IP addresses
, leave all options at default and clickNext
-
In
Tags
, apply your tags and clickNext
-
Click
Create
Step 4: set up the Azure Migrate project
-
Go to
Azure Migrate
-->Servers, databases and web apps
and selectCreate project
-
Add your
Resource Group
,Project Name
,Geography
and clickCreate
-
Under
Assessment tools
, go toMigration and modernization
(**note, do not use the "Azure Migrate: Discovery and assessment" option **) and clickDiscover
-
For
Where do you want to migrate to?
, chooseAzure VM
-
For
Are your machines virtualized?
, selectPhysical or other (AWS, GCP, Xen, etc.)
-
Select your
Target region
-
Check the box that says
Confirm that the target region for migration is "<REGION>"
-
Click
Create resources
-
Return to
Discover
and specify the same options forWhere do you want to migrate to?
,Are your machines virtualized?
andTarget region
-
For
Experience type
, selectSimplified Experience (Recommended)
-
Go to Step 2 and click
Generate key
to create yourASR replication appliance key
-
Store this key in a safe location for later use in the process.
Step 5: Install and Configure the Replication Appliance
-
Download the installer from the provided link to your
Windows Server 2022
VM
-
Extract the zip file's contents.
-
Open a
PowerShell
window as an Administrator, navigate to the folder and run.\DRInstaller.ps1
-
If you receive an error about the script not being digitally signed, run this command instead and modify the path for your folder's location:
powershell -ExecutionPolicy Bypass -File "C:\Users\Administrator\Downloads\DRAppliance\DRAppliance\DRInstaller.ps1"
-
Go to the desktop and open the shortcut to the
Microsoft Azure Appliance Configuration Manager
-
Click
Continue
through theSet up prerequisites
,Appliance components
andSelect Replication appliance connectivity
steps. -
Under
Register with Recovery Services vault
, provide a friendly name and theASR replication appliance key
you generated earlier. -
Click
Login
and thenCopy code and Login
-
Log in with your
Azure
credentials. -
Once the appliance is registered, click
Continue
-
Under
Configure vCenter details
, checkI do not have vCenter Server/vSphere ESXi server. I'll protect my servers by manually discovering them using IP addresses.
and pressContinue
-
For
Provide physical server credentials
, clickAdd credentials
-
Select the
Operating System
asLinux
, provide a friendly name and input theroot
user's credentials. -
Click
Add
-
Under
Provide physical server information
, clickAdd server
-
Input the
IP
address of yourRocky Linux 8.10
VM
and clickAdd
-
Click
Continue
and wait approximately 30 minutes for the process to complete. -
Verify you see a green checkmark with
Completed appliance configuration successfully.
Step 6: configure replication
-
In the
Azure Portal
, go toAzure Migrate: Server Migration
and clickReplicate
-
Leave other options as default and for
Are your machines virtualized?
choosePhysical or other (AWS, GCP, Xen, etc.)
-
From
On-premises appliance
, choose your appliance and selectContinue
-
For
Basics
-->Guest credentials
, choose yourRocky Linux 8.10
VM's
guest credentials. -
Select the checkbox next to your
VM
when it appears and clickNext
-
For
Target settings
, choose yourVirtual network
created earlier, leave other options as default and clickNext
-
At
Compute
, clickNext
-
For
Disks
-->Disk Type
, selectStandard SSD
(or another disk type of your choice) and clickNext
-
For
Tags
, add your tags and clickNext
-
At
Review + Start replication
, chooseReplicate
Step 7: perform the migration
-
Skip the
Test migration
step if not needed and go toMigrate
-
Leave the default
Azure VM
option and clickContinue
-
Select the
VM
you want to migrate and leaveYes, shutdown virtual machines(Ensures no data loss)
checked. -
Click
Migrate
Step 8: configure network access for the migrated VM
-
Once complete, your local
VM
will shut down. -
Go to
Virtual Machines
inAzure Portal
to access your newly migratedVM
-
Navigate to your newly created
VM
underVirtual Machines
, thenNetworking
and thenNetwork settings
-
Click
Add network security group
-
When the
network security group
is created, clickCreate port rule
and selectInbound port rule
-
Specify an
IP
address, source and destination ports, the protocol to use, and theAction
to allow or deny traffic. -
Click
Save
-
For temporary
SSH
access testing, you can setSource
toAny
,Source port ranges
to*
,Destination port ranges
to22
. Please check with your Security Team on how ports, protocols and IPs should be set up first for best security practices. -
Click
Add
Step 9: configure a public IP address
-
Under
Networking
-->Network settings
, check that aPublic IP address
is listed. -
If not present, click
(Configure)
and click on yourNIC
listed in the table. An exampleNIC
name isnic-rocky-linux-810-00-ipconfig
-
Check the box next to
Associate public IP address
and clickSave
-
Refresh the
IP configurations
page to see thePublic IP Address
-
Go to your
VM
, thenConnect
and selectNative SSH
-
ssh
into your machine with theroot
account or another configured account.
Notes
The migration process may take considerable time depending on the size of your source VM
and network bandwidth.
Always perform a test migration before executing the final migration in production environments.