How-to install CentOS/Red Hat Enterprise Linux on a Hyper-V VM

By , November 24, 2010 7:21 pm

This guide will take you through the process of creating a Linux virtual machine on a Hyper-V host. It is assumed that you have Hyper-V setup already, and you know how to create VMs.

This guide will use a CentOS 5.5 netinstall, however the principle is the same for Red Hat Enterprise Linux 5.5, and any other form of install.

Step1

Create a new VM in Hyper-V. Make sure you give it enough disk space (I used 20Gb for this guide) and make sure you give it a legacy network adapter. This is because the ‘normal’ network adapter requires the Linux Integration Services to be installed before it’ll be recognised.

Step2

Download an ISO of CentOS from the CentOS website (http://www.centos.org/modules/tinycontent/index.php?id=15). For this guide I used the Net Install ISO.

Once downloaded load it into the VM by whichever method you like, and start the VM.

Step3

When prompted, press ‘Enter’ to boot in graphical mode. You’ll then be presented with a language select screen:

clip_image001

Select your language and progress to the next step, where you can choose keyboard layout:

clip_image001[5]

In the next step you can choose your installation method. For this I’m using http, but if you have the installation sources download already then make your choice accordingly.

clip_image002

In the next screen you can configure your network settings:

clip_image003

If you chose HTTP before, you’ll be prompted with the following screen to enter the url and path to the installation media. You’ll want to change these according to your version and architecture:

clip_image004

Press OK, and you’ll get the following screen.

clip_image005

This should complete successfully and give you this nice graphical installer:

clip_image006

You can accept most of the default options for disk layout and network configuration in the following screens. Obviously, if you want to change then you can.

Select your time zone by clicking the yellow dots or choosing from the drop down:

clip_image007

Choose a root password:

clip_image008

Here you can select the packages you want to automatically install with your system. I’ve accepted the defaults here — you can always add/remove them later using the package manager.

clip_image009

Press next, then next again and the install should start, leaving you with this screen for quite some time:

clip_image010

Once that’s finished, you can reboot (Make sure you take the CD out too):

clip_image011

Step4

Once it has rebooted, it’ll load the first run wizard to setup a number of system settings:

clip_image012

Setup any firewall rules you want. I disabled mine since it’s on an internal network — You may want another configuration:

clip_image013

Configure SELinux, if you want it. I’ve disabled it since I don’t need it:

clip_image014

Configure Date and Time, an optionally setup NTP. Again I’ve left this as default:

clip_image015

Create your first user for ‘regular’ use of the system:

clip_image016

Finally, if you have any additional CDs you can add them now:

clip_image017

I didn’t, so just pressed finish. My system had to reboot. Once finished you should be prompted with a login screen for your new system:

clip_image018

Step 5 – Host Integration Tools

You may want to install the Linux Integration Services so that your VM get’s the various benefits of the Host Integration Tools that you get on Windows VMs.

You can download them here.

Run the file, and it’ll extract an ISO. Inside that iso is a docs folder with a PDF in containing instructions and a whole load of other information. I’d suggest you read the instructions there since they contain more detail than I’m going to go into here.

You will need the ‘Development Tools’ package(s) installed before this will work, since the process involves compiling code from source.

You can install the tools easily enough by starting the package manager and selecting ‘Development Tools’ from the ‘Development’ section

clip_image019

I also selected “Development Libraries” and “X Software Development” just for good measure.

Now “insert” the ISO into your VM. As the root user you’ll then want to mount the CD by issuing the following at shell terminal:

mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom

Copy the contents of the CD to a local folder:

mkdir /opt/linux_ic
cp -r /mnt/cdrom/* /opt/linux_ic/

You can then unmount the cdrom if you like:

umount /mnt/cdrom

As root again you need to compile and install the software:

cd /opt/linux_ic/
make
make install

Reboot your VM, and then you’re done.

Step 6 – Synthetic Mouse Support

To get synthetic mouse support when connecting to your VM using the Hyper-V console, you need to download an extra driver from here: http://www.xen.org/download/satori.html

There are instructions on that page as well — installation is simple though.

“Insert” the iso into your VM and mount the cdrom:

mount /dev/cdrom /mnt/cdrom

Copy the contents of the CD to some local dir:

mkdir /opt/linuxvsc
cp -r /mnt/cdrom /opt/linuxvsc

Install xorg-x11-server-sdk package if it’s not already installed:

yum install xorg-x11-server-sdk

Install the vsc driver:

cd /opt/linuxvsc
./setup.pl inputdriver

Restart X11 (or your whole VM — whichever you prefer) .

And that’s it. You’re done. Sit back, relax and marvel at your copy of CentOS running on a Hyper-V VM.

One Response to “How-to install CentOS/Red Hat Enterprise Linux on a Hyper-V VM”

  1. [...] How-to install CentOS/Red Hat Enterprise Linux on a Hyper-V VM « nickhowell.co.uk How-to install CentOS/Red Hat Enterprise Linux on a Hyper-V VM « nickhowell.co.uk. [...]

Leave a Reply

Panorama Theme by Themocracy