Virtualization and Vagrant for noobs

Brendan O'Connell
3 min readNov 10, 2020

As a new developer, infrastructure is one of the most confusing concepts to me. In the spirit of addressing the most challenging topics head-on, I’ve decided to write my first Flatiron blog post about Vagrant. Vagrant is open-source software written in Ruby that enables users to create portable, lightweight virtual development environments. In order to appreciate Vagrant, we must first understand the fundamentals of virtualization.

What is virtualization?

Virtualization allows individuals or organizations to do more with less by enabling applications to run on fewer servers. Under virtualization, each application and operating system can be deployed in its own virtual machine (VM). By isolating applications into virtual machines, you can optimize pooled computing resources giving each VM no more than the computing power it needs. From a business perspective, VMs enable optimal efficiency of resources and therefore reduce IT-related expenses. But company CFOs aren’t the only ones who appreciate VMs. Developers also benefit from virtualization by leveraging value-add software like Vagrant. We’ll get to this in a moment, but first, let’s review a few types of virtualization:

  1. Desktop virtualization: Allows for multiple instances of user desktops to be created from an underlying server
  2. Application virtualization: Gives access to an application which that isn’t installed on your local computer
  3. Data virtualization: Data management style that grants access to data stored across disparate servers

What’s a hypervisor?

A hypervisor is the software that sits between operating systems or servers and virtual machines. Hypervisors interact directly with the physical hardware resources and partition them across virtual machines.

What’s Vagrant and why should you use it?

In the simplest terms, Vagrant is a tool for working with virtual machines. It’s lightweight composition and flexibility across environments enable developers to program more productively. Here are some concrete examples of why developers love using Vagrant:

  1. Preservation of a developer environment — Suppose you write a piece of software with a given set of tools (Ruby, Python, Node, etc.). Inevitably, as time passes, those tools will update, and your software may no longer be compatible with the latest versions of those tools. Using a virtual machine with Vagrant allows a developer to access an environment where that software will run indefinitely. So five years later, when you go back to look at an old piece of software, you will still be able to run it by using Vagrant
  2. More OS flexibility — Since you can spin up Vagrant to represent any operating system, your underlying OS can be whatever you want.
  3. Active development — It’s common for developer teams to simultaneously work on multiple pieces of an application. Using virtual machines with Vagrant, the developers can each keep their components of the application separate.
  4. Testing — Vagrant is also used by ops teams to test configurations and analyze software. For instance, if you’ve written software on a Mac and you want to test the code on Windows 97, you can do that.
  5. Save yourself time — With Vagrant, no longer will you waste time trying to get old code to work or failing to follow a tutorial that’s written using another developer environment.

Getting started with Vagrant

Vagrant provides an easy-to-use command-line interface. You can start and stop VMs, manage existing VMs, and initiate new VMs all from the CLI. But I won’t reinvent the wheel by walking you through how to use it. There are some great guides that teach you step-by-step how to get a Vagrant instance up and running. I recommend these two:

  1. The Ultimate Guide to Getting Started with Vagrant and Why Every Software Developer Should’ve Been Using it Like Yesterday.
  2. Getting Started with Vagrant

--

--