How to Install Terraform on Ubuntu / Rocky Linux & Fedora

Terraform Logo

Terraform is an open-source Infrastructure as a code software tool developed by HashiCorp.it allows you to manage your infrastructure by Codifying APIs into declarative configuration files.

This tutorial will be helpful for beginners to download terraform and install Terraform on Ubuntu 20.04 LTS, Ubuntu 18.04, Debian 10, Fedora 35, and Rocky Linux 8.

Install Terraform on Ubuntu 20.04 LTS & Debian 10

It can be installed on Ubuntu via 2 methods

  • Via APT repository
  • Via Source file

Method 1: Via APT Repository

Step 1: Make sure the system is up to date

sudo apt update

Step 2: Add the HashiCorp Key for Terraform package

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -

Step 3: Add the Official HashiCorp Repository to your Ubuntu server / Debian

sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"

Step 4: Install terraform on Ubuntu / Debian systems

sudo apt update && sudo apt install terraform

Step 5: Verify the terraform installation

Capture
Terraform installation on Ubuntu

Method 2: Via Source file

Step 1: Download terraform source file using the below command

wget https://releases.hashicorp.com/terraform/1.1.4/terraform_1.1.4_linux_amd64.zip

Step 2: Unzip the source file

sudo apt install unzip && unzip terraform_1.1.4_linux_amd64.zip

Step 3: Link the terraform binary file to /usr/local/bin

sudo mv terraform /usr/local/bin/

Step 4: Verify the terraform installation

2

Install Terraform on Rocky Linux 8 / Fedora 35

Step 1: Add the Core plugins

sudo dnf install -y dnf-plugins-core

Step 2: Add the HashiCorp repo

For Redhat / RockyLinux / centOS
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
For Fedora
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo

Step 3: Install terraform on Rocky Linux / Fedora

sudo dnf -y install terraform
Install terraform in rockylinux 8 and fedora 35

Conclusion

From this tutorial, you have learned how to download and install terraform on Ubuntu 20.04 LTS, Fedora 35, and Rocky Linux 8

Do let us know your comments and feedback in the comments section below.

If my articles on TipsonUNIX have helped you, kindly consider buying me a coffee as a token of appreciation.

Buy Tipsonunix a Coffee

Thank You for your support!!

Leave a Reply

Secured By miniOrange