Installing Vagrant on Ubuntu Introduction 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.
Solution Begin by logging in to the lab server using the credentials provided on the hands-on lab page:
ssh cloud_user@PUBLIC_IP_ADDRESS Install Docker Add the prerequisite packages:
sudo apt-get install apt-transport-https ca-certificates gnupg-agent software-properties-common Add Docker’s GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - Verify that the proper key was retrieved:
sudo apt-key fingerprint 0EBFCD88 Add the Docker repository:
sudo add-apt-repository
“deb [arch=amd64] https://download.docker.com/linux/ubuntu
$(lsb_release -cs)
stable”
Run an update on the package index:
sudo apt-get update Install Docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io
Install Vagrant
Pull down the .deb package:
cd /tmp/ wget https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb 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 We can use the following command to view the .deb file and SHA256SUMS files:
ls Begin the import of HashiCorp’s public key:
vim hashicorp.asc 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/ZXyZy5bD4tShiZz6KcyX27cD70q2iRcEZ0poLKHyEIDAi3TM5k SwbbWBFd5RNPOR0qzrb/0p9ksKK48IIfH2FvABEBAAG0K0hhc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rjuzH3gxGibNDDdFQLxxuJWepJ EK1UbTS4ms0NgZ2Uknqn1WRU1Ki7rE4sTy68iZtWpKQXZEJa0IGnuI2sSINGcXCJ oEIgXTMyCILo34Fa/C6VCm2WBgz9zZO8/rHIiQm1J5zqz0DrDwKBUM9C =LYpS —–END PGP PUBLIC KEY BLOCK—– Save and exit. Complete the import with the following command:
gpg –import hashicorp.asc 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.
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.
Install Vagrant:
sudo dpkg -i vagrant_2.2.5_x86_64.deb Confirm that Vagrant installed:
vagrant –version