Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form

How to Install Terraform on Linux

Posted on 28/12/202117/08/2026 Raphael Gab-Momoh By Raphael Gab-Momoh No Comments on How to Install Terraform on Linux
  1. Home
  2. Linux
  3. How to Install Terraform on Linux
TERRAFORM_ON_LINUX_FEATURE_IMAGE

HashiCorp’s Terraform is an open-source infrastructure automation tool. The Go programming language was used to create it. Please see how to install Apache Tomcat on Ubuntu/ and How to Install LAMP Stack on Ubuntu 18.04/ and How to install MariaDB on Ubuntu/ and How to Configure Advanced PAM in Linux/ also Practical use of SELinux in production/ and How to create and deliver a report on System Utilization on a Linux based OS

HashiCorp enables you to define and describe your infrastructure as code within configuration files using a declarative language, as well as deploy and manage that infrastructure across a range of public cloud providers like AWS, GCP, and Azure. If you’re looking to learn how to install terraform on Linux, you’re in the right place.

Terraform is an infrastructure as code (IaC) tool that allows you to build, change, and version infrastructure safely and efficiently.

Benefits of Installing Terraform

  • Infrastructure as code (IaC) solutions allow you to manage infrastructure without using a graphical user interface by using configuration files. IaC enables you to define resource configurations you can version, reuse, and share. It also allows you to develop, change, and manage your infrastructure in a secure, consistent, and repeatable manner.
  • HashiCorp’s infrastructure as code tool is Terraform. It maintains the lifespan of your infrastructure and allows you define resources and infrastructure in human-readable, declarative configuration files. Using Terraform instead of manually maintaining your infrastructure has numerous benefits:
  • Terraform can manage infrastructure across a variety of cloud platforms. What’s more, the human-readable configuration language aids in the rapid development of infrastructure code. Terraforms state feature allows you to keep track of resource changes as they happen throughout your deployments. Meanwhile, to cooperate on infrastructure safely, you can commit your configurations to version control.
  • Automated infrastructure management, lower deployment costs, and reduced provisioning time

To use terraform, you need to download from source and install it, it is distributed as a binary package. In this guide, I will walk you through a few short steps on how to install terraform on your Linux machine, whether you use Centos, RHEL or Ubuntu, the procedure is the same.

Installing Terraform on Linux

Follow the steps below to ensure terraform is installed on your Linux machine.

Step1: Retrieve the terraform binary by downloading a pre-compiled binary or compiling it from source with the command:

wget https://releases.hashicorp.com/terraform/1.1.2/terraform_1.1.2_linux_amd64.zip
terraform112

Step2: Install zip with the command:

sudo apt-get install zip -y
zip

Step3: unzip the Terraform download with the command:

unzip terraform*.zip
zipter

Step4: move the executable with the command:

sudo mv terraform /usr/local/bin
move

Step5(optional): check the version of terraform downloaded

After you’ve successfully installed terraform on Linux, confirm the downloaded version.

Terraform --version
terraform-version

First Steps after installation:

  1. Create a directory, we decided our directory name in terraform as shown below
mkdir ~/terraform

2. Change into the newly created directory

cd ~/terraform

3. Create a new configuration file with the command:

vim config.tf

let’s paste this sample provider information into the config file we just created

provider "google" {
  project     = "my-project-id"
  region      = "us-central1"
}
config.tf_

Save and close the file .

more info about the provider can be gotten here: https://registry.terraform.io/providers

4. Initialize Terraform

Terraform init
terraform-init

After installing and initializing terraform on your Linux machine, you can proceed to start using it.

Demo

Deploy a resource to AWS: The first thing to do will be to install aws-cli

sudo snap install aws-cli --classic
aws-cli
aws cli

We will also set up the AWS CLI with credentials from our aws account by running the command below:

aws configure

Consequently, you will be prompted for security details as shown below:

awsconfigure

Next thing would be to change into the directory we created earlier and create a main.tf file. It will be wise to comment out the provider we wrote earlier so that when we call init, it ignores that one.

cd ~/terraform
touch main.tf

Next, we open main.tf in a text editor and add a block for terraform, provider & the resource we are creating

vim main.tf
s3-bucket

Our objective for this exercise is to make sure that an s3 bucket defined in the main.tf file is created in our aws console.

terraform init
terraform-init1
init
terraform plan
how to install terraform on Linux-plan
how to install terrafoam on Linux-plan
plan
terraform apply
how to install terraform-apply-completed-1
apply
how to install terraform on Linux-created
console output

Meanwhile, we can see from the screenshot above, the deployment was successful. Let’s try something else that is interesting, to show you that terraform is cloud agnostic. Thus, we shall be using terraform to create a resource group in Azure.

The steps as are shown below, you will use the Azure CLI tool to authenticate with Azure.

Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi
az login
mkdir terraform && cd $_
code main.tf
code main.tf will take your directly to visual studio code. When you are there just past the code
provider "azurerm" {
version = "1.38.0"
}
#create resource group
resource "azurerm_resource_group" "rg" {
name = "rg-MyFirstTerraform"
location = "westus"
tags = {
Environment = "Terraform Demo"
}
}
how to install terraform on Linux-terraform-tda

Terraform Plan

how to install terraform on Linux-terraform-planazure
terraform plan

Approve Terraform

how to install terraform-apply-completed

let’s check the azure platform for the resource group that we deployed with terraform. For instance, you can see that the ID matches that of the one in Visual studio code

how to install terraforn on Linux-deploy-resource
console output

Summary

Installing Terraform on any system is not difficult, whether it’s aws or azure you are deploying to, the steps are same. In this guide I walked you through how to install Terraform on Linux and how to create your directory and config files before initializing , I deployed to AWS and also deployed to Azure.

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
Linux

Post navigation

Previous Post: How to install Apache Tomcat on Ubuntu
Next Post: How to Install a Windows Server Container Host

Related Posts

  • SystemUtilization
    Delivering System Utilization Report on a Linux based OS Linux
  • Devolusion RDM update e1784558877194
    Action required: Update Devolutions Remote Desktop Manager Before July 21 Linux
  • GitLab 1
    How to Setup GitLab Runner on WSL Linux
  • featurekube
    How to Install and Use Minikube on a Linux System Containers
  • dns
    How to setup a cache-only DNS server Linux
  • Edge
    Install Microsoft Edge Browser on Ubuntu Linux Linux

More Related Articles

SystemUtilization Delivering System Utilization Report on a Linux based OS Linux
Devolusion RDM update e1784558877194 Action required: Update Devolutions Remote Desktop Manager Before July 21 Linux
GitLab 1 How to Setup GitLab Runner on WSL Linux
featurekube How to Install and Use Minikube on a Linux System Containers
dns How to setup a cache-only DNS server Linux
Edge Install Microsoft Edge Browser on Ubuntu Linux Linux

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

vexpert-badge-stars-5

Virtual Background

VEEAMLEGEND

Categories

veeaam100

Veeam Vanguard

  • ADV Guide 1 e1782748488737
    Azure Virtual Desktop: Deploy host pools and session hosts in the Azure [Part 01] AWS/Azure/OpenShift
  • How to upgrade to SQL Server 2025
    SQL Server 2025 Upgrade Requirements and Compatibility Oracle/MSSQL/MySQL
  • veeam
    Install Veeam Backup And Replication With Dedicated SQL Server Backup
  • Windows11
    How to change Regional Settings for all users on Windows 11 Windows
  • Screenshot 2020 06 25 at 23.38.40
    What is Registry Editor and how to access the registry hives Windows
  • ADV Banner 6 1 e1782749865809
    How to implement Azure Private Link for Azure Virtual Desktop [Part 06] AWS/Azure/OpenShift
  • images 5
    IP Address UNREACHABLE: HTTP connection pool Max exceeded Configuration Management Tool
  • any
    Install AnyDesk on Windows for remote Connections Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,759 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Contact
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon
  • Bsky

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.