Virtual Machines, or VMs for short, are fairly popular in the Software industry and among developers. And for good reason — who would mind a disposable OS, within an OS! Right? They are fairly easy to use, allow you to run multiple OS’s on a single host OS, completely independent of each other (okay, there are some limitations in performance compared to bare metal performance, but let’s leave that aside for now).
One of the bigger problems with using VMs that I felt prevented them from being as convenient as, say, an actual local environment, was the initial setup. Setting up a VM and getting it ready to use for development inside a VM manager like VirtualBox wasn’t exactly a click-click-done process. You needed to:
Yeah, that takes quite some time. But when you’re someone who wants a consistent development environment without having to install an infinite amount of software, from programming language runtimes to database servers on your local machine, VMs are definitely a very attractive solution. If you’re someone like this, and you’ve been unaware, allow me to introduce you to the extreme convenience that is Vagrant.
Using Vagrant requires you to install a single installable package, which you can get from here for your OS. The installation process is trivial really, but do remember to ensure that virtualization support is enabled in your BIOS settings. Vagrant also requires a VM “provider”, such as VirtualBox or VMWare Fusion to be installed on your system. We’ll be using the free and open-source VirtualBox.
First and foremost, what is Vagrant? The official documentation briefly calls it “ the command line utility for managing the lifecycle of virtual machines”. That’s all you really need to know. Let’s work with it to gain an idea of what it can do for you.
A Vagrant box, which is nothing but a Vagrant-controlled VM, is brought up based on a configuration file, which is called, by convention, a **Vagrantfile **(Yes, like a Dockerfile!). A Vagrantfile has 5 main config blocks:
#software-development #coding #software-engineering #virtualization #devops