Set Up Debian 10 KVM Server
This tutorial will show you how to set your Debian 9 server up as a KVM host, rather than for setting up KVM on Ubuntu 16.04.
- libvirtd (libvirt) 5.0.0
- QEMU emulator version 3.1.0 (Debian 1:3.1+dfsg-8+deb10u5)
Run the command below to check if system supports KVM. You should see a number greater than 0.
egrep -c '(svm|vmx)' /proc/cpuinfo
Install most of the necessary packages.
sudo apt-get install \ --no-install-recommends \ qemu-kvm qemu-utils libvirt-clients libvirt-daemon-system
Because I am likely to run a bridge from the host, I also make sure to install the bridge-utils package
sudo apt-get install bridge-utils -y
We now wish to install the virtinst package so that we can install guests with the virtinstall command.
Unfortunately, this comes with the recommendation of the virt-viewer package which would require a lot of the GUI based packages. Thus, depending on whether you are runnning a headless or a Desktop KVM host, pick one of the following two options:
Headless KVM Hosts:
sudo apt-get install --no-install-recommends virtinst -y # Now install its recommendations, except virt-viewer sudo apt-get install \ libosinfo-l10n python-gi-cairo python-setuptools python-cryptography \ python-idna python-openssl python-socks python-ntlm \ python-cryptography python-idna python-ipaddress python-openssl -y
Desktop KVM Hosts: If you'r KVM host already has the GUI, then you probably want to just go ahead and install all the recommendations, which will include virt-viewer.
sudo apt-get install virtinst -y
Add User to Libvirt
Add your user to the libvirtd group so that you can run management commands without sudo.
sudo adduser $USER libvirt
Export Qemu Path
Without this, you will always end up having to run your virsh commands with
sudo in order to see/manage your guests.
echo 'export LIBVIRT_DEFAULT_URI=qemu:///system' >> $HOME/.bashrc
Check that everything is fine by running:
sudo virsh -c qemu:///system list
You should see the following output:
Id Name State ----------------------------------------------------
Setting Up Default Network
I'm pretty sure Debian 10 wont automatically install, or perhaps not autostart a default network. You may wish to create one.
First published: 8th May 2020