This is part three of Building a Networking Virtual Lab. Vagrant can be used to build a virtual lab on top of KVM/Libvirt.
Step 1 Vagrant CentOS packages to install
Install the latest Vagrant rpm from https://releases.hashicorp.com/vagrant/.
yum install -y https://releases.hashicorp.com/vagrant/2.1.2/vagrant_2.1.2_x86_64.rpm
Install required packages for Vagrant.
yum install -y rubygem-nokogiri gcc ruby-devel zlib-devel libvirt-devel
Check Vagrant is installed.
Step 2 Install Vagrant plugins
Install plugins for Vagrant.
vagrant plugin install vagrant-libvirt
vagrant plugin install vagrant-mutate
Step 3 Test Vagrant is working
Add a Vagrant box for testing.
vagrant box add centos/7 --provider=libvirt
Make a directory for testing Vagrant.
Create new Vagrant file.
vagrant init centos/7
Bring the VM up
Check status is running.
ssh to test the Vagrant image is working.
Destroy the Vagrant image after you have confirmed Vagrant is working.
Remove the test directory.
rm -rf test
Step 4 Add other boxes to your Lab
You can add any image from the publicly Vagrant cloud to your lab. you can find them at the link below.
If you can't find an image on the Vagrant cloud you can also make your own images from VMs that you have created.
You should now have Vagrant running on KVM/Libvirt.