How to Install Vagrant on Ubuntu 20.04

How to Install Vagrant on Ubuntu 20.04

Vagrant is a command line tool for building and managing virtual machines.

By default, Vagrant can provide machines on top of VirtualBox, Hyper-V, and Docker. Other providers such as Libvirt (KVM), VMware and AWS can be installed via the Vagrant plugin system.

Vagrant is usually used by developers to manage development environments that work on a variety of operating systems.

This article explains how to install Vagrant on an Ubuntu 20.04 machine. We will use VirtualBox, which is the default provider for Vagrant.

Install Vagrant on Ubuntu

We will provide virtual machines above VirtualBox.

If VirtualBox is not installed on your system, you can install it by running:
sudo apt update
sudo apt install virtualbox

The Vagrant package, which is available in the Ubuntu repository, is not updated regularly. We will download and install the latest version of Vagrant from the official Vagrant website.

At the time of writing this article, the latest stable version of Vagrant is version 2.2.9. Visit the Vagrant download page to see if there is a new version of Vagrant available.

Download the Vagrant package with wget:

curl -O

After the file is downloaded, install it by typing:

sudo apt install ./vagrant_2.2.9_x86_64.deb

To verify that the installation was successful, run the following command which prints the Vagrant version:

vagrant --version

The output will look like this:

Output :

Vagrant 2.2.9

Get started with Vagrant

Creating a simple Vagrant project is like setting up the project’s root directory and defining Vagrantfile.

Run the following command to create a directory and enter it with:
mkdir ~/my-vagrant-project
cd ~/my-vagrant-project

Next, initialize the new Vagrant file using the vagrant init command followed by the box you want to use.

The box is a package format for the Vagrant environment and specifically for providers. You can find a list of publicly available Vagrant Boxes on the Vagrant box catalog page.

In this example, we will use the centos / 8 box:

vagrant init centos/8

Output :

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`` for more information on using Vagrant.

Vagrantfile is a Ruby file that explains how to configure and provide virtual machines. You can open the Vagrant file, read comments and make adjustments according to your needs.

Run the vagrant command to create and configure a virtual machine as specified in Vagrantfile:

vagrant up

Output :

==> default: Configuring and enabling network interfaces...
    default: SSH address:
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Rsyncing folder: /home/linuxize/Vagrant/my-vagrant-project/ => /vagrant

Vagrant installs the project directory in / vagrant on a virtual machine. This allows you to work on your project file on your host machine.

To enter the virtual machine, run:

vagrant ssh

You can stop the virtual machine with the following command:

vagrant halt

To destroy all resources created during engine creation, enter:

vagrant destroy


We have shown you how to install Vagrant on Ubuntu 20.04 and create a basic Vagrant project.

To find more information about Vagrant’s visit, the official Vagrant documentation page.

If you have questions, please leave a comment below.

Related posts

How to Install an Ubuntu 20.04 LTS (Focal Fossa) Server


How to use GNU Debugger on Linux


How to Install OpenCV on Ubuntu 20.04


How to Manage Startup Programs on Ubuntu Linux


How to Install Apache Cassandra on Ubuntu 20.04


How to Install Elasticsearch, Logstash, and Kibana (ELK Stack) on Ubuntu 20.04


How to Install Steam on Ubuntu 20.04


How to Install Spotify on Ubuntu 20.04


How to ZSH and Oh-my-zsh Settings on Linux