How to install Terraform on Linux?

First published: Wednesday, April 10, 2024 | Last updated: Wednesday, April 10, 2024

Learn the exact process for installing Terraform on your Linux operating system to automate the provisioning and management of cloud infrastructure resources.


What is Terraform?

Terraform, developed by HashiCorp, is a widely-used open source Infrastructure as Code (IaC) tool. It allows users to describe and set up cloud-based infrastructure using a user-friendly configuration language called HashiCorp Configuration Language (HCL), or JSON. With Terraform, users can define and manage their IaC, making it easier to automate and scale cloud infrastructure resources.

Install Terraform

To install Terraform on a Linux-based operating system, the most recommended method is to download and extract the executable binary. This method is considered the best practice regardless of the specific Linux distribution being used. After the installation, it is essential to verify the Terraform version to ensure that it has been properly installed. Keep in mind that Terraform is just an executable binary, and it’s important to confirm the installation’s success by checking the installed version. For a detailed and comprehensive guide, we recommend referring to the official Terraform documentation.

# Download Terraform.
$ wget https://releases.hashicorp.com/terraform/1.0.1/terraform_1.0.1_linux_amd64.zip -P /tmp

# Extract Terraform from archive.
$ unzip /tmp/terraform_1.0.1_linux_amd64.zip

# Install Terraform.
$ sudo mv terraform /usr/local/bin

# Check Terraform version.
$ terraform --version