Skip to content
Follow
Ubuntu Linux

How to Install Terraform on Ubuntu Linux

Richard
Written by
Richard
Oct 5, 2023 Updated Sep 15, 2026 2 min read
How to Install Google Chrome on Ubuntu Linux
How to Install Google Chrome on Ubuntu Linux

Terraform on Ubuntu Linux is a free tool that lets you build, change, and keep track of your computer resources using simple text files instead of clicking through screens. Standard commands like sudo apt install terraform fail on Ubuntu because the tool is missing from the default software list.

Advertisement

You need to add the official software source or install it as a Snap package to get the latest release, such as 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`.

Advertisement

Install Terraform on Ubuntu Linux via Snap

You can install Terraform on Ubuntu using Snap (a software package manager that handles updates automatically) by running a single command in your terminal. This method automatically keeps your Terraform installation up to date without requiring manual downloads from the official website.

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.

Advertisement
🐧Bash / Shell
sudo snap remove terraform

Install Terraform via its official repository

You can install Terraform on Ubuntu through HashiCorp's official repository by adding their GPG key (a security code that verifies software authenticity) and setting up the software source list. This approach ensures you receive stable, direct updates using your standard system package manager.

📝Good to KnowFirst, run the command below to install prerequisites.
🐧Bash / Shell
sudo apt install gnupg software-properties-common
📝Good to KnowWhen 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.

Advertisement
💻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.

Advertisement
💻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.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

📚 Related Tutorials

How to Install Ubuntu Linux
Ubuntu Linux How to Install Ubuntu Linux
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
How to Generate and Manage GPG Keys on Ubuntu Linux
Ubuntu Linux How to Generate and Manage GPG Keys on Ubuntu Linux

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

Leave a Comment

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