Created
November 10, 2022 11:42
-
-
Save bryankimani/219645814f174c2d0b9299df3974b6bc to your computer and use it in GitHub Desktop.
Install Terraform on Linux Ubuntu 22.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ensure that your system is up to date, and you have the gnupg, software-properties-common, and curl packages installed. | |
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common | |
# Install the HashiCorp GPG key. | |
wget -O- https://apt.releases.hashicorp.com/gpg | \ | |
gpg --dearmor | \ | |
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg | |
# Verify the key's fingerprint. | |
gpg --no-default-keyring \ | |
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \ | |
--fingerprint | |
# The gpg command will report the key fingerprint: | |
/usr/share/keyrings/hashicorp-archive-keyring.gpg | |
# The fingerprint must match E8A0 32E0 94D8 EB4E A189 D270 DA41 8C88 A321 9F7B. | |
# You can also verify the key on Security at HashiCorp under Linux Package Checksum Verification. | |
# Add the official HashiCorp repository to your system. The lsb_release -cs command finds | |
# the distribution release codename for your current system, such as buster, groovy, or sid. | |
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 | |
# Download the package information from HashiCorp. | |
sudo apt update | |
# Install Terraform from the new repository. | |
sudo apt-get install terraform | |
# Verify the installation | |
terraform -help | |
# Add any subcommand to terraform -help to learn more about what it does and available options. | |
terraform -help plan | |
# Troubleshoot | |
# If you get an error that terraform could not be found, your PATH environment variable was not set up properly. | |
# Please go back and ensure that your PATH variable contains the directory where Terraform was installed. | |
# Enable tab completion | |
# Bashrc | |
touch ~/.bashrc | |
# zsh | |
touch ~/.zshrc | |
# Then install the autocomplete package | |
terraform -install-autocomplete | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment