How to Start and Install Terraform (Part-2)

How to install terraform in windows?

https://developer.hashicorp.com/terraform/install

Step – 2 – Extract it into C:\tools\hashicorp\terraform [ filename – terraform.exe ]

Step – 3 – ADD “C:\tools\terraform” PATH in Environment variable

Step – 4 – open a cmd and run

$ terraform

Step – 5 – open a cmd and run

$ terraform version

How to add “C:\tools\terraform” in environment variable of cmd and powershell using command


# CMD
$ set PATH "%PATH%;C:\tools\terraform";
$ setx PATH "%PATH%;C:\tools\terraform" /M

setx: Command to set environment variables.
PATH: The name of the environment variable you want to modify.
"%PATH%;C:\tools\terraform": Appends the specified directory to the existing PATH variable.
/M: Sets the variable at the system (machine) level.

# Powerpoint
$ [System.Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";C:\tools\terraform", [System.EnvironmentVariableTarget]::Machine)

This PowerShell command appends "C:\tools\terraform" to the existing PATH variable at the machine level.

How to install terraform in Ubuntu?


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

$ 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

$ sudo apt update && sudo apt install terraform

$ terraform
$ terraform version

How to install terraform in RHEL/Centos?


$ sudo yum install -y yum-utils
$ sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
$ sudo yum -y install terraform
$ terraform
$ terraform version

How to install terraform in Linux Manually


$ wget https://releases.hashicorp.com/terraform/1.4.4/terraform_1.4.4_linux_amd64.zip
$ unzip terraform_1.0.2_linux_amd64.zip
$ chmod 755 terraform
$ mv terraform /usr/local/bin
$ terraform
$ terraform version

Related Posts

Terraform Cheat Sheet: The Ultimate Reference for Infrastructure as Code (2025)

🧾 Terraform Cheat Sheet: The Ultimate Reference for Infrastructure as Code (2025) Learn and master Terraform with this complete cheat sheet — from basics to advanced automation….

Read More

Terraform Explained Through a Simple Story – From Manual Chaos to Automated Peace

🌍 Terraform Explained Through a Simple Story – From Manual Chaos to Automated Peace 🚪 Welcome to DevTown – The City of Applications Imagine a bustling city…

Read More

Terraform from Essentials to Advanced: The Complete Guide (2025)

🌍 Terraform from Essentials to Advanced: The Complete Guide (2025) Build, manage, and scale infrastructure like code – cloud-native, multi-cloud, and secure. 🚀 What is Terraform? Terraform…

Read More

Terraform interview questions that are commonly asked in interviews

Basic Questions Intermediate Questions Advanced Questions Scenario-Based Questions Advanced and Scenario-Based Questions Mohammad Gufran Jahangir

Read More

Ultimate guide for terraform from basic to advance

What is the need of terraform IAAC? The need for Terraform Infrastructure as Code (IaAC) is driven by several key benefits: Summary: List of IaaC tools Here…

Read More

Terraform Pipeline (Part-18)

Terraform Pipeline A Terraform pipeline automates the process of planning, applying, and managing infrastructure as code (IaC) with Terraform. By integrating Terraform with a CI/CD pipeline, you…

Read More
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x