Skip to content

Install Terraform in Ubuntu/Debian

In this post let’s discuss how to install Terraform in Ubuntu / Debian operating systems. HashiCorp is the company who develops and maintains Terraform packages. We can install Terraform using popular package managers after adding Hashicorp’s key and repository for Terraform.


Add the HashiCorp GPG Key

> curl -fsSL | sudo apt-key add -
[sudo] password for anand: 

Add the HashiCorp Linux repository.

>sudo apt-add-repository "deb [arch=amd64] $(lsb_release -cs) main"

Hit:1 stable InRelease
Hit:2 focal InRelease                                                                                                                                                  
Get:3 focal InRelease [4,419 B]                                                                                                                                         
Hit:4 stable InRelease                                                                                                 
Hit:5 focal InRelease                             
Get:6 focal-security InRelease [107 kB]        
Get:7 focal/main amd64 Packages [11.7 kB]                
Get:8 focal-security/main amd64 DEP-11 Metadata [24.3 kB]
Get:9 focal-security/universe amd64 DEP-11 Metadata [55.7 kB]
Hit:10 focal InRelease                       
Get:11 focal-updates InRelease [111 kB]
Get:12 focal-updates/main amd64 DEP-11 Metadata [209 kB]                                                                                                                  
Get:13 focal-updates/universe amd64 DEP-11 Metadata [200 kB]                                                                                                              
Fetched 723 kB in 10s (72.7 kB/s)                                                                                                                                                                          
Reading package lists... Done

Update apt-get and install terraform

> sudo apt-get update && sudo apt-get install terraform
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 61 not upgraded.
Need to get 34.9 MB of archives.
After this operation, 85.5 MB of additional disk space will be used.
Get:1 focal/main amd64 terraform amd64 0.13.4 [34.9 MB]
Fetched 34.9 MB in 5min 25s (107 kB/s)                                                                                                                                                                     
Selecting previously unselected package terraform.
(Reading database ... 249652 files and directories currently installed.)
Preparing to unpack .../terraform_0.13.4_amd64.deb ...
Unpacking terraform (0.13.4) ...
Setting up terraform (0.13.4) ...

Validate installation

> terraform -v
Terraform v0.13.4


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.