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.
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
as well as
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.