install vargarnt + libvirt + kvm on debian 11

I want to run vagrant up on Debian. However I don't want to install VirtualBox and use KVM instead. I kept forgetting which packages I need to install so here we go:

sudo apt install --no-install-recommends \
    bridge-utils \
    busybox \
    dnsmasq-base \
    ebtables \
    libguestfs-tools \
    libvirt-clients \
    libvirt-daemon \
    libvirt-daemon-system \
    netcat-openbsd \
    nfs-kernel-server \
    qemu-kvm \
    vagrant \

I also had to add my user to the libvirt group to make it work smoothly:

sudo adduser $USER libvirt

Then all that's left is to start libvirt and maybe also tell systemd to start it on boot:

sudo systemctl start libvirtd.service
sudo systemctl enable libvirtd.service

That's it vagrant up --provider libvirt should work now.

On a side note: On rare occasion virt-manager is a quite handy tool for working with libvirt VMs. It's also in Debian an can be installed with apt.

written by uniq on 2022-12-13