My Profile Photo


Using liberty-minded opensource tools, and using them well

Vagrant for Libvirt

I finally decided to get vagrant working because I didn't want to go through another install process of a CentOS box. That graphical installer is fine once in a while, but having to spin up two in a row tonight was just not something that I wanted to do.

Install Vagrant

# rpm -Uvh vagrant_1.8.7_x86_64.rpm

Install vagrant-libvirt plugin

# yum install -y \
    libxslt-devel \
    libxml2-devel \
    ruby-devel \
    libguestfs-tools-c \
    gcc \
    libvirt \

# usermod -aG libvirt root

logout and login

# vagrant plugin install vagrant-libvirt

Spin up VM

# vagrant init centos/7
# vagrant up --provider libvirt

Sign into VM

Change root password

# vagrant ssh
(localhost) $ sudo su -
(localhost) # passwd


Adding ssh keys

Join virtual network :private_network,
        :libvirt__network_name => "isolab"

Change interface in the management subnet ( at /etc/sysconfig/network-scripts/ifcfg-eth<X> from BOOTPROTO="dhcp" to BOOTPROTO="none". And restart networking with systemctl restart network.

define another box by name

config.vm.define "foobar" do |foobar|