Having tried all the major virtualization vendor’s products over the years, I am most familiar with Microsoft Hyper-V and so my network lab runs that hypervisor on hardware. Microsoft has done an ever improving job over recent years to support non-Microsoft Operating Environements, NMOE, on their Hyper-V platform.
This post is to report my recent experience and supplient other available instructions for getting CentOS 6.2 running on the Hyper-V platform. At the end of the post, there are a series of questions I am left with about how this could be replicated easily.
Step 1: Download the CentOS minimal iso. (From CentOS)
Step 2: Download the Linux Intergration Components. (From Microsoft Current as of publication, check for newer versions. )
Step 3: Create a new virtual machine:
- Use the CentOS DVD iso to install. (Attach the file to an IDE DVD in the settings)
- A 10GB VHD will suit most users, you can add storage if your application demands it.
- Use at least 1GB RAM at least to install. (This gets us a graphical install albeit with no mouse, which we need to make a simpler disk layout. If you do a text install, you do not get to change the disk layout. You can change it to 512MB if you want after install.)
- Once the machine is created but before you boot up to install, go back to the settings. Remove the network adapter and install a Legacy Network Adapter. The legacy adapter will let the OS installation see a network and set all that up for us.
- Make sure you record the MAC address that Hyper-V assigns. You will need this information later.
Step 4: Boot the VM for the first time and Install the OS as normal for your application.
Step 5: Remember that CentOS 6 will not enable the interface by default. I usually go into the network manager during install and check the box to bring the interface up at boot.
Step 6: At the end of the OS install, it will eject the DVD and reboot. You may log in and verify that the interface was setup as you desired. Shut the VM down.
Step 7: Attach the MS Linux IC iso to the vm and boot up.
Step 8: Mount DVD.
mount /dev/cdrom /media
Step 9: Install integration components.
/media/install.sh
update on step 9 Some readers report that my fully qualified command did not work correctly for them. See the comments from Chris and Peter N regarding alternative methods to call the command.- [April 13 2012]
Step 10: Shutdown the VM.
Step 11: In settings remove legacy network adapter, insert network adapter.
Step 12: Change MAC address of network adapter to static and supply the MAC address you recorded earlier for the legacy adapter.
Step 13: Boot and verify network is still working.
As I wonder how to easily duplicate this virtual machine I am left with the problem that I cannot attach a cloned VHD to a running machine. So I cannot just mount a copy of the image and edit the required files. I could have a Linux machine dedicated to doing this and rebooting to achieve it… but that seems kind of ugly. I wish Windows Disk Manager knew what to do with EXT4.
For reference in CentOS 6, the MAC address is configured in a few places. At least one of which is new since ContOS 5.7. When devices are created the software **udev** is used and this represents a change from previous releases. The MAC address of interfaces is stored in
/etc/udev/rules.d/70-persistent-network.rules
as well as
/etc/sysconfig/network-scripts/ifcfg-eth0
In production I would probably want to set static IP address as well on machines before deploying them. Root password would need to be changed, and possibly hostnames.
Oh well, its a start. I hope the instructions help you get it going in your lab.
I am trying to follow this guide and keep getting the following error:
ls: cannot access kmod-micrososft-hyper-v-rhel16-43.1.x86_64.rpm: No such file or directory
ls: cannot access microsoft-hyper-v-rhel16-43.1.x86_64.rpm: No such file or directory
RPM’s are missing.
Any thoughts?
I got the same error. The below commands fixed it.
cd /media
./install.sh
Copy the contents of the CD image you have mounted under /media to a directory on the local disk and run install.sh from there instead.
e.g.,
mkdir /home/MSIntegration
cp /media/* /home/MSIntegration
cd /home/MSIntegration
./install.sh
You can use this method :
chmod 777 /media
Now run the command and it would execute properly:
/media/install.sh
chmod 777 /media
/media/install.sh
Several people have suggested changing the permissions of files that are on a CDROM disc will resolve the problems that others have reported here. I don’t understand that suggestion.
Two other issues are reported:
1) there is a relative path in the script, and you should change directory to the directory the script is in and run from there.
2) kernel versions… the components are precompiled for a certain kernel version. These are the versions that are released with the distro. If you rolled your own kernel, you need to look at building the LIC for yourself. (Untested: install the source RPM and build it from scratch. rpmbuild –rebuild –recompile )
Also, make sure to see updated post on installing for recent versions of RedHat 6.
[...]Advisorbits Update on Hyper-V LIC[...]