Install Windows in KVM (Ubuntu 18.04)

Updated

Is it possible to run Windows in KVM? I'll show you a step-by-step process on how to configure it under Ubuntu 18.04!

how to run windows in kvm

Intro

Windows in KVM is one of the best hypervisors that built right into Linux.

Virtualization is one of the most amazing tools used by many to test drive any operating system they wish to install.

Virtualbox, VMware, and even Microsoft's Hyper-V (Windows) are a great selection of software for anyone to start using a virtual machine.

One of the most popular hypervisors in Linux that is natively supported out of the box is KVM (Kernel-based Virtual Machine).

I previously used this virtual machine from my video on demonstrating how to install Arch Linux with LVM.

KVM can manage an enormous network of virtual labs running Linux without a sweat, but what about Windows?

Getting the perfect setup

After spending a fair amount of time searching for a well-written guide in order to proceed on this task, I decided to only focus on running a new single Windows instance.

windows in 3d


My previous goal used to be attempting to run macOS in order to see how well it would perform, but I realized it takes more work than I preferred to put in, which was something I wouldn't enjoy.

I had to copy and paste various commands to add each driver code, which led me to abandon the effort.

After seeing how simple the steps to install Windows would be, I rolled with it instead.

Picking Windows 7 was an automatic choice since 8 and 10 are bloated by default, and it would be a waste of time trying to optimize the OS.

Applications that are installed automatically such as Candy Crush are difficult to remove on Windows.

Windows 8 is less of a burden, but I found more support online for 7 so picked it instead.

Nonetheless, it detected Windows 7 and ran flawlessly after applying the recommended patches.

What's great about running KVM

After getting the Windows OS driver optimized under QEMU for it to render properly, it felt like brand new.

Driver settings such as networking, file system storage, and sound worked out of the box in the Windows guest.

The Windows guest was plug and play because of the virtIO drivers offered by Red Hat.

Usually, I would have to fiddle with it in order for the Windows guest to work, but the virtIO drivers made the performance all fine and dandy.

For the driver performance, the Windows guest felt more responsive than before on VirtualBox, and it seemed like a setup I might prefer over time.

If you have a Linux PC that's a bit slow in virtualization, then KVM is your best bet when trying out Windows.

Since it's a type-1 hypervisor, it has direct access to the hardware, which gives it more horsepower for it to use up.

Without further ado, I'll demonstrate how easy it is to begin installing Windows on it.

I'll be using Ubuntu 18.04.

Resources

Commands

Install the KVM and QEMU network drivers

sudo apt install qemu qemu-kvm libvirt-bin bridge-utils virt-manager build-essential 

find your user

whoami

Disable password requirement with the user when launching virt-manager

sudo gpasswd -a (your_username) kvm

Enable the network and reboot the computer

sudo systemctl enable libvirtd virtlogd
reboot

Conclusion

Hopefully, this should get you up to speed and start exploring what KVM and QEMU on Linux have to offer.

Once all of the performance optimizations are applied, you should have a performant virtual machine with each driver for the guest well-established!

It does take more time for it to add each driver code as compared to VirtualBox, but KVM's features might convince you otherwise.

If you would like to continue where I gave up, try installing macOS under Linux and let me know how it goes.