Install Linux VM on Hyper-V 2012 R2

Quick guide how to Install Linux VM on Hyper-V 2012 R2

Some time ago Microsoft “kindly” allow their customers to run Linux workloads on Hyper-V. There are several Linux distribution supported on Hyper-V 2012 R2:

  • CentOs 5 ,6 and 7
  • Ubuntu 12.X and 14.X
  • Suse Linux Enterprise server from 9, 10, 11, 12
  • Redhat 3, 4, 5, 6, and 7
  • Oracle Linux 5, 6, 7
  • Debian 7

To get support on Hyper-V for latest Linux releases you must create VM with Generation 2 and disable secure boot in virtual machine

Uncheck Enable secure boot

Uncheck Enable secure boot

Source: http://vmwaremine.com/

HYPER_V LAB on Windows 2012R2

HYPER_V LAB

1.   Preparation:

In this Home lab I am going to setup hyperV with below servers and settings, Here I am virtualizing all my environment on VMware workstation 10.

·         5 VM (on VMware workstation 10) + 1 VM (inside hyperV) running windows 2012 R2(evaluation/Trial) copy of windows 2012 R2 can be downloaded from http://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2012-r2

·         5 VMs will have below hardware and IP configuration; all VMs will have 40 gb vHDD

Below VMs and their configuration below.

Host Name

vNetwork

iSCSI

Heartbeat

Memory/Storage

Server Role

AD

10.100.1.10/24

None

None

1GB/40GB

Active Directory

iSCSI_Svr

None

10.100.2.10/24

None

1GB/40GB

iSCSI Target

Hyper_V01

10.100.1.20/24

10.100.2.20/24

10.100.3.20/24

2GB/40GB

Hyper_V Clustering

Hyper_V02

10.100.1.21/24

10.100.2.21/24

10.100.3.21/24

2GB/40GB

 

VM

10.100.1.22/24

None

None

512MB/20GB

Windows 7

 

Next, I’ll create a new Internal Network for our LAN communication:

image001

Internal network should be like screenshot below:

image002

The network must be Host-Only.  Deselect the options Connect a host virtual adapter to this network and Use local DHCP service to distribute IP address to VMs.

2.   Create Windows Templates:

First define specify the directory, in my lab will be: C:\VMtest

image003

Now we’ll start to create a template for windows 2012R2. I downloaded the iso file of windows 2012R2 already and ready to use it.

image004

 

image005

image006

image007

image008

image009

image010

image011

image012

image013

Next, you can power-on this VM, and follow step by step on the screen to install windows 2012R2, in this case I assumed you install successfully windows 2012R2.

image014

image015

image016

image017

After done install OS, then install VMware Tool and reboot the VM.

Since from now we only need to sysprep the VM and turn it into Template.

image018

Perform a sysprep and shutdown the VM.

image019

The next step we will do a linked clone and start the clone, the VM get it’s new Identifier, new NetBIOS name,….. And we’ll not have any trouble with dealing with double SIDs.

Now it’s time to create template, to make this template you need to check in the VM properties the “Enable Template Mode”

image020

The template now is secured with special protection, you can’t delete the VM by go to the menu VM>Manage>Delete from disk…

image021

To clone new link VM, you must to take snapshot template before go further:

image022

image023

3.   Creating of Domain Controller VM

This VM will be not only our domain controller, but will also do a DNS resolution for our small virtual lab.

Chose Manage>Clone

image024

image025

image026

image027

Logon to Windows then change computer name to DC:

image028

Assign IP as below:

image029

Then, promo windows to DC:

image030

image031

image032

image033

image034

image035

This page gives you an option of exporting the configuration file. The configuration file will consist of all the settings that you selected during the course wizard

image036

image037

Once Installation is done, then you close the wizard, you cannot type dcpromo as traditional way. You will now notice a yellow Exclamation Mark, just simple click on this icon

image038

image039

Here, we will chose Add a new forest

Specify the name of the new forest, in this lab should be: hypervlab.local

image040

Forest and Domain Functional Level:

image041

image042

image043

image044

image045

image046

After done promoted to DC, then it will install DNS by default, configure reverse lookup zone on it with 10.100.1.

image047

Done from DC side. Next we’ll move to clone 2 Hyperv01 and Hyperv02 VMs then joint this 2 VMs to domain hypervlab.local.

4.   Clone VMs Hyperv01:

image048

image049

image050

Join Hyperv01 vm to domain hypervlab.local

image051

5.   Clone VMs Hyperv02, then join to domain. You should do the same steps on #4

image052

6.   Prepare Share Storage

Because this simulate I’m run on workstation PC with lack of resource then I’ve dedicated on DC machine VM to simulate Share Storage.

Before go further we’ll do some modify on DC VM:

      Give DC VM a second hard disk of 100GB, put it on HDD storage and add 1 more Network adaptor for iSCSI service and assign to VMnet11

image053

image054

      Then initialize it in windows. That will become E: drive on the DC.

image055

image056

Add on information:

      Windows Server 2012 Microsoft added a lot of new storage features and included a iSCSI Target Server. With the new Storage Pooling / Storage Spaces features this allows me to use a Windows Server as a great storage replacement.

      This offers features like:

      Thin provisioning

      Data Deduplication

      Disk aggregation

      Storage Spaces

      and a lot more

Overview

      We will aggregate physical disks to a Storage Pool

      On this Storage Pool we will create a Virtual Disk. Here we have to option to use Data Deduplication, Thin provisioning, Reliability options (Simple, Mirror, Parity), etc.

      On the Virtual Disk we will create a NTFS volume

      On this Volume we will create iSCSI Virtual Disks (LUNs)

image057

      Next we’ll install Microsoft iSCSI target on DC vm.

 

image058

image059

Configure and assigned IP address on iSCSI NIC as below:

image060

Right click on DC Server Manager>iSCSI Target settings

image061

Chose network for iSCSI: 10.100.2.10/24 as screen below:

image062

7.   Chose Server Manager>File and Storage Services>iSCSI then click on “to create on iSCSI virtual disk, start the New iSCSI Virtual Disk Wizard”

image063

image064

image065

image066

image067

Specify the iSCSI initiators (Access Server) which can access the iSCSI Virtual Disk. If this are windows 8 or Windows Server 8 machine you can do a directory search.

image068

Adding 02 VM: hyperv01.hypervlab.local and hyperv02.hypervlab.local

image069

You can enable Authentication if you need:

image070

image071

image072

8.   Same way on #7 to create another disk with below configuration:

File name and location

E:\Quorum.vhd

Size of virtual disk (MB):

1000

Virtual disk Description

This is Quorum disk

image073

image074

Here our iSCSI Target Server is ready and working now need to configure iSCSI initiators.

9.   Configuring Initiator and Shared Disks on VM Hyperv01

On VM Hyperv01 we add 2 more NIC as screen below:

image075

Assign IP address on VM Hyperv01 as below:

image076

Chose Server Manager>Local Server>Tool>iSCSI Initiator

image077

image078

Type IP iSCSI target then click Quick Connect

image079

It has connected to target via 3620 port, then you will see Target is in discovered Targets list, and status is inactive then click connect

image080

Status change to connected

image081

Go to Server Manager>File and Storage Services>Volume>Disks bring them online and Initialized as well.

image082

image083

Create new volume and assign P:\ letter on volume size 80GB and Q:\ letter on volume size 1GB

image084

image085

Once configuration done check in computer which hard disk are showing, they show look like below:

image086

10.        Configuring Initiator and Shared Disks on VM Hyperv02

Follow the same steps from #9 on Hyperv01 for configuration iSCSI initiator.

image087

image088

image089

11.       Installing and configuring HyperV on Vm Hyperv01 (Same configurations will be done on VM Hyperv02)

Open Server Manager>Manage>Add Roles and Features Wizard

image090

Add Hyper-V roles

image091

You might encounter error below:

image092

Follow steps below to fix it:

Now right click on Virtual Machine and Power -> Power off the VM.

image093

image094

Now open the file location for this Virtual Machine and open the file extension (*.vmx) and open it with Notepad.

image095

In the last line we will add this code and save it:

hypervisor.cpuid.v0 = “FALSE”
mce.enable = “TRUE”
vhu.enable = “TRUE”

image096

After that edit the setting on VM from VMworkStation and select Processors and check to 2 option below:

image097

 

Now the configuration is done and ready to install Hyper-V role.

image098

Here I am using vNetwork, VMs will use vNetwork NIC for their network traffic

image099

Let it default

image100

image101

image102

image103

After reboot post installation done you are ready to connecting another server HyperV and creating VM

Note: Add role HyperV on server Hyperv02.hypervlab.local as well with the same settings.

 

12.       Connecting to another HyperV Server:

Open Hyper-V Manager from Administrative Tools:

image104

image105

image106

image107

13.       Installing Microsoft Failover Clustering:

Now you have to installing failover clustering feature on both Hyperv01 anh Hyperv02 VMs.

Open Server Manager>Add Roles and Features

image108

image109

14.       Validating failover cluster before creating:

Open Failover cluster manager from administrative tools.

image110

Click on Validate Configuration..

image111

Add Server names hyperv01 and Hyperv02 one by one and press add. You will see the added list of servers in the selected servers, click next

image112

image113

image114

image115

image116

15.       Creating a failover cluster:

On the next screen enter the name for your cluster “HyperVcluster” and keep selected only pubic network, deselect others and give IP address image11710.100.1.100  (This is the cluster hostname clients are going to access), keep clicking next till finish.

image118

image119

image120

image121

image122

16.       Creating new virtual machine

Creating new first virtual machine on Hyperv01.hypervlab.local:

image123

Enter the name for new VM “VMtestlab” and store it on P:\VM (Shared clustered disk)

image124

image125

image126

Keep defaults. Memory – 512 MB

image127

Select vNetwork – virtual network from dropdown box, all the VM’s network traffic will pass through vNetwork (Public network – 10.100.1.0/24).

 

image128

I will adding ISO file later on

image129

image130

Now you can see one VM on hyperv01

Power on VMTEST machine

image131

image132

IP Address VMTESTLAB is 10.100.1.50/24

image133

17.       Configuring and testing high availability of VM:

Before configuring Failover clustering, shutdown VM.

image134

Open failover cluster Manager>Right click roles>Configure Role…

image135

Select virtual Machine from the list and click next. 

image136

Select VM to make it highly available.

image137

image138

image139

Right click VM and start it, once it is up we will test failover

image140

Once VM is fully up and run then open cmd prompt on AD and type below command

Ping 10.100.1.50 –t

image141

Right click VMTESTLAB> Move> Live Migrate> Select Node Hyperv02 – live migrate to node hyperv02

image142

There are only 2 pings dropped while migration and littlie stretched latency, It means clients accessing VM didn’t even know they are accessing VM from hyperv02. Check it from HyperV manager as well.

image143

Now VM will move from hyperv01 to hyperv02

image144

Now try simulating Hardware down, Hard reboot Hyperv02, VM should be failover to host Hyperv01 with little downtime. (VM will restart on HyperV01 host).

Done