
If you want to install Terraform on Fedora, you have come to the right place. Terraform is an open-source Infrastructure-as-Code (IaC) tool developed by HashiCorp that lets you define, provision, and manage cloud infrastructure using simple declarative configuration files. Unlike Fedora’s default package repositories, Terraform is not bundled with the standard dnf package list — so you need to follow specific steps to get it running correctly on your system.
In this guide, you will learn three proven methods to install Terraform on Fedora: using the official HashiCorp DNF repository, installing the binary manually, and using the Snap package manager. Each method suits a different use case, from production servers to local development environments. By the end of this article, you will have a fully working Terraform installation and be ready to provision your first cloud resource.
✅ Tested on: Fedora 40, 41, and 42 | Terraform version: v1.13.x | Last updated: February 2026
What Is Terraform and Why Use It on Fedora?
Terraform is one of the most widely adopted IaC tools in the DevOps ecosystem. It allows teams to manage infrastructure across multiple cloud providers — including AWS, Google Cloud, and Azure — using a single unified workflow. Instead of clicking through cloud dashboards manually, you write .tf configuration files and let Terraform handle provisioning automatically.
Fedora is a natural choice for DevOps engineers because it runs on a cutting-edge Linux kernel and ships with modern tooling. However, because Terraform is a third-party commercial tool, you must add HashiCorp’s official repository before you can install it. This guide walks you through every step of that process clearly and accurately.
Prerequisites
Before you install Terraform on Fedora, make sure your system meets the following requirements:
- A Fedora workstation or server (Fedora 40, 41, or 42 recommended)
- A user account with
sudoprivileges or root access - An active internet connection
- The following packages installed:
curl,wget,unzip, anddnf-plugins-core
You can install all required packages in one command:
sudo dnf install -y curl wget unzip dnf-plugins-core
⚠️ Important note for Fedora 40 and 41 users: A known compatibility issue exists between the HashiCorp repo’s
$releasevervariable and newer Fedora releases. This guide includes a fix for this issue in the troubleshooting section below.
Method 1: Install Terraform on Fedora via HashiCorp DNF Repository
This is the recommended method to install Terraform on Fedora. It connects your system directly to HashiCorp’s official RPM repository, which means you always receive the latest stable release and can update Terraform with a single dnf command.
Step 1 — Install DNF Plugins Core
First, install the dnf-plugins-core package if you have not done so already. This package provides the config-manager command that you will use in the next step.
sudo dnf install -y dnf-plugins-core
Step 2 — Add the HashiCorp Repository
Next, add the official HashiCorp RPM repository to your system’s package sources. This step points dnf to HashiCorp’s servers so it can download Terraform directly.
sudo dnf config-manager addrepo \
--from-repofile=https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
After running this command, you can verify the repository was added by checking:
sudo dnf repolist | grep hashicorp
You should see hashicorp listed in the output.
Step 3 — Install Terraform
Now update your package cache and install Terraform:
sudo dnf update -y
sudo dnf install terraform -y
The installation process will download the Terraform binary, verify its GPG signature, and place it in your system’s PATH automatically.
Step 4 — Verify the Installation
After installation completes, confirm that Terraform works correctly by running:
terraform --version
Expected output:
Terraform v1.13.0
on linux_amd64
If you see a version number, your installation is successful. Congratulations — you have successfully installed Terraform on Fedora using the official HashiCorp repository.
Method 2: Install Terraform on Fedora Manually via Binary
You should use this method when you need a specific version of Terraform, work in an air-gapped environment, or simply prefer not to add third-party repositories to your system. This approach downloads the official pre-compiled binary directly from HashiCorp’s release server.
Step 1 — Fetch the Latest Terraform Version Number
Run the following command to automatically detect the latest release version:
TER_VER=$(curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest \
| grep tag_name | cut -d: -f2 | tr -d \"\,v | awk '{$1=$1};1')
echo $TER_VER
This stores the version number in the TER_VER variable for use in the next step.
Step 2 — Download the Terraform ZIP Archive
Use wget to download the binary ZIP file for your architecture. Most modern Fedora systems run on linux_amd64:
wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip
If you are running Fedora on an ARM-based machine, replace linux_amd64 with linux_arm64.
Step 3 — Unzip and Move the Binary
Extract the archive and move the Terraform binary to /usr/local/bin/ so it is accessible system-wide:
unzip terraform_${TER_VER}_linux_amd64.zip
sudo mv terraform /usr/local/bin/
sudo chmod +x /usr/local/bin/terraform
💡 Expert tip: The
/usr/local/bin/directory is the standard location for manually installed binaries on Linux. Placing Terraform here means any user on the system can run it without modifying$PATH.
Step 4 — Verify the Installation
Run the version check again to confirm the manual installation works:
terraform --version
You should see the version number matching the one you downloaded.
Method 3: Install Terraform on Fedora via Snap
The Snap method is the easiest and fastest way to install Terraform on Fedora, especially for desktop users. However, keep in mind that Snap packages sometimes lag slightly behind the official HashiCorp release cycle, so this method is not ideal for production environments.
Step 1 — Install Snapd
Fedora does not ship with Snap enabled by default. First, install and enable the Snap daemon:
sudo dnf install snapd -y
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
Log out and back in — or reboot — to ensure Snap’s paths are correctly initialized.
Step 2 — Install Terraform via Snap
sudo snap install terraform
Step 3 — Verify the Installation
terraform --version
⚠️ Note: Snap packages run in a confined sandbox, which may cause issues with certain Terraform providers that need access to system-level credentials or files. Use Method 1 for production workloads.
Post-Installation: Running Your First Terraform Commands
After you install Terraform on Fedora, it is a good idea to run a quick functional test. Create a new working directory and initialize it:
mkdir ~/terraform-test && cd ~/terraform-test
terraform init
Terraform should respond with:
Terraform initialized in an empty directory!
Here are the five core Terraform commands you will use most often:
terraform init— Initializes a working directory and downloads provider pluginsterraform plan— Shows a preview of what Terraform will create, modify, or destroyterraform apply— Executes the planned changes and provisions your infrastructureterraform destroy— Tears down all resources defined in your configurationterraform fmt— Automatically formats your.tffiles to follow canonical style
Additionally, you can enable shell auto-completion for Terraform by running:
terraform -install-autocomplete
This significantly speeds up your workflow when writing configuration files in the terminal.
How to Update Terraform on Fedora
Keeping Terraform up to date is important for security patches, new provider compatibility, and access to the latest language features. The update process depends on which installation method you used:
- DNF repository:
sudo dnf update terraform - Manual binary: Repeat the download and move steps with the new version number
- Snap:
sudo snap refresh terraform
HashiCorp releases new Terraform versions regularly. You can monitor new releases on the official HashiCorp changelog.
Troubleshooting Common Installation Issues
Even experienced engineers encounter issues when they install Terraform on Fedora for the first time. The following table covers the most common problems and their fixes:
| Problem | Likely Cause | Solution |
|---|---|---|
No match for argument: terraform |
HashiCorp repo not added correctly | Re-run the config-manager addrepo step |
| Repo failure on Fedora 40/41 | $releasever variable mismatch |
Run sudo sed -i 's/$releasever/38/g' /etc/yum.repos.d/hashicorp.repo |
terraform: command not found |
Binary not in system $PATH |
Move binary to /usr/local/bin/ or update ~/.bashrc |
| GPG key verification failed | Missing or expired HashiCorp GPG key | Run sudo rpm --import https://rpm.releases.hashicorp.com/gpg |
| Snap sandbox errors | Provider needs system-level access | Switch to Method 1 (DNF repo) instead |
Fix: Fedora 40/41 Repository $releasever Mismatch
This is one of the most frequently reported issues. When HashiCorp’s .repo file uses $releasever to construct the repository URL, newer Fedora versions sometimes resolve to an unsupported value. To fix this, manually pin the release version to 38:
sudo sed -i 's/$releasever/38/g' /etc/yum.repos.d/hashicorp.repo
sudo dnf update -y
sudo dnf install terraform -y
This workaround forces dnf to use a compatible repository URL while HashiCorp updates their official Fedora support.
Which Installation Method Should You Choose?
Choosing the right installation method depends on your specific use case. Here is a quick guide to help you decide:
- Production servers or CI/CD pipelines: Use Method 1 (DNF repository) — it provides automatic security updates, GPG-verified packages, and is officially supported by HashiCorp
- Specific version requirements or air-gapped systems: Use Method 2 (Manual binary) — gives you full control over exactly which version is installed
- Quick local development on a desktop: Use Method 3 (Snap) — the fastest setup with minimal configuration, though not recommended for production
For most Fedora users, Method 1 is the best choice. It keeps Terraform up to date automatically and integrates cleanly with Fedora’s native package management system.