Terraform : Installation

To install Terraform, find the appropriate package for your system and download it.

Terraform is packaged as a zip archive. After downloading Terraform, unzip the package.

URI : https://www.terraform.io/downloads.html

Install wget package to download files and install unzip to extract the files from zip files. 

Ubuntu :

$ sudo apt-get install wget unzip -y

CentOS :

$ sudo yum install wget unzip -y

 

Download the terraform archive and extract the terraform binary.

$ export VERSION="0.11.10"
$ wget https://releases.hashicorp.com/terraform/${VERSION}/terraform_${VERSION}_linux_amd64.zip
$ unzip terraform_${VERSION}_linux_amd64.zip
$ ls
terraform terraform_0.11.10_linux_amd64.zip
$ rm terraform terraform_0.11.10_linux_amd64.zip

Terraform runs as a single binary named terraform. 

$ terraform 
Usage: terraform [-version] [-help] <command> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
.......
.........

To make terraform accessible to everyone, move terraform binary to /usr/local/bin/.

$ sudo mv terraform /usr/local/bin/

Exit from the terminal and re-login to verify.

$ terraform -v
Terraform v0.11.10

Your version of Terraform is out of date! The latest version
is 0.11.11. You can update by downloading from www.terraform.io/downloads.html