KVM Create Windows 2012 Server image on Ubuntu 14.04.3

Posted on Thursday, December 31, 2015



I recently had a need to create a KVM image of Windows 2012 server.  I thought I would take the time to show how to do it here.

I am going to show how to do it via Ubuntu 14.04.3 Desktop that itself running as a VM on a VMware Workstation 10.




VMware Workstation 10


You can skip this if you don't plan on creating an Ubuntu desktop image on VMWare Workstation.



I am not going to go over in detail how to set up an Ubuntu image that can run KVM from within Workstation but I want to cover the big gotchas.

You do need to have processor that supports virtualization.


Hard drive





Select LSI logical SAS




For the hard drive I allocated all disk space now and stored it as a single disk hoping that would help a little.  (You don't have to do this)




Customize the hardware.





Select Processors and checkbox Virtualize Intel VT-x/EPT or AMD-V/RVI


Let it build the Ubuntu VM out.  J






Confirm you can install KVM


Before you start make sure Ubuntu has Access to VT-x tech on your chip.

I found this good post on how to check it https://help.ubuntu.com/community/KVM/Installation  [2]

Open up a terminal and run this command.


  > egrep -c '(vmx|svm)' /proc/cpuinfo




Must be greater than 0 and your probably good to go.









Install KVM


I ran this from a fresh install of Ubuntu 14.04.3 Desktop

Update and upgrade


  > sudo apt-get update
  > sudo apt-get upgrade


Run the following command to install the KVM and associated tools


  > sudo apt-get install -y qemu-kvm qemu-system libvirt-bin ubuntu-vm-builder bridge-utils kvm virtinst virt-manager


I always like to reboot my machine after installing all the tools I need.



 
   > sudo reboot now
 

Verify installation

 
   > virsh -c qemu:///system list
 

I got an error at this point




 
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
 


During one installation I got this error… I tried to figure out why and found a few sites.





Since I was using a fresh install of Ubuntu 14.04.3 I just did a fresh install and tried this procedure.


Update and upgrade


  > sudo apt-get update
  > sudo apt-get upgrade


Run the following command to install the KVM and associated tools


  > sudo apt-get install -y qemu-kvm qemu-system libvirt-bin ubuntu-vm-builder bridge-utils kvm virtinst virt-manager




Log out, then Log back in



Verify installation

 
   > virsh -c qemu:///system list
 


That is the response we want.

Now reboot!

 
   > sudo reboot now
 




After reboot verify again. Verify installation

 
   > virsh -c qemu:///system list
 








Download Virtio ISO


You need to download some Windows Drivers that will are required for windows to run on KVM.

Go here



Download this iso.








Grab a Windows 2012 ISO trial version


If you have your own Dev ISO for windows 2012 this should work.  But for folks like me just doing a test you can download a trial version at https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2012-r2  [6]




You need to sign in to your MS account (or make one if you do not have one)




Select ISO and click Register to Continue.





Fill out your information and click continue.







Fill out your info and  Click Continue






Download the ISO.


It’s over 4GiB so it may take a while to download J

I moved the Virt ISO and Win ISO to the desktop.









Start Virtual Machine Manager


Search for Virtual and start up Virtual Machine Manager.










Click Create new machine.




Give it a name and click Forward.






Click Browse







Click Browse Local







Find your windows ISO, in my case I put it on the Desktop.  Select it and click Open.







Click Forward








Set the memory and CPU #.  I think 2GiB is a minimum.  Click Forward.







Set the Disk Size.  I am setting it to 15GiB which is pretty small for Windows.  I am doing this because I am going to move this virtual machine around.  I am not going to install any updates or any software it's going to be a base VM.

Click forward.









Checkbox Customize Configuration before Install and click Forward.








Select NIC and choose virtio from the pull down.








Click Apply.








Select Disk,  From the advanced option select Virtio for Disk bus and click apply.






Click Add Hardware.








Select Storage,  Select  managed or other existing storage. 
For Device type select IDE CDROM.






Click Browse.






Click Browse Local







Select Desktop and select Virtio-win iso and click Open.








Click Finish.







Click Begin Installation







It starts to create the machine.







Make the VM window bigger so you can see that it is loading files.







Hey a Windows logo!

Do not forget ctrl+alt will get you out of the VM window.





Click Next







Click Install now







Select the version you want and click Next (I chose Standard Evaluation with a GUI)







Accept the License and click Next.






Select Custom Install







Load Drivers


Now comes the fun part… Loading drivers from the virtio ISO.





Click Load Driver






Click Browse







From the Virtio ISO

Select Ballon à 2k12R2 à amd64 and click Ok.






Click Next.

It should run a scan of the driver now.







Click Load Driver again






Click Browse






From the Virtio ISO

Select NetKVM à 2k12R2 à amd64 and click Ok.






Click Next.

It should run a scan of the driver now.






Click Load Driver again





Click Browse






From the Virtio ISO
Select viorng à 2k12R2 à amd64 and click Ok.






Uncheck Hide drivers, select Driver

Click Next.

It should run a scan of the driver now.







Click Load Driver again






Click Browse






From the Virtio ISO
Select vioscsi à 2k12R2 à amd64 and click Ok.






Uncheck Hide drivers, select Driver
Click Next.
It should run a scan of the driver now.






Click Load Driver again






Click Browse





From the Virtio ISO
Select vioserial à 2k12R2 à amd64 and click Ok.






Uncheck Hide drivers, select Driver
Click Next.
It should run a scan of the driver now.







Click Load Driver again







Click Browse






From the Virtio ISO
Select viostor à 2k12R2 à amd64 and click Ok.






Uncheck Hide drivers, select Driver
Click Next.
It should run a scan of the driver now.









Now you can see the drive!

Select it and click Next.







Success!  It is starting!








Set your Administrator password and click finish.










From the menubar select Send Key -> Ctrl+Alt+Delete






Put in your password and log in.







Success!  It is running!




In case you want to move it...


In case you want to copy the raw image here is a little bit of help.





From  the pull down select Shut Down



Open a terminal and go to

/var/lib/libvirt/images




  > cd /var/lib/libvirt/images
  > sudo ls -alh






There is my raw image!

Just copy it and move it.


If you are in a situation like me and uploading a 15GiB file may be problematic… Split it up using the split command.  … Of course first you should gzip it!

(the -k will keep the original in place)


  > sudo gzip -k win-2012-eval.img


Compressed it is about

4.2 GiB







  > mkdir  ~/split
  > sudo mv win-2012-eval.img.gz ~/split
  > cd ~/split
  > sudo chown patman:patman win-2012-eval.img.gz
  > split -b 250M win-2012-eval.img.gz


Then rsync them somewhere….

And to put them back together run the following. And gunzip it.


  > cat x* > win-2012-eval.img.gz
  > gunzip win-2012-eval.img.gz







References


[1]        Nested KVM VM inside a VMware Workstation 8 VM – how to
                Accessed 12/2015
[2]        Pre-installation checklist https://help.ubuntu.com/community/KVM/Installation
                Accessed 12/2015
[3]        LibVirt failed to connect to Hypervisor
[4]        B.2.2. Failed to connect socket ... : Permission denied
                Accessed 12/2015
[5]        Window virtio iso
                Accessed 12/2015
[6]        Windows 2012 r2 server
                Accessed 12/2015


1 comment:

  1. Nice article and explanation Keep continuing to write an article like this you may also check my website Crack Softwares Download We established Allywebsite in order to Create Long-Term Relationships with Our Community & Inspire Happiness and Positivity we been around since 2015 helping our people get more knowledge in building website so welcome aboard the ship.

    cyberghost-vpn-crack

    mailbird-pro-crack

    vmware-workstation-pro-crack

    ReplyDelete