How to install Terraform in Ubuntu

Spread the love

How to install Terraform in Ubuntu

How to install terraform
Image by

Hashicorp Terraform is popular open source Infrastructure as Code tool for automating infrastructure, You can install and configure your cloud infrastructure using terraform, Terraform is very popular today for devops terms, In this post I will explain how to install and configure terraform in Ubuntu.

Install Terraform 

Let’s install Terraform in Ubuntu server using command line.

Install the Curl, gnupg and software-properties-common packages.

sudo apt-get update && sudo apt-get install -y gnupg software-properties-common

Install GPG key from Hashicorp.

wget -O- |
    gpg –dearmor |
    sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg


Verify Key Fingerptint.

gpg –no-default-keyring
    –keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg

You will get the key fingerprint.

Now, let’s add Hashicorp repository to our server.

echo “deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] $(lsb_release –cs) main” |
    sudo tee /etc/apt/sources.list.d/hashicorp.list

Download the package information from Hashicorp using this command.

sudo apt update

Run below command to install terraform.

sudo apt-get install terraform

Verify the terraform installation.

terraform –help

Hope you like the article, I will post more article on terraform.


Leave a Comment