This guide will help you prepare your CentOS 6 server for a migration from on-premise to Microsoft Azure cloud. It can be a bit tricky to get everything to work correctly and personally I didn’t find Microsofts guides to be great so I write this post to help you with the steps that is needed to migrate your old CentOS 6 machine to the cloud.
What you need to configure
- Install Azure Linux Agent
- Network Configuration
- Hyper-V Drivers Configuration
- Serial Console Configuration
How to do it
Install Azure Linux Agent
Note: You will probably need to fix mirror configuration since CentOS 6 is EOL. Instructions can be found on the following link.
- Alternative 1
yum install WaLinuxAgent
- Alternative 2
cd /tmp
wget http://olcentgbl.trafficmanager.net/openlogic/6/openlogic/x86_64/RPMS/WALinuxAgent-2.2.45-1.el6.noarch.rpm
yum localinstall WALinuxAgent-2.2.45-1.el6.noarch.rpm
Network Configuration
The network interface needs to be configured to use DHCP and you need to add the hyper-v drivers to the interface. You can either do it by configuring your existing networki interface (eth0) or create a new one:
1. Create a configuration file for the interface
vim /etc/sysconfig/network-scripts/ifcfg-eth0
NAME="eth0"
DEVICE="eth0"
BOOTPROTO=dhcp
ONBOOT=yes
Save the file with :wq
2. Map the networking card to the Hyper-V drivers by appending the following line to the 70-persistent-net.rules file.
vim /etc/udev/rules.d/70-persistent-net.rules#For Azure
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="hv_netvsc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
Save the file with :wq
Hyper-V Drivers Configuration
- Add Hyper-V drivers to Dracut
vim /etc/dracut.conf
add_drivers+=" hv_vmbus hv_netvsc hv_storvsc nvme ena xen_blkfront xen_netfront mptbase mptscsih mptspi " - Update Initramfs by running the following command:
dracut --force -v
- Verify that the Hyper-V modules have been loaded
lsinitrd | grep hv
Serial Console Configuration
Azure uses ttyS0 for serial connection so we need to add it to our configuration.
- First add ttyS0 to secureetty by appending the following
vim /etc/secureetty#add
ttyS0 - Configure grub
vim /boot/grub/grub.conf
#add below configuration to kernelrootdelay=300 console=ttyS0 earlyprintk=ttyS0
#also removerhgb quiet crashkernel=auto
- Configure sysconfig/init
vim /etc/sysconfig/init
#Edit ACTIVE_CONSOLES to look like (make sure to use “”):ACTIVE_CONSOLES="/dev/tty[1-6] /dev/ttyS0"
Also make sure to configure:timeout=15
serial --unit=0 --speed=115200
terminal --timeout=5 serial console
Now you are ready for a migration to Microsoft Azure. I hope you found this guide helpful and that you will succeed with your cloud transformation.
Note: If you are running CentOS 7 I also have a guide for preparing your server for Azure.
// Rickard Carlsson