Windows Server 2012 R2 installation in KVM

As pre-requirements for the installation there should be a running libvirt daemon with TLS, as well as a setup LVM disk pool.
I used the ‚virt-install‘ utility to ease the creation of the virtual machine with the following parameters:

Short explanation of the parameters. The first line sets system parameters like the architecture, the name of the VirtualMachine, the amount of memory, CPU type, how many virtual CPUs are available and that the machine is a fully virtualized machine. As for the CPU type one should keep in mind, that I used ‚host‘ since I do not plan to migrate the vm, but to have greater compatibility there are other flags that can be used (please see the libvirt manual pages).

The next 3 lines setup the Harddisk, the installation medium and the virtio driver disk drive. When creating the diskdrive without the parameter sparse, I had the Error 0x80300024 saying that the OS could not be installed on the disk. But after preallocating the disk space by using sparse=true it worked smoothly.

Line 5 tells QEMU what type of OS and which variant we are installing. As of now there is no Windows Server 2012 variant, so I used the next closes which is Windows Server 2008. The last parameter sets up the network, where I used the default libvirt network with virtio as NIC. Feel free to change the network, but you should keep virtio since it is said that it brings performance.

Last line sets the graphics. For now I decided to stick with VNC, but later on I’d like to change this to SPICE for performance. Since VNS is set to listen on TLS ports with x509 Certificates there is no need to further place those parameters, but for greater security you should set a password or even add SASL2 User Authentication.

Now connect to the VM via VNC and start installing. I yet have not found a VNC-Client under Windows which is able to connect, so I do it via my Linux VM by using virt-viewer.

virt-viewer -c qemu+tls://<HOST>/system <VM NAME>

In the Windows Server 2012 setup the virtio drivers can be loaded when you start the disk partitioning. Make sure to use the Windows 8 amd64 drivers, since there are no dedicated drivers for Windows Server 2012 yet, bur the Windows 8 drivers work just fine. Load all three 1. Virtio SCSI, 2. Virtio Network and the 3. Virtio memory balloon drivers.

After installing is done you should shutdown the VM and remove the CD-Rom drives via