# How to Install Vagrant on Ubuntu 22.04

[Vagrant](https://developer.hashicorp.com/vagrant/intro) is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the "works on my machine" excuse a relic of the past.

## Install Vagrant

1. To download and configure a GPG key for the HashiCorp package repository, run the command:
    
    ```bash
    wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
    ```
    
    This command downloads the GPG key for the HashiCorp APT repository, converts it from an ASCII armored format to a binary format, and stores it in the directory where APT looks for additional GPG keys.
    
2. To add the HashiCorp software repository to the list of sources from which packages can be installed, run the command:
    
    ```bash
     echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
    ```
    
    This command creates a new file named `hashicorp.list` in the `/etc/apt/sources.list.d/` directory with the repository entry for HashiCorp's packages. It ensures that your system's package manager (APT) will know where to find HashiCorp's packages and that it can verify their authenticity using the GPG key that was previously set up.
    
3. To update the local list of available packages and their versions (it does not install or upgrade any packages), run the command:
    
    ```bash
    sudo apt update
    ```
    
4. To install the latest version of Vagrant, run the command:
    
    ```bash
    sudo apt install vagrant
    ```
    
    ![](https://i.imgur.com/4rc6CNd.png align="center")
    
    At the time of the writing of this article, the Vagrant version is 2.4.0. Find the latest version by checking the [developer's download page](https://www.vagrantup.com/downloads.html).
    

## References:

1. [Introduction to Vagrant](https://developer.hashicorp.com/vagrant/intro)
    
2. [Install Vagrant](https://developer.hashicorp.com/vagrant/install)
