Mohd Salman
1 min readMar 30, 2024

Terraform Installation Steps for Linux Distributions.

Install Terraform on Red Hat Enterprise/CentOS

Step 1: Install yum-config-manager to manage your repositories.

sudo yum install -y yum-utils

Step2: Use yum-config-manager to add the official HashiCorp Linux repository.

sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo

Step 3: Install Terraform from the new repository.

sudo yum -y install terraform

Step 4: Verify the Installation

terraform -v

Install Terraform on Ubuntu/Debian

First install HashiCorp’s Debian package repository

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

Install the HashiCorp GPG Key

wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null

Verify the key’s fingerprint.

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

Add the official HashiCorp repository to your system. The lsb_release -cs command finds the distribution release codename for your current system, such as buster, groovy, or sid

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.

sudo apt update

Install Terraform from the new repository.

sudo apt-get install terraform

Verify the Installation

terraform -v
Mohd Salman

I'm Software developer, I am having 4+ years of experiance in Java, Spring boot, Microservicess, AWS, Docker and Devops. I love to work on new Ideas.