The linux kernel includes a capable hybrid Type I/II Hypervisor referred to as the Kernel Virtualization Modules (KVM) which forms the basis for enterprise-class virtualization solutions such as Red Hat Enterprise Virtualization. While it may lack some of the features of other commercial and non-commercial solutions like VMWare, Hyper-V or Virtualbox, KVM offers support for a plethora of guest operating systems and a wealth of guest management tools that can be leveraged to provide a facile solution for common virtualization needs:
- KVM-based virtualized Windows guests with paravirtualized (virtio) drivers
- Support for UEFI on the guest operating system
- Spice + QXL video support for guest operating systems. Spice allows advanced features like audio and USB device streaming, as well as improved graphical performance.
- Hyper-V Enlightenments for virtualized Windows guests
Environment
- Operating System: Ubuntu 15.10
- Prerequisite Services: <none>
- SELinux: Permissive
Install Prerequisite Packages
user@host:~$ sudo apt-get install qemu-kvm qemu-system libvirt-bin ubuntu-vm-builder bridge-utils virt-manager virt-viewer ovmf spice-client-gtk gir1.2-spice-client-gtk-2.0 gir1.2-spice-client-gtk-3.0 python-spice-client-gtk
Enable KVM Users
Unlike some virtualization solutions, KVM allows multiple users to share management of virtualized guests. The ability to manage virtualized guests is determind by membership in the libvirtd group. The user that installed the prerequisite packages will be added. Additional users may be added with:
user@host:~$ sudo adduser USERNAME libvirtd
Each user must log out and back in before this group membership will take effect.
Obtain Additional Software
Windows media is required to deploy Windows guests. For the purposes of demonstration, Microsoft offers a 90-day trial of Windows 10 Enterprise (sign-in required). To take full advantage of KVM’s paravirtualization features, Windows virtualized guests will need the virtio latest drivers provided by Fedora.
Create a Storage Pool
In this case, a storage pool will refer to a specific location on the disk where we would like KVM to store the virtual disks we will ask it to create:
user@host:~$ sudo mkdir /srv/kvm-pool
user@host:~$ sudo chgrp libvirtd /srv/kvm-pool
user@host:~$ sudo chmod g+ws /srv/kvm-pool
user@host:~$ sudo virsh pool-define-as kvm-pool dir --target /srv/kvm-pool
user@host:~$ sudo virsh pool-autostart kvm-pool
user@host:~$ sudo virsh pool-start kvm-pool
Create a Windows 10 Enterprise Virtual Guest
The KVM suite includes a very capable GUI tool (Virtual Machine Manager) to help you create and interact with your VMs. However, we will use the command-line tool virt-install so we may enable a very specific configuration and features including Spice/QXL, multiple IDE CD/DVD-ROM devices, and Hyper-V Enlightenments:
user@host:~$ virt-install \
--name Windows-10-Enterprise \
--cpu host \
--vcpus 4 \
--memory 4096 \
--os-variant win7 \
--network network=default,model=virtio \
--disk pool=kvm-pool,size=60,bus=virtio,sparse=true,format=qcow2 \
--disk device=cdrom,path=/home/user/Downloads/SW_DVD5_WIN_ENT_10_64BIT_English_MLF_X20-26061.ISO,bus=ide \
--disk device=cdrom,path=/home/user/Downloads/virtio-win-0.1.112.iso,bus=ide \
--graphics spice \
--video qxl \
--channel spicevmc \
--sound ich6 \
--features hyperv_relaxed=on,hyperv_vapic=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=8191
Virt-Install will launch an instance of virt-viewer for your newly created guest. The Windows installer will begin:
Proceed through the Windows 10 Enterprise installation according to your needs until you reach the Where do you want to install Windows? step. As you will notice, Windows cannot see the virtio disk we have defined, because it does not have a driver for it:
Click Load driver and click browse to find the CD drive containing the virtio-win ISO. Expand virtio-win > viostor > w10 > amd64
and click OK. Then click Next. Windows will load the drivers for the virtual disk:
You may now proceed with the remainder of your Windows installation, which is not covered in this guide. After Windows is installed, the guest agent should be installed. Browse to the CD drive containing the virtio-win ISO. Navigate to the guest-agent subfolder and execute qemu-ga-x64.exe:
Additionally, the Virtio drivers should be installed to take advantage of KVM’s paravirtualization features. Open Device Manager and resolve all driver conflicts using the drivers supplied on the CD. In most cases, you may instruct Windows to search the entire CD for the required driver, and it will find the most appropriate one. Devices that will need drivers are as follows:
- Display Adapters > Red Hat QXL controller
- Network Adapters > Red hat VirtIO Ethernet Adapter
- System Devices > Virtio Balloon Driver
- System Devices > Virtio-Serial Driver
You now have a running Windows 10 Enterprise guest with virtio paravirtualized drive, spice/qxl, and Hyper-V Enlightenments support. Don’t forget to search Ubuntu’s menu for the Virtual Machine Manager which you will use to interact with your new virtual guest:
- Share: