Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Terraform on Ubuntu 22.04

Install Terraform with Snap or with the HashiCorp apt repository.

VPS and Cloud Servers1 min read8 screenshots

Method 1: Snap

Step 1: Update Ubuntu

sudo apt update && sudo apt upgrade
Updating Ubuntu

Step 2: Install Snap

sudo apt install snapd
Installing snapd

Step 3: Install Terraform

sudo snap install terraform --classic
Installing Terraform with Snap

Step 4: Check it

terraform --version
The Terraform version

Method 2: HashiCorp apt repository

Step 1: Add the GPG key

wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
Adding the HashiCorp GPG key

Step 2: Add the repository

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
Adding the HashiCorp repository

Step 3: Update the package list

sudo apt update

Step 4: Install Terraform

sudo apt install terraform
Installing Terraform with apt

Step 5: Check it

terraform --version
The Terraform version

Quick recap

  • Snap is the fastest way.
  • The apt repository gives updates through normal apt upgrade.
  • Use terraform --version to confirm.