Table of Contents
In this article, i will take you through the steps to install terraform on Ubuntu 18. Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision a datacenter infrastructure using a high-level configuration language known as Hashicorp Configuration Language, or optionally JSON.
Install Terraform on Ubuntu
Prerequisite
Before going through the steps to install terraform on ubuntu make sure you have wget and unzip tool installed in your system. If it is not there, use below command to download it from repository.
root@ubuntu:~#apt-get install wget unzip
Step 1: Update the System
First you need to update the system using apt-get update command.
root@ubuntu:~# apt-get update
Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://ppa.launchpad.net/ansible/ansible/ubuntu bionic InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done
Step 2: Download Terraform Package
Once system is updated, you need to download the latest terraform package using wget.
root@ubuntu:~# wget https://releases.hashicorp.com/terraform/0.12.17/terraform_0.12.17_linux_amd64.zip
--2019-12-09 02:51:22-- https://releases.hashicorp.com/terraform/0.12.17/terraform_0.12.17_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.157.183, 2a04:4e42:25::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.157.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16494567 (16M) [application/zip]
Saving to: ‘terraform_0.12.17_linux_amd64.zip’
terraform_0.12.17_linux_amd64.zip 100%[=====================================================================================>] 15.73M 6.85MB/s in 2.3s
2019-12-09 02:51:24 (6.85 MB/s) - ‘terraform_0.12.17_linux_amd64.zip’ saved [16494567/16494567]
Step 3: Unzip the File
Once the file is downloaded, unzip the terraform package into /usr/local/bin.
root@ubuntu:~# unzip terraform_0.12.17_linux_amd64.zip -d /usr/local/bin/
Archive: terraform_0.12.17_linux_amd64.zip
inflating: /usr/local/bin/terraform
Step 4: Check if it is installed or not
After successfully installing the package, check the Terraform version.
root@ubuntu:/usr/local/bin# terraform -v
Terraform v0.12.17
Congratulations!!!! You have successfully installed Terraform on Ubuntu.
Also Read: How to install Docker on CentOS 7
Reference: Terraform Documentation