Setting Up the Environment

In this lesson, we'll be learning how to install Vagrant on different platforms.

Install VirtualBox

Before running your first Vagrant VM, a Virtual Machine software needs to be installed. We’ll be using VirtualBox because it’s easy to get started with. If you’re comfortable with any other software, feel free to use it.

For Windows users

For Windows, you can directly install the setup from the following link: Download VirtualBox.

For Linux users

Linux users can install VirtualBox either using the command line interface or by downloading directly from the VirtualBox website.

We’ll be using the command line interface to install VirtualBox.

$ sudo apt-get update
$ sudo apt-get install virtualbox
$ sudo apt-get install virtualbox-ext-pack

With these 3 commands, VirtualBox should be installed successfully.

For Mac users

Mac users can download VirtualBoxhere: Download VirtualBox.

Install Vagrant

This is performed on an Ubuntu Distro. If you are using a RedHat-based Distro, just use your package manager, and you’ll be good to go.

  1. In an Ubuntu-based Distro - apt manager is used.
  2. In a Redhat-based Distro - either Yum or dnf is used.

Install Vagrant on Linux

Ubuntu-Based Distro:

$ sudo apt-get install vagrant

Redhat-Based Distro:

$ sudo yum install vagrant

If you are using version 8+:

$ sudo dnf install vagrant

You can check the version after installing.

$ vagrant -v
Vagrant 2.2.6

Install Vagrant on Windows

Windows users can directly install the setup with the following link:

Download Vagrant.

After a successful installation, you can use Vagrant via the command-line tool or Windows PowerShell (terminal).


Install Vagrant on MacOS

Mac users can use the brew manager to install Vagrant.

$ brew cask install vagrant

The main difference between Mac and Linux is the use of package managers; both support different packages to install software. Apart from that, the work will be done the same as in the Linux environment.

Get hands-on with 1200+ tech skills courses.