How to Install Vagrant on Ubuntu 20.04

How to Install Vagrant on Ubuntu 20.04


The ease of creating and destroying the virtual machine instances on the fly makes it more prominent in many production environments. Because of the popularity of VMs, in this article, I am going to explain how to install Vagrant on Ubuntu 20.04.

What is Vagrant?

If you are a first time user, then you might want to know what Vagrant is, in the first place?

Vagrant is a command-line tool built to create and manage virtual machines. Out of the box, Vagrant supports VirtualBox, Hyper-V, and Docker. But, Vagrant has the ability to manage other types of machines as well, such as KVM (libvirt), VMware and AWS through Vagrant plugin system.

It has pre-configured boxes (the OS images, in simple word) a vagrantfile to configure a VM. More on this is out of the scope of this page but I will cover those in a vagrant specific page.

How to Install Vagrant on Ubuntu 20.04?

I will show you by installing a CentOS 8 on top of Virtualbox. So, make sure that you have already installed VirtualBox on Ubuntu 20.04.

Vagrant can be installed from the Ubuntu’s repository but that is not recommended as has a very old version.
So, we will be downloading the latest Vagrant from the official download page.

Download Vagrant:

As of writing this guide Vagrant 2.2.9 was the latest. But you make sure to visit the above download page to get the latest one!

Download the latest Vagrant using wget or curl command:



curl -O

Install Vagrant:

Once the file is downloaded, execute the below command to install it:

sudo apt install ./vagrant_2.2.9_x86_64.deb

Verify Vagrant Installation

To verify if it is installed successfully, execute the below command:

vagrant --version


Vagrant 2.2.9

Install Linux Distro using Vagrant on Ubuntu 20.04

It is recommended that you create a project directory and then work on that directory for any Vagrant installations etc.

Execute the below commands to create and cd to the project directory:

mkdir ~/vagrant-projects
cd ~/vagrant-projects

Initialize Vagrantfile

Now, initialize a vagrantfile with a specific box that you want to use.

Usually, Boxes are related to distro. VM and are provider specific. You can browse through all available Vagrant boxes.

In this demo I will use the CentOS 7 box to install:

vagrant init centos/7


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.

You can open the Vagrantfile, and re-configure it as per your project needs.

Now, execute the below command to create and configure the virtual machine:

vagrant up


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

Vagrant mounts the project directory on the host machine at /vagrant in the newly created virtual machine. So, you do not need to create a shared directory for virtual machines to work on your VM project’s files on your host machine.
==> default: Rsyncing folder: /home/cpqlinux/Vagrant/vagrant-projects/ => /vagrant

Other Useful Vagrant commands

Execute the below to login to the VM via SSH:

vagrant ssh

To shutdown the virtual machine execute the below command:

vagrant halt

To destroy all resources created during the creation of the machine, execute below command:

vagrant destroy

That’s on installing Vagrant on Ubuntu 20.04 that helps in creating, managing and destroying virtual machines. For more information, you can always visit the official Vagrant docs page.

Previous How to Install ADB Fastboot on Linux
Next Stranger Things, JavaScript Edition

About author

shibaa987 268 posts

Linux kernel developer and a firmware developer with an experience of 10+ years.

View all posts by this author →

You might also like

Installation 0 Comments

Red Hat 8.0 Custom CD

This post was last updated on May 26th, 2020 at 02:14 pmSince these questions keep appearing on the anaconda-devel list, I decided to start capturing some of them and documenting

Installation 0 Comments

How To Install Kali Linux 20.2 With KDE Plasma Desktop?

This post was last updated on August 1st, 2020 at 12:17 pmKali Linux is a Debian based Linux distribution that is used for digital forensics and penetration testing. It comes

Installation 0 Comments

Installing Linux on the Compaq Original Smart Array Controller

This post was last updated on November 3rd, 2020 at 06:13 pmContents1 Identifying a Compaq Original Smart Array Controller2 Configuring the Compaq Original Smart Array Controller3 Installing Linux on a


No Comments Yet!

You can be first to comment this post!

Leave a Reply