CentOS 7 Minimal Installation on Hyper-V

CentOS Minimal Installation Tutorial

This tutorial will show you how to install CentOS minimal on a Hyper-V virtual machine. We will also focus on getting network connectivity.

Before we begin this tutorial, please head over to centos.org and grab a copy of the latest ISO of CentOS Minimal, link below.

Download Centos

Creating the virtual machine:

CentOS Download

Once you’ve downloaded your ISO, on your server or workstation running Hyper-V, launch the Hyper-V management console.

Hyper-V Management

Within the management console, right click on your server, and select “New” and then “Virtual Machine”

New VM - Hyper-V

Give your new VM a name and instruct Hyper-V on where to store the config files.

Hyper-V Name and Location VM

Select the amount of memory you want your virtual machine to have. In my case, I have chosen to give mine 1024mb or 1gig.

Hyper-V Memory

Pick your network connection (this is your virtual switch) and click “next”

VM Lan

Once you’ve assigned your new VM a network connection, you need to create a virtual hard disk for it. Select “Create Virtual Hard Disk” from the menu, give it a name, select the location you wish to save it in and the size.

Create VHD Hyper-V

Now we must tell Hyper-V where to find the CentOS ISO that we downloaded. Select “Install an operating system from a boot CD/DVD-ROM” pick the “Image File (.iso)” option. Click on “Browse” and locate the ISO. Then click “Next”

Select ISO File

Finally a summary page will be displayed. This will tell you all of the options that you selected for your virtual machine. At this step, please click on “Finish.” Clicking “Finish” will bring you back to the Hyper-V management console.

Hyper-V Summary

In the Hyper-V management console, find your newly created virtual machine, select it and right click. Click on the “Connect” option that appears.

Hyper-V Connect

Go ahead and click on the green power button to fire up your VM.

Hyper-V Connect

Installing CentOS on your Virtual Machine

Your virtual machine will now begin to read the ISO inserted into it’s virtual optical drive. Using the arrows on your keyboard, highlight the “Install CentOS 7” and hit the enter key.

CentOS ISO - Install

Select your language. In my case, I left it as the default of English. Then click continue.

CentOS Pick Language

Select the disk on which you wish to install CentOS. I typically allow CentOS to use the automatic partitioning feature. Then click “Done”

CentOS Disk Install

During the installation, you are asked to set a root password and/or create a user. I have chosen to do both. You may click each icon and assign a password and create a user. CentOS will then set these during it’s installation.

Create User Root Pass

User Pass Created

Allow CentOS to complete it’s installation process. Once this step is complete, the virtual machine will reboot. Once it has rebooted, you will see the following prompt. Here you can login with either your root user or the user you had CentOS create during installation. CentOS is now installed.

CentOSInstalled

 

Gaining Network Access

 

 

CentOS minimal out of the box on Hyper-V will not get an IP Address. You can verify this by logging in and issuing the command “ip addr”

CheckIP

If you get an IP address, you should see it listed under “eth0” – in this case we do not see an IP address. This is because CentOS does not go out and try to grab an IP on boot. In order to change this, you must issue the command, “vi /etc/sysconfig/network-scripts/ifcfg-eth0”CentOS Eth0 Conf

To change this config, hit the “i” key to switch vi into insert mode. Arrow down until you get to the last entry, “ONBOOT”, you must change this from “no” to “yes” – when you’ve changed this, hit the : key and type wq to write the changes and quit vi.

Change_OnBootYes

Restart your network interface by issuing the command “systemctl restart network” – CentOS will hang for a moment and then restart the network adapter.

CentOS Restart Network

Now you can issue the command “ip addr” again and you should see an IP address listed for interface eth0.

CheckIPAgain

You now have a base CentOS Minimal install with network connectivity. This will give you a great base to install Nagios. I will be writing a tutorial shortly on the installation and configuration of Nagios Core on CentOS.

 

Check out some of my other blogs on Hyper-V!

Permanent link to this article: https://achubbard.com/2018/01/31/centos-7-minimal-installation-hyper-v/

1 pings

  1. […] a new virtual machine. If you need help creating a virtual machine, please see my post titled “CentOS 7 Minimal Installation on Hyper-V”or click on the link to take you there. The only difference with this virtual machine will be the […]

Leave a Reply