Installing Vagrant on CentOS 7

Vagrant is virtual machine configuration and provisioning utility – uses VirtualBox, VMWare, KVM, etc for virualization and Puppet, Chef, Ansible, or shell scripts for provisioning.

Step 0 – Pre-requisites for Vagrant

The setup just requires VirtualBox to be installed – as Vagrant runs on top of a virtualization software. Here is a previous post – “Install VirtualBox 5.1 for CentOS 7/RHEL 7“. I am also listing the steps/commands here:
# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
# yum update -y
# yum -y install epel-release
# yum -y install gcc make patch  dkms qt libgomp
# yum -y install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel
# yum -y install VirtualBox-5.1

Step 1 – Install Vagrant

You can download the Vagrant as per your platform – for this post we’ll be downloading it for CentOS 7. The latest available version is 1.8.6.
# wget https://releases.hashicorp.com/vagrant/1.8.6/vagrant_1.8.6_x86_64.rpm

Once downloaded, install the Vagrant using yum localinstall – like yum install it is good for installing locally available/downloaded packages, and it’ll take care of dependencies i.e. download and install them as needed:
# yum -y localinstall vagrant_1.8.6_x86_64.rpm
Here is the screen-shot of steps I performed:
install vagrant

Step 2 – Verification

If the installation is OK. You can simply execute ‘vagrant‘ or ‘vagrant up‘ – it won’t work without vagrant init executed before it. For more read – ‘The story behind vagrant up‘.
dpy_6.2
A minimal example:
# vagrant init hashicorp/precise64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
vagrant init
# vagrant up
Running it first time will look for the precise64 Vagrant box (will not find it, obviously), and starts adding (downloading) it. Once box is added, it’ll start the provisioning:
vagrant up

Leave a Reply

Your email address will not be published. Required fields are marked *