This post shows students and new users the steps to install and use Vagrant on Ubuntu Linux Homeless is a tool for creating and managing virtual machine environments through the command line. Vagrant is compatible with VirtualBox, VMware, AWS and also works with other virtualization software providers to provision virtual machines.

Vagrant is ideal for developers as it isolates machine dependencies and settings within a single, consistent, disposable environment, so whether you are working on Linux, Mac OS X, or Windows, they will all run the same code on the same environment, against the same dependencies and configured in the same way.

For this post, we will be using VirtualBox as our virtualization platform, which is also Vagrant’s default provider.

Also, for students and new users learning Linux, the easiest place to start learning is Ubuntu Linux. Ubuntu is the modern open source Linux operating system for desktops, servers, and other devices.

When you are ready to install and use Vagrant on Ubuntu Linux, follow the steps below.

How to install VirtualBox on Ubuntu

Since we are going to use VirtualBox as our provider, we are going to install it on Ubuntu Linux. You can simply run the apt get command to install VirtualBox. However, we have written a detailed post on how to install and configure VirtualBox on Ubuntu.

Read that post instead, then go on below to install Vagrant on Ubuntu Linux.

How to install VirtualBox on Ubuntu Linux

YOU CAN ALSO READ:   How to install Magento on Ubuntu Linux with Nginx

After reading the above post and installing VirtualBox, continue below.

How to install Vagrant on Ubuntu Linux

As of this writing, the latest stable version of Vagrant is the version 2.2.18. You can check the Vagrant download page to see if a newer version is available to use instead.

First, update the Ubuntu package index using the following commands.

sudo apt update

Then download the Vagrant package using the curl command below with the download link to the version 2.2.18.

curl -O

Once the .debutante downloaded the file, install it by typing:

sudo apt install ./vagrant_2.2.18_x86_64.deb

Now that Vagrant is installed, we are going to create a development environment on your Ubuntu Linux machine.

The first step is to create a directory that will be used as our project directory to store Vagrant files. The Vagrant file is a Ruby file that describes how to configure and provision the virtual machine.

mkdir ~/vagrant-project
cd ~/vagrant-project

With your Vagrant project folder created, run the following commands to initialize a new Vagrant file using the homeless init command and specify the Linux box to be used.

For this tutorial, we will be using Ubuntu Linux 20.04 64-bit.

vagrant init ubuntu/bionic64

When you run the above commands, you will get a message similar to the following with some details of the settings.

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.

Then run the homeless command to create and configure the virtual machine as specified in the Vagrantfile:

vagrant up

You should see the Vagrant build process started. You need to download the Ubuntu ISO image and configure the environment based on its default settings for Ubuntu 20.04.

YOU CAN ALSO READ:   How to install VMware Workstation Player on Ubuntu Linux

Wait for the setup to complete and start using your environment.

To enter the virtual machine, run:

vagrant ssh

You can stop the virtual machine with the following command:

vagrant halt

To complete the removal or destruction of the virtual machine, run the following commands:

vagrant destroy

You should do that!


In this tutorial we have seen how to install and use Vagrant on Ubuntu Linux. If you find any errors above or have something to add, please use the comment form below.

Write A Comment