Set Up Debian 9 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.
Version Info
- libvirtd (libvirt) 3.0.0
- QEMU emulator version 2.8.1(Debian 1:2.8+dfsg-6+deb9u2)
Steps
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 \
qemu-kvm bridge-utils libvirt-daemon \
libvirt-daemon-system
Virtinst Package
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
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 9 wont automatically install, or perhaps not autostart a default network. You may wish to create one.
First published: 16th August 2018