tutorials and ruby scripts

Read my tutorials

Read my gists


Tutorial: Create a KVM Windows VM

This tutorial is about installing Windows in a KVM VM.

  1. Create folder for ISO and diskimage

    sudo mkdir /windows && chown wlanboy:libvirt-qemu /windows && chmod 775 /windows
  2. Add images

    cd /windows
    wget https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
    qemu-img create -f qcow2 -o preallocation=metadata windowsdisk.qcow2 60G
    cp /external/Windows.iso /windows
  3. Create KVM VM

    virt-install \
    --name=windows10 \
    --memory=8192 \
    --cpu=host \
    --vcpus=2 \
    --features kvm_hidden=on \
    --os-type=windows \
    --os-variant=win10 \
    --rng /dev/urandom \
    --disk path=/windows/windowsdisk.qcow2,format=qcow2,bus=virtio,cache=none \
    --disk path=/windows/Windows.iso,device=cdrom,bus=ide \
    --disk path=/windows/virtio-win.iso,device=cdrom,bus=ide \
    --boot cdrom \
    --network network=default,model=virtio \
    --graphics vnc,listen= \
    --noautoconsole --accelerate
  4. Connectio to VM through VNC

    Install VNC client:

    sudo apt-get install vncviewer

    Run VNC client:

    vncviewer your-ip:1
  5. Install Windows

    Click on “Load Driver” and browse through the second cd-drive for the Windows viostor driver. Remember AMD64 = 64 bits Windows and x86 = 32 bits. Afterwards click through the Windows installer. Select “I don’t have a product key yet” and wait a long time for the Windows installation.