Posts Tagged kmv
The following is assuming an updated Fedora 20 system.
Sudo (or Root)
sudo yum -y install libvirt-devel libxslt-devel libxml2-devel sudo yum -y install https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.5_x86_64.rpm
From our favourite user (see the ‘Notes’ section about User & Space):
vagrant plugin install vagrant-mutate # Optional, only for migrating boxes vagrant plugin install vagrant-libvirt --plugin-version=0.0.20
To avoid using ‘–provider=libvirt’ option all the time when running vagrant commands, add the following to .bash_profile:
an image a box
Let’s use a Fedora 20 guest for libvirt provider (available here ):
vagrant box add https://vagrantcloud.com/gildub/fedora20
Alternatively, a box can be added via either:
- Convert other providers boxes (virtualbox, etc) using vagrant-mutate 
- Create your own vagrant box 
Init & Vagrantfile
mkdir test1 cd test1
Create a Vagrantfile (or ack your own using ‘vagrant init’ to generate one):
cat > Vagrantfile <<EOF Vagrant.configure("2") do |config| config.vm.define :vm1 do |vm| vm.vm.box = "fedora20" vm.vm.network :private_network, :ip => '192.168.200.40' vm.vm.network :private_network, :ip => '192.168.201.40' end end EOF
User & Space
Any user will do but it’s preferable not to use ‘root’.
Keep in mind that boxes, among other things, are stored in ‘~/.vagrant’. And also ‘/var/lib/libvirt/’ can grow quickly, so keep it provisioned.
Libvirt Plugin Version
Don’t forget to specify the version wen installing vagrant-libvirt plugin otherwise you might end up using an older version with issues.
Private networks are NATed therefore only visible from the host and have internet access accordingly.
Libvirt & SELinux
To avoid using ‘root’ for testing, the following provides full credentials to the specified user. Thanks to purpleidea .
sudo sh -c "cat >> /etc/polkit-1/localauthority/50-local.d/vagrant.pkla <<EOF [Allow $USERNAME libvirt management permissions] Identity=unix-user:$USERNAME Action=org.libvirt.unix.manage ResultAny=yes ResultInactive=yes ResultActive=yes EOF"
Fedora 20 Guests
There is an issue with Fedora 20 guests during the network setup. A fix is available here  and should make it to the next release.