3 min to read
An Introduction to Vagrant
Introduction to Vagrant
As we all know,
Virtual Machines(VMs) are very popular among the entire IT world. Reason being: their capability of emulating an entire computing system. Virtual Machines gained popularity because of certain aspects of them which are listed below:
- To try new Operating Systems (Major reason)
- To create virtualized testing environments
- Set up an office quickly (Literally!)
- Build learning environments
All of you must have heard & probably would already have had an experience of working on one of the two undisputed leaders of Virtualization Environments:
If you have ever tried to create virtual machines used for testing through a GUI; be it in the VMware or Virtualbox, you will know that it can be a pain, and it is a very manual process. I have found that there is a tendency to leave testing machines around for a long time without rebuilding them.
Before Vagrant there is a resistance to creating clean environments, because there is an extra labour cost associated with making this happen, it just a very manual process via a GUI. Vagrant can eliminate much of extra labour so lets go take a look at how that works.
What is Vagrant?
Vagrant is a tool for building and distributing development and testing environments. It acts as a type of wrapper around virtualization software, which greatly speeds up many of the tasks associated with setting up, tearing down, and sharing virtual machines.
Development environments managed by Vagrant can run on:
- Local virtualization platforms like VMware/Virtualbox
- In the cloud, via AWS/Openstack
- In Containers such as Docker
Okay so that's enough of introduction to Vagrant. Now we will cover prerequisites and overview of setup that you need to do before you can get going on your own.
As I mentioned earlier in the post, Vagrant acts as wrapper around virtualization software, so for Vagrant to work, you need to have some type of virtualization software setup.
The easiest way is to install VirtualBox, because it is free, supports all major operating systems, and it works great with Vagrant.
- Download Virtualbox binaries from HERE according to your platform.
- Install Virtualbox
Verifying the Installation
- Verify that Vagrant is installed correctly by opening Command Prompt & typing
- Also, If you run the vagrant command without any arguments, you will get the default help output, which displays available command options.
Check the list of available Vagrant boxes
- You can check all the available boxes (OS flavours) from HERE
Running Vagrant Box
$vagrant init hashicorp/precise64 $vagrant up
- After running the above two commands, you will have a fully running virtual machine in VirtualBox running
Ubuntu 12.04 LTS 64-bit.
- You can SSH into this machine with vagrant ssh, and when you are done playing around, you can terminate the virtual machine with vagrant destroy.
- A Vagrant environment can be a single Vagrant virtual machine, or a collection of virtual machines. So, an environment will describe what boxes, or virtual machines to boot, along with all of the associated settings, through a configuration file called a Vagrantfile.
- I will write a separate blog post on Vagrantfiles & working around them to create multiple virtual environments at a time & playing around them.
Do let me know your questions, suggestions or reviews in the comments section below.