Installing Vagrant and Spinning Up Your First VM: A Comprehensive Guide


Hello, and welcome to the DevOps Lounge! In today’s article, we’ll walk through the essentials of installing Vagrant and how to use it for spinning up a virtual machine (VM) in no time. Whether you’re a seasoned developer or just starting, learning how to efficiently manage and configure your development environments is invaluable.

What is Vagrant?

Vagrant is an open-source software product for building and maintaining portable virtual software development environments. The core idea behind installing Vagrant is to create an environment that is configurable, reproducible, and portable. This makes sharing and setting up development environments among multiple developers an absolute breeze.


Before we start installing Vagrant, make sure you have the following installed:

  1. VirtualBox: Vagrant uses VirtualBox as a provider to manage the virtualization. You can download it from VirtualBox’s website.
  2. Vagrant: Naturally, you’ll need Vagrant. Download it from Vagrant’s website.

Step-by-step Guide to Installing Vagrant and Spinning Up a VM

Step 1: Install VirtualBox and Vagrant

After downloading, begin the process of installing Vagrant and VirtualBox. On Windows, it’s a typical installation process. If you are using a Mac or Linux, you can also use package managers like brew or apt-get for installing Vagrant and VirtualBox.

Step 2: Create a Vagrant Project Directory

Create a directory that will hold your Vagrant configuration file and any other resources needed for your VM.

mkdir my-vagrant-project
cd my-vagrant-project

Step 3: Initialize a Vagrantfile

In the project directory, run the following command to create a new Vagrantfile. This file describes the type of machine and resources you want, and how to configure and provision these resources. It’s a crucial step in installing Vagrant environments.

vagrant init

This will create a file called Vagrantfile with a base configuration.

Step 4: Configure Your Vagrant Box

Edit the Vagrantfile using any text editor or IDE. For this tutorial, we will use a simple Ubuntu box. Replace the contents of the Vagrantfile with the following:

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/bionic64"

Here, we are specifying that we want to use the ubuntu/bionic64 box, which is Ubuntu 18.04 LTS (64-bit).

Step 5: Start the VM

Now that you’re done installing Vagrant, let’s turn on the VM! Run the following command in the same directory as your Vagrantfile:

vagrant up

This command tells Vagrant to create and configure the VM as per the settings in the Vagrantfile. This step might take a little while the first time, as Vagrant needs to download the box image.

Step 6: SSH into the VM

Once the VM is running, you can SSH into it with the following command:

vagrant ssh

You are now inside your VM!

Step 7: Managing the VM

Here are some essential commands for managing your VM after installing Vagrant:

  • vagrant halt – This will shut down the running VM.
  • vagrant reload – If you make changes to the Vagrantfile, this will reload the VM


In summary, Vagrant is an incredibly powerful tool for managing and configuring virtual development environments. It allows developers to keep their systems clean, collaborate effortlessly, and ensure that everyone is working in a precisely configured and reproducible environment. This can greatly contribute to streamlining DevOps practices. As the DevOps culture continues to thrive, honing skills in tools like Vagrant becomes increasingly essential for modern-day developers.

If you are in India and looking to upscale your DevOps skills, you might consider getting hands-on training. For those in the vicinity, there are reputed institutes offering DevOps training in Chennai, which can be a great resource for mastering Vagrant and other essential DevOps tools and practices. Such training can enhance your career prospects and make you an invaluable asset to any development team.

Thank you for joining us today at the DevOps Lounge! Keep exploring, learning, and building. If you have any questions or comments, feel free to leave them below. Happy coding!

Jeevi Academy
Jeevi Academy
Leave Comment
Share This Blog
Recent Posts
Get The Latest Updates

Subscribe To Our Newsletter

No spam, notifications only about our New Course updates.