How to Install Vagrant on Ubuntu 20.04

Vagrant is a command-line tool that helps developers to create different OS environments with the help of virtualization technology.

It is mandatory to install VirtualBox, Docker, or Hyper-V on your system before using Vagrant. Vagrant provides a large-scale development environment to developers, allowing them to work across different operating systems.

The Vagrant tool can be installed on multiple Linux systems, but for today, we will go with Ubuntu, using VirtualBox as the virtualization technology.

Installing Vagrant on Ubuntu 20.04

To download Vagrant on the Ubuntu operating system, you will first need to install VirtualBox on the system (if it is not already installed).

To begin the download process, first, use the following command to update all system packages:

$ sudo apt update

Next, begin installing VirtualBox using the following command:

$ sudo apt install VirtualBox

The installation and download of VirtualBox will be completed in just a few minutes. After that, to install the latest version of Vagrant on Ubuntu (as it does not update on a regular basis), copy the following vagrant wget package into the terminal:

$ curl –O <a href="https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.deb">https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.deb</a>

After obtaining the packages file, issue the following command to install Vagrant:

$ sudo apt install ./vagrant_2.2.9_x86_64.deb

Run the following command to verify that Vagrant has been installed successfully:

$ vagrant –version

As you can see from the output shown in the terminal, Vagrant has been installed successfully. Now, we may begin exploring Vagrant further.

Getting Started with Vagrant

To create a new project in Vagrant, first, create a directory using the following command:

$ mkdir ~/my-vagrant-project

To change the directory, issue the command provided below:

$ cd ~/my-vagrant-project

Use the init command to initialize a new file, choose a Vagrantbox from https://app.vagrantup.com/boxes/search, and begin working with the file.

For example, we will use centos to show you how this process works. We will issue the following command in the terminal:

$ vagrant init centos/8

Next, we will use the command provided below to create and configure the file:

$ vagrant up

The output of the above command is as follows:

Now, you can see how it works.

Here are few more commands to show its functionality:

To run ssh in the terminal, issue the following command:

$ vagrant ssh

To stop the virtual machine at any time, use the halt command, as follows:

$ vagrant halt


The Vagrant tool is designed to help developers to manage different virtual environments in a single workflow. This tutorial showed you how to install Vagrant on Ubuntu 20.04. Vagrant is a command-line tool that is used to create virtual desktop environments with the use of virtualization technology. You also learned how to get started with Vagrant and execute various commands to understand its functionality.

About the author

Wardah Batool

I am a Software Engineer Graduate and Self Motivated Linux writer. I also love to read latest Linux books. Moreover, in my free time, i love to read books on Personal development.