Step By Step Guide To Install CentOS Linux Virtual Machine in Windows Hyper-V Server
[LEFT][CODE]http://www.hyper-v-mart.com/HowTo/Install_CentOS_5_VM_Step_by_Step.aspx[/CODE][B]Question:[/B]
Please follow this step by step guide to load CentOS 5.x or other Linux Operating System in Windows Hyper-V server.
[B]Solution:[/B]
[B]1) Creating a Hyper-V server[/B]
First, create a virtual machine within Hyper-V manager. If yo don't know, please refer to [URL="http://www.hyper-v-mart.com/HowTo/Create_HyperV_Virtual_Machine.aspx"]Step by Step Guide to Create Windows Hyper-V Virtual Machine[/URL].
[B]2) Adding Legacy Network Adapter[/B]
CentOS5 doesn't support synthetic deivces. We created an emulated network adapter to access Interate in order to make installation convenient. Select the new VM -> In [B]Actions[/B] pane, select [B]Settings...[/B] -> In the new VM's setings window, on the left pane under [B]Hardware[/B], click [B]Add Hardware[/B]. -> On the right pane under [B]Add Hardware[/B] selec [B]Legacy Network Adapter[/B] and click [B]Add[/B].
[B] Figure 1[/B]
[IMG]http://www.hyper-v-mart.com/HowTo/Images/CreatingCentOSVM/Install_CentOS5_VM_Step_by_Step1.gif[/IMG]
The right pane's content will change to [B]Legacy Network Adapther[/B] . Drop down [B]Network:[/B] list and select [B]External Virtual Network[/B]. Click [B]Apply[/B]. Now you have an emulated network adapter to be used to access Internet before enable synthetic network adapter.
[B]Firgure2[/B]
[IMG]http://www.hyper-v-mart.com/HowTo/Images/CreatingCentOSVM/Install_CentOS5_VM_Step_by_Step2.gif[/IMG]
[B] 3) Install CentOS 5[/B]
On left pane under [B]Hardware[/B], select [B]IDE Control 1[/B] -> [B]DVD Drive[/B]. On right pane under [B]Media[/B] select proper installation media. We used CentOS DVD image to install, so select [B]Image file :[/B] and [B]Browse[/B] to the image file and open.
Click [B]OK[/B]
[B]Firgure3[/B]
[IMG]http://www.hyper-v-mart.com/HowTo/Images/CreatingCentOSVM/Install_CentOS5_VM_Step_by_Step3.gif[/IMG] Double click the VM in Hyper-V manger. There would pop up the [B]Virutal Machine Connection Window[/B]. On the new VM window, select menu [B]Action[/B] -> [B]Start[/B]. Now CentOS installation start.
[B]Figure4[/B]
[IMG]http://www.hyper-v-mart.com/HowTo/Images/CreatingCentOSVM/Install_CentOS5_VM_Step_by_Step4.gif[/IMG]
The intall process is much the same like to install on a physical server. The emulated network adapter should be recognized and should show up as [B]Figure 5.[/B]. We would configure it to make installation more convenient.
[B]Figure 5[/B]
[IMG]http://www.hyper-v-mart.com/HowTo/Images/CreatingCentOSVM/Install_CentOS5_VM_Step_by_Step5.gif[/IMG]
[B]4) Install Linux Service Integration Component[/B]
Now we'll go through the most exciting part of the installation, Linux IC installation. Donwload [B]Linux Integration Components for Windows Server 2008 Hyper-V[/B] to your host server. The URL for the time this article is writen is [URL="http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ab7f4983-93c5-4a70-8c79-0642f0d59ec2"]here[/URL]
[B]Figure6[/B]
[IMG]http://www.hyper-v-mart.com/HowTo/Images/CreatingCentOSVM/Install_CentOS5_VM_Step_by_Step7.gif[/IMG]
After extract the ISO file, mount it to the new VM's DVD drive (shows in Figure3). To install the drivers we need the development tools. The easiest way to install those is via Yum.
[CODE]sudo yum groupinstall "Development Tools"
[/CODE] Next we will copy the contents of the cdrom to the server
[CODE]
mkdir -p /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp -rp /mnt/cdrom /opt/linux_ic
umount /mnt/cdrom
[/CODE] Then let's install it.
Please note that if you want to shift to root user before execute this command by running 'su', it may not work. You need to run 'su -'. It will load root user's context completely(Thanks José for providing your experience!).
[CODE]
cd /opt/linux_ic
sudo ./setup.pl drivers
But you may fail and get the following information:
Checking if required components are installed...
No kernel-devel or kernel-source package installed.
You must install this package before installing the drivers.
[/CODE] It requires "kernel-devel". So let's install via Yum [CODE]sudo yum install kernel-devel
[/CODE] Let's try again.But you mail fail again and get the following: [CODE]
Checking if required components are installed...done.
Installing Linux integration components (vmbus, enlightened ide, enlightened scsi
and network drivers) for Hyper-V...
Building vmbus driver...An error has occured during the setup!
Please view the drvinstall.err for more details.
[/CODE]And detailed info shows in [B]drvinstall.err[/B] as
[CODE]
[root@localhost linux_ic]# cat drvinstall.err
make: *** /lib/modules/2.6.18-128.el5/build: No such file or directory. Stop.
make[1]: *** [default] Error 2
make: *** [public] Error 2
[/CODE]We need to update whole system by running [CODE]sudo yum update
[/CODE] Then reboot the VM. [CODE]reboot
[/CODE] After reboot let's try again:
[CODE]
[root@localhost linux_ic]#./setup.pl drivers
Checking if required components are installed...done.
Installing Linux integration components (vmbus, enlightened ide, enlightened scsi
and network drivers) for Hyper-V...
Building vmbus driver...done.
Building blkvsc driver...done.
Building storvsc driver...done.
Building netvsc driver...done.
Installing vmbus driver...done.
Installing blkvsc driver...done.
Installing storvsc driver...done.
Installing netvsc driver...done.
Updating module dependencies. This may take a while...done.
Installing various udev rules and scripts...done.
Updating initrd image...
Backing up /boot/initrd-2.6.18-164.el5.img to /boot/initrd-2.6.18-164.el5.img.backup0
Done. Updated /boot/initrd-2.6.18-164.el5.img
Updating grub conf file...
Done.
Installing vmbus startup script...
*** The drivers have been installed successfully.*** [ OK ]
[/CODE] You can verify it by running "lsmod | grep vsc". If you get the following, you succeeded. Congratulations! [CODE]
[root@localhost linux_ic]# lsmod | grep vsc
storvsc 67208 0
netvsc 74088 0
vmbus 86504 2 storvsc,netvsc
scsi_mod 196697 4 storvsc,scsi_dh,libata,sd_mod
[root@localhost linux_ic]#
[/CODE] [B]5) Post install configuration[/B]
When reboot VM you may get error like "kernel panic". It's becuase another kernel was install during update. You can check it out by click any key at the very beginning of startup.
[B]Figure7[/B]
[IMG]http://www.hyper-v-mart.com/HowTo/Images/CreatingCentOSVM/Install_CentOS5_VM_Step_by_Step8.gif[/IMG]
You can select one of them manually each time reboot. But it's annoying.. To solve it, you could modify Grub configuration file, [B]/boot/grub/grub.conf[/B], changing the default to the proper one. [CODE]default=0
[/CODE] Now everghings are OK. You can reboot the server now. During reboot there would be a new network interface named [B]seth0[/B]. It's the new recognized synthetic network adapter. You can configure it and remove the emulated one.
[/LEFT]