Skip to content
Follow
Ubuntu Linux

How to Install Terraform on Ubuntu Linux

Richard
Written by
Richard
Oct 5, 2023 Updated Jul 13, 2026 3 min read
How to Install Google Chrome on Ubuntu Linux
How to Install Google Chrome on Ubuntu Linux

Terraform on Ubuntu Linux lets you manage your computer infrastructure using code. This means you can define and set up things like servers and networks with simple text files.

Terraform is a free tool that automates building, changing, and keeping track of your computer resources. It’s not typically found in Ubuntu’s standard software collection.

To install Terraform on Ubuntu, you need to follow specific steps. You can add it using its official source or install it as a Snap package. Just trying to run `sudo apt install terraform` usually won’t work and will show an error like “Unable to locate package.” Using the official source ensures you get the latest version, for example, Terraform 1.7.0.

⚡ Quick Answer

Install Terraform on Ubuntu using Snap with `sudo snap install terraform –classic`, or by adding HashiCorp’s official repository and then running `sudo apt update && sudo apt install terraform`. Verify the installation with `terraform -version`.

Install Terraform on Ubuntu Linux via Snap

Installing Terraform on Ubuntu Linux using Snap is a fast and simple way to get the latest version.

Snap is a package management system developed by Canonical for Linux operating systems. It allows developers to easily distribute and update their software on different Linux distributions without worrying about compatibility issues.

To install Tarraform using Snap, run the command below.

🐧Bash / Shell
sudo snap install terraform --classic

When you want to remove Terraform, run the command below.

🐧Bash / Shell
sudo snap remove terraform

Install Terraform via its official repository

Installing Terraform on Ubuntu Linux from HashiCorp’s official repository ensures you get reliable updates straight from the source.

📝Good to Know
First, run the command below to install prerequisites.
🐧Bash / Shell
sudo apt install gnupg software-properties-common

When you are done, run the command below to install HashiCorp’s GPG key to your system.

💻Code
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg

Once the GPG key is installed, verify it using the command below.

💻Code
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint

The command above will display the key details similar to the lines below:

💻Code
#Output:
pub   rsa4096 2023-01-10 [SC] [expires: 2028-01-09]
      798A EC65 4E5C 1542 8C8E  42EE AA16 FCBC A621 E701
uid           [ unknown] HashiCorp Security (HashiCorp Package Signing) <security+packaging@hashicorp.com>
sub   rsa4096 2023-01-10 [S] [expires: 2028-01-09]

After that, run the command below to install the repository file on your system.

Command Prompt
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list

Finally, update the install Terraform.

🐧Bash / Shell
sudo apt update
sudo apt install terraform

You can verify that Terraform is installed by running the command below.

💻Code
terraform -version
💻Code
#Output:
Terraform v1.6.0
on linux_amd64

Remove it using the command below.

🐧Bash / Shell
sudo apt remove terraform

That should do it!

Conclusion:

  • Terraform is a powerful open-source infrastructure as code (IAC) tool for managing infrastructure resources.
  • Ubuntu users can install Terraform using the Snap package manager or HashiCorp’s official repository.
  • Installing Terraform on Ubuntu enables easy management and creation of various infrastructure resources such as VMs, network switches, and containers.
  • Users can verify the successful installation of Terraform by running the command “terraform -version” in the terminal.

How to check if Terraform is installed in Ubuntu?

How do I check if Terraform is installed on my system? You can run terraform –version in your terminal or command prompt to see if Terraform is installed and view the installed version.

Do you have to install Terraform?

To use Terraform, you first need to install it. HashiCorp distributes Terraform as a binary package. You can also install Terraform using popular package managers.

Is Terraform GUI or CLI?

Terraform is CLI-driven by default, which can be challenging for teams managing large-scale infrastructure or enforcing organizational policies.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04

No comments yet — be the first to share your thoughts!

Leave a Comment

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