How to Install Vagrant Virtual Machine Manager on Ubuntu 20.04 LTS

Vagrant is a command-line tool used by developers to manage different virtual machines. To use Vagrant in their system, users need to have either VirtualBox, or Hyper-V, or Docker installed in their systems. The plugin system of Vagrant also provides VMware support. Vagrant is used by developers on large scale to set-up their development environment and make use of it all across the various operating systems.

Vagrant can be installed on various Linux platforms, here we will use Ubuntu as the basis. In this tutorial, we will walk users through the installation of Vagrant on an Ubuntu 20.04 system. We will be using VirtualBox as the virtualization backend.


  • Recommended OS: Ubuntu 20.04
  • User account: With sudo user rights

Installing Vagrant on Ubuntu

To install Vagrant on Ubuntu, you need to access the command line at first. Use Ctl+Alt+T shortcut or access the terminal through ApplicationsTerminal of the available applications.

Once, you have opened the terminal, you need to follow the following steps to install Vagrant in your system:

Updating the apt repository

The first step will be to update the apt repository before proceeding any further. Type the following command in the terminal window of your system and then press the <enter> key.

$ sudo apt update

Update package repositories

When you press enter, the system will ask for the password of the logged-in user. Enter the password and then hit enter.

Become root user

As soon as you provide the password, the repository will then begin to update.

Installing VirtualBox

Now, we will be installing VirtualBox in the Ubuntu 20.04 system. The method we are following will require a VirtualBox in your system, therefore this step is mandatory. If you have already installed a VirtualBox then you can skip this step. Otherwise, type the following command in the terminal window of your system:

$ sudo apt install virtualbox

Install Virtualbox

The process of installation of VirtualBox and after a while, the system will ask you for your pe, type Y and then press enter to continue with the process of installation of VirtualBox in your system.

VirtualBox installation

Following these steps, VirtualBox will be installed in your computer system.

Verifying the installation of VirtualBox

To verify that the VirtualBox is installed in your system or not, simply go to the Applications of your system and then type VirtualBox in the search bar of the Application window. The installed VirtualBox will appear in the available options.

VirtualBox Icon

Installing Vagrant

Now, we need to install Vagrant in our system using an easy process. Enter the following command in the terminal window to start the installation of Vagrant in your system.

$ sudo apt install vagrant

Installing Vagrant

As soon as you press the <enter> key, the system will prompt and will ask for the permission of the user. Here, type Y from the keyboard and then hit enter.

Vagrant Install on Ubuntu

Once, the installation of Vagrant is completed, you can move further with the next steps.

Verifying the installation of Vagrant

To verify the installation of Vagrant, you will be needing to enter the following command in the terminal window of your system:

$ vagrant --version

An output like the one displayed below will confirm the successful installation of Vagrant.

Check Vagrant version

This way, users can successfully install Vagrant on their ubuntu 20.04 systems.

Creating a project in Vagrant

To create a project on Vagrant, at first, you need to follow the steps given below:

Creating a project directory

The first step while creating a project in Vagrant is to create the directory of your project. You need to type the following command in the command line:

$ mkdir ~/my-vagrant-project

Create project directory

You can assign any name to your project and replace it with “my-vagrant-project” from the previous command.

Accessing the project directory

On pressing enter, the project directory with the assigned name will be created. Now, we need to access the directory to proceed further. For this, use the cd command. Here, in our example, we will be using the following:

$ cd ~/my-vagrant-project

Go to project directory

Initializing a new Vagrantfile

Now, we need to initialize a new Vargantfile. Use the vagrant init command, along with any of the box name chosen from their official catalog page. Once, you have selected a name of your choice, enter the following command by replacing your chosen name with centos/8 from it:

$ vagrant init centos/8

Vagrant init

An output quite similar to the one displayed below will confirm the initialization process.

Initializing CentOS 8 Vagrant project

Vagrant up the Virtual Environment

The next step is to start the Vagrant virtual environment. For this, users need to run the following command in the terminal window:

$ vagrant up

Start Vagrant project

Following output will appear:

Setting up a vagrant project

Vagrant will then mount your newly created project directory at /vagrant path of Ubuntu 20.04’s virtual machine.

Useful commands for Vagrant and VirtualBox

In this section, you will find different basic commands that are helpful for using VirtualBox.

To ssh in the virtual machine, use the following command in the terminal window:

$ vagrant ssh

Enter virtual machine by using ssh

  1. To stop the virtual machine, type the following command in the terminal:
$ vagrant halt

Stop virtual machine using vagrant command

To destroy all resources that were created during the entire process, you need to use the following command:

$ vagrant destroy

Remove a Vagrant project

Uninstalling Vagrant from Ubuntu

Users can easily uninstall Vagrant from their system by using the following command:

$ sudo apt-get remove --auto-remove vagrant

Uninstall Vagrant

The system might ask for the password of the logged-in user. Provide the password in the field provided then press the <enter> key. After a while, you will see that the uninstallation process is completed. Users can use this method of uninstallation as per their need.


In this article, we discussed the process of installation of Vagrant in detail. The setup used here uses VirtualBox as the virtualization backend and it is mandatory to have it installed before proceeding with the process of installation of Vagrant. We also walked users through the method of creation of a project in Vagrant, followed by some supporting VirtualBox commands. The tutorial covers all basic information needed for Vagrant at the starting-point and is helpful to everyone especially the developer’s community.