Building a Networking Virtual Lab part 3: Install Vagrant on CentOS 7

Introduction

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.
vagrant --version

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.
mkdir test
cd test/

Create new Vagrant file.
vagrant init centos/7

Bring the VM up
vagrant up

Check status is running.
vagrant status

ssh to test the Vagrant image is working.
vagrant ssh
exit

Destroy the Vagrant image after you have confirmed Vagrant is working.
vagrant destroy

Remove the test directory.
cd ..
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.
https://app.vagrantup.com/boxes/search

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.

Links

Part1
Part2