A quick guide to virtualize CentOS under Hyper-V
1. Prereqesuites
Host operating system
- Microsoft Windows Server 2008 with update KB950050
- Microsoft Windows Server 2008 R2
- Microsoft Hyper-V Server
- Microsoft Hyper-V Server R2
Guest operating system
- RHEL / CentOS 5.2 and later (5.X branch)
2. Introduction
This HowTo is a translation of my original french article found here.
Using the Linux Integration Tools v2.1 will add paravirtualization to a CentOS VM in a Microsoft environnment, thus increasing disk, network and overall speed and resolving a time drifting issue where the VM's clock progresses at a rate of about 3 / 1.
The integration tools are born after an agreement between TUV and Microsoft about interoperability between their virtualization solutions (KVM and Hyper-V). Basically any CentOS 5.4 (or an updated 5.2 +) kernel will work.
3. Getting the tools out of the box
Be aware that CentOS won't recognize Hyper-V's virtual network card until the Integration tools are installed. To be able to use internet and updates, please attach a 'Legacy Network Adapter' to your VM which will be named eth0.
After having attached the downloaded ISO image to the virtual machine runnning CentOS, make a copy of the tools:
$ mkdir /mnt/cdrom $ mkdir /opt/LinuxIC $ mount /dev/cdrom /mnt/cdrom $ cp -R /mnt/cdrom/* /opt/LinuxIC $ umount /dev/cdrom
Before building the kernel modules for your environnment, please make sure you already updated your distribution
$ yum update
so you don't have to recompile the modules after next kernel update. You'll also need the compilation environment. If you're not sure if you have everything, just type:
$ yum install gcc kernel-devel kernel-headers
Compiling the kernel modules should be very fast.
$ cd /opt/LinuxIC $ make
You might get an error message saying Your system DOES NOT support the timesource driver. In that case you'll have to install a clock adjustment patch.
$ yum install adjtimex
And then install the tools
$ make install
Once installed, you might check if the kernel modules are loaded by typing
$ lsmod | grep vm
The latter command shall output something like
''vmbus 88304 3 blkvsc,storvsc,netvsc''
(On non QWERTY keyboard layouts, sometimes the pipe char cannot be obtained because the key combination requires the 'ALT-GR' key which is used as HyperV's host key. You can obtain the pipe by using ALT + 124)
If everything worked out, you can remove the legacy network adapter after having checked the synthetic one works.
$ ifconfig seth0
Good virtual luck, Badministrateur