We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install Terraform on Ubuntu 22.04|20.04 |18.04

Learn how to – How To Install Terraform on Ubuntu 22.04|20.04 |18.04.

This guide will help you install Terraform on Ubuntu 22.04|20.04 |18.04. Terraform is an Infrastructure as code tool which allows you to easily manage cloud resources in a versioned manner. You use Terraform to build, change, and version infrastructure deployed on popular service providers. This tool is not cloud-agnostic and it supports custom in-house solutions.

With Terraform you can manage Cloud Compute, Networking, Load Balancers, DNS and so on using simple Declarative Programming Language. See the complete list of Terraform Providers. Complex changesets can be applied to your infrastructure with minimal human interaction

Install Terraform on Ubuntu 22.04|20.04 |18.04

Terraform is distributed as a tarball on Github. Check the latest release on Terraform releases page before downloading below.There are two methods from which we can install terraform on Ubuntu22.04|20.04 |18.04.

Method 1: Install Terraform from APT repository

Terraform team offers package repositories for Debian based Linux, which allow you to install Terraform using the apt package management tool or any other APT frontend.

First, install repository addition dependencies:

sudo apt update
sudo apt install  software-properties-common gnupg2 curl

Now import repository GPG key

curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > hashicorp.gpg
sudo install -o root -g root -m 644 hashicorp.gpg /etc/apt/trusted.gpg.d/

With the key imported now add Hashicorp repository to your Ubuntu system:

sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"

Expected execution output:

Repository: 'deb [arch=amd64] https://apt.releases.hashicorp.com jammy main'
Description:
Archive for codename: jammy components: main
More info: https://apt.releases.hashicorp.com
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_apt_releases_hashicorp_com-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-https_apt_releases_hashicorp_com-jammy.list
Hit:1 https://mirror.hetzner.com/ubuntu/packages jammy InRelease
Hit:2 https://mirror.hetzner.com/ubuntu/packages jammy-updates InRelease
Hit:3 https://mirror.hetzner.com/ubuntu/packages jammy-backports InRelease
Hit:4 https://mirror.hetzner.com/ubuntu/security jammy-security InRelease
Get:5 https://apt.releases.hashicorp.com jammy InRelease [12.0 kB]
Get:6 https://apt.releases.hashicorp.com jammy/main amd64 Packages [74.4 kB]
Fetched 86.4 kB in 1s (84.6 kB/s)
Reading package lists... Done

Now install terraform on your Ubuntu Linux system:

sudo apt install terraform

Check the version of terraform installed on your system

$ terraform --version
Terraform v1.3.7
on linux_amd64

Method 2: Install Terraform Manually

The primary distribution packages for Terraform are .zip archives containing single executable files that you can extract anywhere on your system

Ensure wget and unzip packages are installed on your Ubuntu system:

sudo apt install wget unzip -y

Then download the latest terraform archive.

TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d "

Cart

Your Cart is Empty

Back To Shop