Here is how to install Terraform on RHEL 9. Tested and verified.
Prerequisites
- RHEL 9 installed and updated
- Root or sudo access
- Internet connection
Step 1: Update System
sudo dnf update -yStep 2: Add Official Repository
Terraform is distributed through HashiCorp’s official dnf/yum repository. Install the config-manager plugin, then register the repository before installing:
# Install the dnf config-manager plugin
sudo dnf install -y dnf-plugins-core
# Add the official HashiCorp repository for RHEL
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
# Refresh the package metadata cache
sudo dnf makecacheStep 3: Install Terraform
sudo dnf install -y terraformStep 4: Verify Installation
terraform versionExpected output should show the installed version, for example Terraform v1.x.x.
Step 5: Enable Shell Autocomplete
Terraform is a CLI binary with no background service, so there is nothing to enable or start with systemd. Instead, enable tab-completion for your shell:
terraform -install-autocompleteThis appends the completion hook to your shell profile (~/.bashrc for Bash). Restart your shell or run source ~/.bashrc for it to take effect.
Troubleshooting
GPG Key or Signature Errors
If dnf reports a GPG check failure when installing, import the HashiCorp signing key manually and retry:
sudo rpm --import https://rpm.releases.hashicorp.com/gpg
sudo dnf clean all && sudo dnf makecachePackage Not Found
Confirm the repository was registered and the metadata cache is current:
cat /etc/yum.repos.d/hashicorp.repo
sudo dnf clean all && sudo dnf makecache
dnf list terraformIf dnf list terraform returns “Error: No matching Packages to list”, the dnf config-manager --add-repo step did not complete — repeat Step 2. Note that HashiCorp’s dnf/yum repository publishes x86_64 packages only; on aarch64 RHEL installs, dnf install terraform will report no match because there is no official ARM RPM build.
Uninstall
sudo dnf remove -y terraformRelated Guides
About the Author
I am Luca Berton, AI and Cloud Advisor. Book a consultation to get help with your infrastructure setup.