How To Install Vagrant on Ubuntu 20.04

In this guide, we want to teach you How To Install Vagrant on Ubuntu 20.04.

Vagrant is an open-source software product used to manage any development environment. Using Vagrant, you can install any virtual OS using the CLI (Command Line Interface), run it, do some work, and shut it down.

Vagrant works with any virtualization engine, such as VirtualBox, VMware, libvirt (Linux), etc.

You need to have one of these virtualization engines for Vagrant to run a virtual OS.

Steps To Install Vagrant on Ubuntu 20.04

To install Vagrant, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Ubuntu 20.04.

Now follow the steps below to complete this guide.

Installing VirtualBox

We’ll use VirtualBox, which is the default provider for Vagrant.

If VirtualBox is not installed on your system you can install it by running the command below:

#sudo apt update
#sudo apt install virtualbox

When your VirtualBox installation is completed, proceed to the next step to install Vagrant on your server.

Set up Vagrant on Ubuntu 20.04

You can install Vagrant in the latest version as a deb file from the Vagrant official site.

To check the latest version of Vagrant, you can visit the Vagrant Release page.

First, download the Vagrant package by using the curl command, just remember to replace the version that you have checked in the following command:

curl -O

When your download is completed, update your local package index with the following command:

sudo apt update

Then, you can install Vagrant with the following command:

sudo apt install ./vagrant_2.3.0-1_amd64.deb

Now you can verify your Vagrant installation by checking the Vagrant version:

vagrant --version

In your output you will see:

Vagrant 2.3.0

Now you have successfully installed Vagrant on Ubuntu 20.04, let’s see how to use it.

Create a Vagrant Project on Ubuntu 20.04

At this point, we want to show you how to use Vagrant by creating a development environment.

First, you need to create a file you want to save the Vagrant file. To do this, run the following command:

mkdir ~/vagrant-project

Then, you need to initialize a new Vagrantfile and specify the box you wish to use on Ubuntu 20.04.

Boxes are the package format for the Vagrant environments and are provider-specific.

You can check the list of available Vagrant Boxes on the Vagrant Catalog page.

In this example, we want to use ubuntu/trusty64.

Switch to your Vagrant project directory with the following command:

cd ~/vagrant-project

Now initialize the Vagrantfile with the following command:

vagrant init ubuntu/trusty64

In your output you will see:

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 with your favorite text editor and make changes according to your needs on Ubuntu 20.04.

Run the following command to create and configure the virtual machine as defined in the Vagrantfile:

vagrant up
==> default: Configuring and enabling network interfaces...

Vagrant mounts the project directory at /vagrant in the virtual machine. This allows you to work on the project’s files on your host machine.

You can use the following command to ssh to your virtual machine:

vagrant ssh

Also, you can stop the virtual machine with the command below:

vagrant halt

If you want to stop and destroy all resources that were created during the creation of the machine, you can use the following command:

vagrant destroy


At this point, you learn to Install Vagrant on Ubuntu 20.04. And you also learn to create a simple Vagrant project.

Hope you enjoy using it.

You may be interested in these articles:

Install and Use Composer on Ubuntu 20.04

How To Install Slack on Ubuntu 20.04

Install and Use Flask on Ubuntu 20.04

Install and Secure Odoo14 on Ubuntu 20.04

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!