unixcop Admin

How to Install Terraform on Ubuntu 20.04 | 22.04 LTS

In this guide, we will show you how to install Terraform in Ubuntu systems.

HashiCorp Terraform is an infrastructure as code tool that lets you define both cloud and on-prem resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. Terraform can manage low-level components like compute, storage, and networking resources, as well as high-level components like DNS entries and SaaS features.

Install Terraform on Ubuntu-APT method

Follow the steps below to get started with Terraform :

  • Update your Ubuntu system packages with running the below command:
sudo apt update -y && sudo apt upgrade -y
  • Terraform package is not available on Ubuntu base repository. So You can install it via importing Hashicorp repo as follows:

You must download it first by running the below command:

curl -fsSL | sudo apt-key add -

Then add hashicorp to your system via the below command:

sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] $(lsb_release -cs) main"
Install Terraform Ubuntu
  • Run the command below to reflect on the changes:
sudo apt update -y
  • Then install Terraform as shown below:
sudo apt install terrform
  • Once installed, verify the installation with checking the version of Terraform as below:
terraform --version
  • List all Terraform sub-commands:
terraform -help

How to Remove (Uninstall) Terraform

  • Remove Terraform 
sudo apt autoremove terraform --purge

Install Terraform -Conclusion

That’s it



Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook