How to install Terraform on Ubuntu 22.04 LTS

Introduction

Terraform is a infrastructure as code that is free and open-source. It offers a consistent CLI workflow for managing hundreds of cloud services. Declarative configuration files are created by Terraform by codifying cloud APIs.

We will learn how to install Terraform on Ubuntu 22.04 in this tutorial.

Step 1: Update the System

Start by making sure your system repositories are up to date. Run system updates with the following command.

sudo apt-get update
sudo apt-get upgrade -y 

Step 2: Install Terraform Dependencies

Using the following command, install the software-properties-common, GnuPG, and curl dependencies on your system.

sudo apt-get install gnupg software-properties-common curl -y

Step 3: Adding Terraform Repository and GPG Key

The Hashicorp GPG key integration is the next step. We will use the curl command that we installed earlier to install.

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -

Now we need to add the Hashicorp repository to our system repositories to inform our system where to obtain installation packages. We need to use the following command to add repositories.

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

Step 4: Install Terraform 

We are now able to carry out terraform installation with ease after meeting all of the prerequisites. On the terminal, run the following command.

sudo apt-get update 
sudo apt-get install terraform -y

Step 5: Check Terraform Version

We need to execute the given command to get terraform version.

terraform -v 

Conclusion

We have successfully install terraform on ubuntu 22.04 LTS, if you still have questions, please post them in the comments section below.

Author

How to install Terraform on Ubuntu 22.04 LTS

One thought on “How to install Terraform on Ubuntu 22.04 LTS

Leave a Reply

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

Scroll to top