We have seen a tremendous increase in demand for automation in the IT industry & IaaC, Infrastructure as a Code is a must-needed skill to possess. There are a number of tools available for Automation/IaaC & Terraform is one such tool.

Terraform is a great tool for automating our infrastructure by converting all our infrastructure as code. We can deploy resources using only the terraform scripts. The great thing about terraform is that it supports almost all cloud providers like AWS, GCP, Azure, IBM Cloud, etc & also supports in-house solutions.

So why do we need to use Terraform?

• With the help of terraform’s configuration file, we can provision a single machine or a complete data center. Not only can provision instances, but we can also make changes related to networking, DNS, SaaS, etc.
• Terraform recognizes incremental changes, so we don’t need to make incremental changes separately, edit the existing configuration file & run the commands. It will identify the incremental changes & will then provision them.
• A single tool can make changes to a number of service providers, so no need to learn cloud formation, Google cloud deployment manager, etc.

In this tutorial, we will learn how to install Terraform on Linux systems (Ubuntu, Debian, popOS, CentOS, RHEL, Fedora, etc).

Recommended Read: Guide to install Ansible on Ubuntu

Also Read: Create your first automation setup: Install Ansible server


Install Terraform


Note:- Version 1.0.1 of the Terraform is now available in stable release & can be downloaded from the link HERE. The process for installation is the same as mentioned here.

So to install Terraform is pretty simple, we only need to have ‘wget’ installed on our systems to download the terraform package. Download the 64-bit package for Linux using the following command,

$ wget https://releases.hashicorp.com/terraform/0.13.1/terraform_0.13.1_linux_amd64.zip

install terraform on linux

There are packages available for Windows, Mac, Solaris, etc & also 32 bit Linux packages HERE.

Once downloaded, unzip & move it to a separate directory,

$ unzip terraform_0.13.1_linux_amd64.zip
$ mkdir ~/App
$ mv terraform ~/App

install terraform on linux

Now the next thing is to set up the PATH for the terraform folder into our user’s bash profile ( ~/.bash_profile in CentOS/RHEL, ~/.profile in Debian/Ubuntu). To create the PATH entry, open the respective file & make the following entry into the file,

export PATH
export PATH = “$PATH:~/App”

install terraform on linux

Now save the file & run the following command to implement the changes made to the file,

$ source ~/bash_profile

You can also log out & log back in to implement the changes. That’s it, we now have the terraform command installed & ready to use. To make sure that it is working fine, run the following command,

$ terraform

& we should get the following output,

install terraform on linux

That’s it for this tutorial on how to install Terraform on Linux machines. In our next tutorials, we will discuss about the commands that are used more frequently with terraform & also how we can create resources using terraform.

We are giving you exclusive deals to try Linux Servers for free with 100$ credit, check these links to claim your 100$,

DigitalOcean - 100$ free credit & Linode - 100$ free credit

Check some Exclusive Deals, HERE.

Also, check out DevOps Book You should read section.