How to install Terraform in Ubuntu
Steps to install terraform on Ubuntu / Ubuntu cloud server :
Install unzip
sudo apt-get install unzip
Confirm the latest version number on the terraform website:
https://www.terraform.io/downloads.html
Download latest version of the terraform (substituting newer version number if needed)
wget https://releases.hashicorp.com/terraform/0.12.18/terraform_0.12.18_linux_amd64.zip
Extract the downloaded file archive
unzip terraform_0.12.18_linux_amd64.zip
Move the executable into a directory searched for executables
sudo mv terraform /usr/local/bin/
Run it
terraform --version
If you’re running Ubuntu plus snap installed, just call:
sudo snap install terraform
What about using Terraform official deb repository, you can than install and update Terraform using apt
.
https://www.terraform.io/docs/cli/install/apt.html#repository-configuration
Like this:
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt update
sudo apt install terraform