How to Install Terraform in Linux Distributions

In this article, we will discuss what Terraform is and how to install terraform on various Linux distributions using HashiCorp repositories.

What is Terraform?

Terraform is a popular cloud orchestration tool in the world of automation, which is used to deploy your infrastructure through the IAC (Infrastructure as code) approach. Terraform is built by Hashicorp and released under Mozilla Public License. It supports public, private as well as hybrid cloud, as of now Terraform supports 145 providers, which includes popular providers like AWS, Azure cloud, GCP, Oracle cloud, and many others.

Terraform architecture is very simple. All you need is to download the terraform binary to your local/server machine which is going to act as your base machine. We have to mention the provider to work within our syntax file. Terraform will download the plugin for that particular provider automatically and will authenticate with provider API to execute the plan.

What is Infrastructure as Code?

The process of provisioning and managing resources like Virtual Machine, Storage, Network, Database, etc.. through machine-readable definition files, rather than interactive tools or hardware configurations.

  • Open-source.
  • Declarative syntax.
  • Pluggable Modules.
  • Immutable infrastructure.
  • Simple client-only architecture.

Let’s get started…

Installing Terraform in Linux Distributions

The Terraform primary distribution packages come in .zip format, which includes single executable files that you can uncompress any location on your Linux system.

However, for simpler integration with configuration management tools, terraform also offers package repositories for Debian-based and RHEL-based systems, which enables you to install Terraform using your default package management tools called APT and Yum.

Install Terraform in Debian, Ubuntu & Mint

$ curl -fsSL | sudo apt-key add -
$ sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] $(lsb_release -cs) main"
$ sudo apt update
$ sudo apt install terraform

Install Terraform in RHEL, CentOS & Fedora

$ sudo yum install -y yum-utils
$ sudo yum-config-manager --add-repo$release/hashicorp.repo
$ sudo yum update
$ sudo yum install terraform

Now the installation can be verified by running a simple terraform version command.

$ terraform version
Check Terraform Version
Check Terraform Version

That’s it for this article. The installation is very simple, easy to set up and some text editors like Atom and VSCode come with language support for terraform too.

Tutorial Feedback...
Was this article helpful? If you don't find this article helpful or found some outdated info, issue or a typo, do post your valuable feedback or suggestions in the comments to help improve this article...

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

2 thoughts on “How to Install Terraform in Linux Distributions”

  1. Thanks for the article!

    Just note when you’re installing Terraform via the CLI on Debian family distros, you have to include below command to update package.

    $ sudo apt update

    If it’s not executed you’ll see something as below:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    E: Unable to locate package terraform

    I guess the same is happening for the Red Had family distros.



Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.