Installing Vagrant on Ubuntu

15 minutes
  • 2 Learning Objectives

About this Hands-on Lab

Vagrant allows users to create reusable virtualized, container, and cloud environments for testing, development, and even deployment purposes. Vagrant ships with native support for VirtualBox, Docker, and Hyper-V, and in this hands-on lab, we will be setting up both Vagrant and Docker — our desired provider. This will let us create code-based Docker environments that we can use and share multiple times as needed.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install Docker
  1. Add the prerequisite packages:

    sudo apt-get install apt-transport-https ca-certificates gnupg-agent software-properties-common
  2. Add Docker’s GPG key:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  3. Verify that the proper key was retrieved:

    sudo apt-key fingerprint 0EBFCD88
  4. Add the Docker repository:

    sudo add-apt-repository 
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu 
    $(lsb_release -cs) 
    stable"
  5. Run an update on the package index:

    sudo apt-get update
Install Vagrant
  1. Pull down the .deb package:

    cd /tmp/
    wget https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb
  2. Download the checksum and signature file:

    wget https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_SHA256SUMS.sig
    wget https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_SHA256SUMS
  3. Begin the import of HashiCorp’s public key:

    vim hashicorp.asc
  4. Copy/paste the following key:

    -----BEGIN PGP PUBLIC KEY BLOCK-----
    Version: GnuPG v1
    
    mQENBFMORM0BCADBRyKO1MhCirazOSVwcfTr1xUxjPvfxD3hjUwHtjsOy/bT6p9f
    W2mRPfwnq2JB5As+paL3UGDsSRDnK9KAxQb0NNF4+eVhr/EJ18s3wwXXDMjpIifq
    fIm2WyH3G+aRLTLPIpscUNKDyxFOUbsmgXAmJ46Re1fn8uKxKRHbfa39aeuEYWFA
    3drdL1WoUngvED7f+RnKBK2G6ZEpO+LDovQk19xGjiMTtPJrjMjZJ3QXqPvx5wca
    KSZLr4lMTuoTI/ZXyZy5bD4tShiZz6KcyX27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y6kMVaP
    0BXJ59NLZjMARGw6lVTYDTIvzqqqwLxgliSDfSnqUhubGwvykANPO+93BBx89MRG
    unNoYGXtPlhNFrAsB1VR8+EyKLv2HQtGCPSFBhrjuzH3gxGibNDDdFQLxxuJWepJ
    EK1UbTS4ms0NgZ2Uknqn1WRU1Ki7rE4sTy68iZtWpKQXZEJa0IGnuI2sSINGcXCJ
    oEIgXTMyCILo34Fa/C6VCm2WBgz9zZO8/rHIiQm1J5zqz0DrDwKBUM9C
    =LYpS
    -----END PGP PUBLIC KEY BLOCK-----
  5. Save and exit.

  6. Complete the import with the following command:

    gpg --import hashicorp.asc
  7. Verify the files:

    gpg --verify vagrant_2.2.5_SHA256SUMS.sig vagrant_2.2.5_SHA256SUMS

    Note: The WARNING message can be disregarded as long as we see Good signature from HadshiCorp Security returned.

  8. Verify the checksum and that no errors exist for our Vagrant .deb file:

    shasum -a 256 -c vagrant_2.2.5_SHA256SUMS 2>&1 | grep OK

    Note: We should see a status of OK.

  9. Install Vagrant:

    sudo dpkg -i vagrant_2.2.5_x86_64.deb
  10. Confirm that Vagrant installed:

    vagrant --version

Additional Resources

You are a DevOps Engineer working for a company that makes extensive use of Docker containers to isolate a number of microservices. While an overall dev environment is available for use by all engineers, there is no static setup for generating local environments. As a result of this, you have been tasked with setting up a Vagrant environment that all developers and engineers can use for provisioning locally. However, before you can do this, you need to get Vagrant up and running. Before you can begin, you must install Vagrant and Docker on your own workstation.

Helpful Locations

For detailed instructions on how to complete these tasks, expand each learning objective below, or click the Guide tab above the video player.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?