24 Dec 2023 - by 'Maurits van der Schee'
In a previous post I have showed how to install Debian 12 with disk encryption. In this post I will show how to install KVM on it, so that you can start using it as a GNU/Linux hypervisor to run virtual (Windows 10) machines. In this post I will also show how to load a graphical tool to connect to your KVM enabled server.
KVM requires CPU virtualization support (VT-x/AMD-V) to be enabled in the BIOS. You can check if your CPU is supported by installing cpu-checker and running the kvm-ok command.
sudo apt install cpu-checker -y
This should show:
INFO: /dev/kvm exists
KVM acceleration can be used
If it does not then reboot, press F2 to enter the BIOS, enable the support and try again.
Now for the installation of the software
sudo apt-get install libvirt-clients libvirt-daemon-system qemu-kvm bridge-utils dnsmasq
You may also type groups and verify that you are member of the libvirt group.
Before adding yourself log out and in to see if that adds you to the group.
sudo usermod -a -G libvirt maurits
Now set the default "virsh" connection in the global config:
sudo nano /etc/libvirt/libvirt.conf
Uncomment the line:
uri_default = "qemu:///system"
To test that the installation succeeded you can connect to the hypervisor by running:
The output should be:
Id Name State
It is an empty list of virtual machines.
Now on your local computer (not on the server) install the virtual machine manager by running:
sudo apt install virt-manager
Now start virt-manager and create a new connection towards your server. This should use SSH.
NB: You can even run virt-manager on Windows 10 using the Windows Subsystem for Linux (WSL).
When you create a Windows 10 VM, ensure to choose VirtIO technology for disk, video and network as those are really fast. You may need to download the latest driver disk from:
You may need to use that driver disk during the windows installation. Note that you can get a time-limited link for a Windows 10 installation disk from:
Note that you should access that URL from Linux to get to the download page (or fake that using a "User-Agent Switcher"). You should put the install images in the "/var/lib/libvirt/images/" directory on the KVM server (requires "sudo").
By default the KVM network is on 192.168.122.0/24 and it uses NAT and DHCP. If you want to access your Windows host over RDP you may need to set a DHCP reserved address. You can read how to do this on my post "Static IP addresses in a KVM network".
In order to start the Windows VM on RDP connect (failure) you need to add the name of the VM to "/etc/hosts" on the server (requires sudo) and you need to install my wake-domain script. This will either start the VM when connection fails or wake it from "pmsuspended" state. This allows users to turn off the VM or let it suspend (energy settings).
I use the tool MobaXterm to connect to RDP over SSH. You can simply enter the private 192.168.122.x address as the remote RDP machine and then configure the KVM server as SSH jump host. Note that you may have to disable Network Level Authentication (NLA) by going in "System Properties" to the "Remote" tab and uncheck "Allow connections only from computers running Remote Desktop with Network Level Authentication (recommended)".