Ubuntu 17.10: Install KVM for virtualization

This article will describe installing KVM.

1 Install qemu-kvm and libvirt

Install qemu-kvm package and some packages for virtual machine operation.

$ sudo apt install -y qemu-kvm libvirt0 libvirt-bin virt-manager bridge-utils

Register libvirt-bin to systemd.

$ sudo systemctl enable libvirt-bin

2 Bridge interface

The bridge interface is needed for accessing virtual machine via network from other machine.

$ sudo apt install -y bridge-utils
$ cat <<EOF | sudo tee /etc/network/interfaces
auto lo
iface lo inet loopback
auto br0
iface br0 inet dhcp
      bridge_ports ens3
      bridge_stp off
      bridge_maxwait 0
EOF
$ sudo reboot

3 libvirt group

The user in libvirt group can run libvirt command without sudo.

$ sudo gpasswd libvirt -a <username>
$ sudo reboot