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:

virt-install --connect qemu:///system --arch=x86_64 -n <VM NAME> -r 4096 --cpu host --vcpus=2 --hvm \
--disk pool=VMs,size=<SIZE>,bus=virtio,cache=none,sparse=false \
-c /media/inst_iso/de_windows_server_2012_r2_x64_dvd_2707952.iso \
--disk path=/media/inst_iso/virtio-win-0.1-65.iso,device=cdrom,perms=ro \
--os-type windows --os-variant win2k8 --network network=default,model=virtio \
--graphics vnc,password=<PASSWORD> --noautoconsole

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

virsh edit <VM NAME>

4 Comment

  1. Hey just wanted to mention, since I found this post helpful when I first setup Server 2012 R2 in a KVM instance that there are updated windows drivers now. You can get them from the Fedora here:

    Just wanted to help out the next person that sees this blog post =)

  2. virtualmarc says:


    if you want to connect to VNC from your Windows PC take a look at TigerVNC.
    If it’s a remote PC you have to define listen= as an option of the graphcis parameter!

  3. Antonio says:

    virtio-win-0.1.96.iso 🙂

  4. sanjay says:

    How to configure Windows cluster in KVM environment

Schreibe einen Kommentar