CentOS Hyper-V Windows Compatibility

Installing CentOS on Hyper-V

CentOS is one of the most popular alternatives to the Debian line of products. Inspired by RedHat Enterprise Linux it uses the .rpm extension for its packages like Fedora, RedHat Linux and yum package manager to install, update and remove packages from your system.

Most importantly, unlike Ubuntu, it is mostly server centric with serious efforts on making sure your Internet facing servers are secure, stable and efficient. CentOS is simple, easy to install and quick to get acquainted with. Let’s install CentOS on Microsoft’s virtualization platform Hyper-V

Enabling Hyper-V and Getting Installation Media

Probably the most time consuming step in this tutorial is getting the installation media. CentOS 7 comes in 3 different kind of installers.

  1. Minimal: With only basic utilities at about 1GB in size
  2. DVD: About 4GB in size with GUI, decent installer and many everyday utilities
  3. Everything: Just a massive ball of all the possible package that you might get from official repos (useful for setting up your own CentOS mirrors). About 8GB in size.

We will be using the middle-of-the-road DVD option. You can get your prefered option from here.

To get started with Hyper-V, we first need to make sure that we have Hyper-V enabled on our Windows box. If you are using Windows 7 Ultimate edition (or above), or similarly Windows 10 Pro or Enterprise edition on your desktop you can enable Hyper-V. Needless to say almost all Windows server editions come with Hyper-V functionality, as well.

Go to the Start Menu and search for “Turn Windows features on or off” and a list of Windows features will be shown in a new wizard. Check the box against Hyper-V, and make sure you have both the Hyper-V platform and Hyper-V management tool installed.

Click on OK and wait while Windows gathers necessary files for you. It will ask you to reboot the system and upon rebooting, you can go to the Start Menu and search for “Hyper-V Manager” and it will show you a neat UI.

It will show you the list of physical machines that are being managed by it as well virtual machines that are being run on those physical nodes. Since we are using a single desktop, its name will pop up as a physical server and there are no virtual machines as of yet, so let’s create some.

 Creating the Virtual Machine

The first thing to consider while creating a VM is how much resources you want to dedicate to it, in our case it is going to be 2 cores and 2GB of memory with 127GB of storage in the form of virtual hard drive. You can get away with single core and  25GB of storage. Make a judgement based on the resources available to you.

Now, then let’s create our VM. Select your PC’s name from the left column, to specify to Hyper-V that we will be creating VMs on this particular host. Then from the right column called Actions select the option which says  New → Virtual Machine.

This will open up a New Virtual Machine wizard where you decide upon various settings about the virtual machine.

First option is about specifying name and location where the VM related files would live. We have left the location to its default place inside C: drive and named the VM CentOS before clicking on Next.

Next we specify the VM’s generation, which, as you can see from the description, is about UEFI support. Its safe to pick Generation 1 in most cases, so we will go with that.

Next, we assign memory to the VM, with Dynamic memory allocation enabled. This ensures that at any given time the VM uses only as much memory as it needs with the upper most limit set by us, as shown below:

Network configuration can become a little tedious if you go down the rabbit hole, however, Hyper-V provides a Default Switch which we will use to provide connectivity to our VM, in the next step.

Use the drop down option to select Default Switch. Click Next and we can move on towards Virtual Hard Disk.

We are going to keep the Virtual Hard Disk options to default values. Everything from location to size, just to keep things simple and manageable.

Next is the suboption for selecting the installation media. This will be used to boot the VM the first time you start it, after the installation is done, the virtual hard disk will become bootable and subsequent reboots will use that instead.

Select the option “Install an operating system from a boot CD/DVD-ROM” and then select the “Image file” suboption and browse your file system to locate the CentOS iso that you downloaded earlier.

You can Click on Next to see the summary of your VM, if you are satisfied, click Finish and we can move on to the operating system installation. 

Installing CentOS

Installing the Operating system is pretty easy, especially if you have gotten DVD or Everything variant. The .iso comes with a GUI installer.

Start the VM by right-clicking on it and selecting Start and then right-click again to Connect…

Now you are connected to the VM. Select the Install CentOS option from the boot menu and hit <Enter>.

1.  Installation Language

Select the language you prefer and click on Continue.

2.  Installation Options

Select the Installation Destination option and select the virtual hard disk to install CentOS on top of it.

You can choose to encrypt the disk or manually partition it, but we will leave it at default and click Done once that is done.

Next, you will be back to the previous menu where you can now click on Begin Installation.

3.  Root and User password

While the installation is under progress.

While selecting the Root password is essential, creating another user is purely optional.

Upon reboot you will be greeted with the login prompt where you can login as root or any other user you may have created during installation.

Conclusion

Now that you have a CentOS installation up and running, you can update the local cache with the remote yum repositories and update the installed software.

$sudo yum check-update
$sudo yum update

Let us know if there are any similar topics that you want us to cover.

About the author

Ranvir Singh

Ranvir Singh

I am a tech and science writer with quite a diverse range of interests. A strong believer of the Unix philosophy. Few of the things I am passionate about include system administration, computer hardware and physics.