Install Vagrant + libvirt on Ubuntu 16.04

Vagrant could be installed using the Ubuntu package manager: apt-get install vagrant It's strongly recommended, however, to download the latest version from their site and install it manually. Choose 32 or 64 bit *.deb, download, and install with the following command:

sudo dpkg -i vagrant_*.deb

Vagrant + libvirt

Vagrant supports virtualbox, VMware and AWS out of the box and is easily extended to support more like libvirt or LXC on Ubuntu.

For use with libvirt, see the official plugin page on GitHub for detailed instructions.

I installed the following prerequisites prior to installing the libvirt plugin:

sudo apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev

Once the dependencies were installed I setup the libvirt plugin using the following command:

vagrant plugin install vagrant-libvirt

Using Vagrant

A sample Vagrantfile input is shown below.

    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    Vagrant.configure("2") do |config| = "debian/jessie64"
      config.vm.provider :libvirt do |libvirt|
        libvirt.storage_pool_name = "VagrantPool"

Finally, launch vagrant with the following:

vagrant init debian/jessie64; vagrant up --provider libvirt

Extending Available Boxes with Mutate

vagrant-mutate converts vagrant boxes built for other virtualization systems to libvirt.

First, we need to setup our environment with the required dependencies:

apt-get install qemu-utils libvirt-dev ruby-dev

vagrant-mutate is installed as a plugin.

vagrant plugin install vagrant-mutate

Finally, convert boxes with the following command:

vagrant mutate libvirt