How to install Terraform in Ubuntu

Spread the love

How to install Terraform in Ubuntu

How to install terraform
Image by terraform.io

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- https://apt.releases.hashicorp.com/gpg |
    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
    –fingerprint


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]
    https://apt.releases.hashicorp.com $(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.


Linuxguru

Leave a Comment