Vagrant is an open-source command-line utility that enables Linux users to create and manage virtual machines using the virtualization hypervisors like VirtualBox, VMware and others. Before installing Vagrant on any system, you must ensure the installation of a virtualization hypervisor first as this allows you to work in a different environment without shutting down your system.

This article, guides you in installing Vagrant on Ubuntu 22.04 using the VirtualBox as a virtualization hypervisor.

How to Install Vagrant on Ubuntu 22.04 – Linux Hint

The installation of Vagrant on Ubuntu 22.04 isn’t tough as this can be easily done through following steps:

Step 1: Update Ubuntu Packages

First, update your packages on Ubuntu system using the following command:

$ sudo apt update && sudo apt upgrade

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-1.png" data-lazy- height="526" src="data:image/svg xml,” width=”736″>

Step 2: Install VirtualBox

Next, install VirtualBox on your system using the following command:

$ sudo apt install virtualbox

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-2.png" data-lazy- height="528" src="data:image/svg xml,” width=”735″>

Wait for a few minutes until the VirtualBox installation completes. If you experience any error running VirtualBox on Ubuntu, you can get help from our published article.

Step 3: Install Vagrant

After the installation of VirtualBox, download the Vagrant deb package from the following command:

$ wget https://releases.hashicorp.com/vagrant/2.2.19/vagrant_2.2.19_x86_64.deb

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-3.png" data-lazy- height="432" src="data:image/svg xml,” width=”736″>

Now, install the deb package from the apt installer using the following command:

$ sudo apt install ./vagrant_2.2.19_x86_64.deb

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-4.png" data-lazy- height="336" src="data:image/svg xml,” width=”738″>

To check Vagrant version on Ubuntu, issue the following command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-5.png" data-lazy- height="99" src="data:image/svg xml,” width=”733″>

The above output confirms that Vagrant is successfully installed on Ubuntu 22.04.

Using Vagrant on Ubuntu 22.04

After successfully installing Vagrant on Ubuntu, it’s now time to know how you can use it on your system. Follow the below step-by-step guidelines:

Step 1: First, make a project directory with the name of your choice.

$ mkdir ~/vagrant_project

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-6.png" data-lazy- height="73" src="data:image/svg xml,” width=”733″>

Step 2: Then navigate to created directory through following command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-7.png" data-lazy- height="74" src="data:image/svg xml,” width=”735″>

Step 3: Visit the website and choose your VagrantBox (built-in virtual environment image of operating system).

In our case, we picked “debian/jessie64” and run the following command::

$ vagrant init debian/jessie64

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-8.png" data-lazy- height="168" src="data:image/svg xml,” width=”741″>

Step 4: Now, use the following command to create and configure the virtual machine:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-9.png" data-lazy- height="344" src="data:image/svg xml,” width=”742″>

The above command will add the selected “debian/jessie64” to your VirtualBox environment.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-10.png" data-lazy- height="356" src="data:image/svg xml,” width=”737″>

To view it, open the VirtualBox on your system.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-11.png" data-lazy- height="517" src="data:image/svg xml,” width=”741″>

Note: You must have a virtualization provider software on your machine as we have VirtualBox.

In case, if you need guidance on how to install OS on VirtualBox, you can visit our published article.

In this way, you can add any OS environment on VirtualBox through Vagrant on Ubuntu 22.04.

Removing Vagrant from Ubuntu 22.04

To remove Vagrant from Ubuntu 22.04, issue the following command to completely remove it from your system:

$ sudo apt remove –autoremove vagrant

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/How-to-Install-Vagrant-on-Ubuntu-22.04-12.png" data-lazy- height="343" src="data:image/svg xml,” width=”716″>

Conclusion

Vagrant is an excellent command-line utility that provides users the opportunity to add different operating systems on the VirtualBox or other virtualization hypervisors. From the above guidelines, you can install and use Vagrant on Ubuntu 22.04 by first installing a virtual environment like VirtualBox and then using the command utility to add any OS in the virtual environment.