# Vagrant

## Vagrant with libvirt as default provider

To use use Vagrant with libvirt you need to install the `vagrant-libvirt` plugin. The Vagrant way would be:

```
vagrant plugin install vagrant-libvirt
```

In some linux distributions you find this plugin in their repositories.

Fedora (`vagrant-libvirt` is a dependency of the `vagrant` package.):

```
sudo dnf install vagrant-libvirt
```

ArchLinux (`vagrant-libvirt` is found in [AUR](https://aur.archlinux.org/packages/vagrant-libvirt)):

```
yay -S vagrant-libvirt
```

After this you need to set libvirt as default provider for Vagrant:

```
# Vagrant config
export VAGRANT_DEFAULT_PROVIDER=libvirt
```

## vagrant mutate

If you need any image that is not present for your provider, e.g. libvirt, you can use `vagrant mutate`. To install it the vagrant way use:

```
vagrant plugin install vagrant-mutate
```

After installing you can convert one provider into another one like this:

```
vagrant mutate centos/7 virtualbox
```

Then you'll see two boxes ready:

```
$ vagrant box list
centos/7 (libvirt, 2004.01)
centos/7 (virtualbox, 2004.01)
```

## Links

* [Original article (german)](https://www.admin-magazin.de/News/Tipps/Vagrant-und-Libvirt)
