There is a new version of this tutorial available for Ubuntu 22.04 (Jammy Jellyfish).

How to Install Terraform on Ubuntu 18.04 LTS

This tutorial exists for these OS versions

On this page

  1. Install Terraform
  2. Links

Terraform is an open-source infrastructure automation tool created by HashiCorp. It's written in the Go programming language. It allows you to define and describe your infrastructure as code inside configuration files using a declarative language and to deploy and manage that infrastructure across a variety of public cloud providers like AWS, GCP, Azure, etc.

The basic workflow when using Terraform is:

1. Write configuration files on your computer in which you declare the elements of your infrastructure that you want to create.
2. Tell Terraform to analyze your configurations and then create the corresponding infrastructure.

This tutorial will explain how to install Terraform on Ubuntu 18.04.

Install Terraform

Terraform is very easy to install. You can download Terraform from the Terraform download page. Select the appropriate package for your operating system and architecture, unzip the archive and move the binary to a directory included in your PATH variable.

First, create ~/bin directory:

mkdir ~/bin

On Ubuntu, if you create this directory it will automatically be added to your PATH.

Next, download the zip archive. Visit the Terraform download page for the latest version to download.

wget https://releases.hashicorp.com/terraform/0.12.24/terraform_0.12.24_linux_amd64.zip

Unzip the archive. The archive will extract a single binary called terraform.

unzip terraform_0.12.24_linux_amd64.zip

Move the terraform binary to a directory included in your system's PATH in our case that's ~/bin directory.

mv terraform ~/bin

To check whether Terraform is installed, run:

terraform version
# Terraform v0.12.24

The best place to learn how to use Terraform, deploy and manage your infrastructure is Terraform docs. There are a lot of providers you can manage with it.

Share this page:

2 Comment(s)