How to Install Terraform on AlmaLinux 8 - Complete Step-by-Step Guide
Step-by-step guide to install Terraform on AlmaLinux 8. Install HashiCorp Terraform using yum, verify the installation, and configure your first project.
Terraform
Step-by-step guide to install Terraform on AlmaLinux 10. Install HashiCorp Terraform using dnf, verify the installation, and configure your first project.
Terraform is the industry-standard Infrastructure as Code (IaC) tool for provisioning and managing cloud resources. This guide shows you how to install Terraform on AlmaLinux 10 in under 5 minutes.
Before you begin, make sure you have:
HashiCorp provides official packages for major Linux distributions. Using the official repository ensures you always get the latest stable version with security updates.
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager addrepo --from-repofile=https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo dnf install terraformAfter installation, verify that Terraform is available:
terraform -versionYou should see output similar to:
Terraform v1.12.x
on linux_amd64Enable shell autocompletion for faster workflow:
terraform -install-autocompleteRestart your shell or run source ~/.bashrc to activate.
If you prefer not to use a package manager, you can download the binary directly:
# Download the latest version
TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | grep -oP '"current_version":"\K[^"]+')
wget "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
# Extract and install
unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
sudo mv terraform /usr/local/bin/
rm "terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
# Verify
terraform -versiontfenv lets you install and switch between multiple Terraform versions:
git clone --depth=1 https://github.com/tfutils/tfenv.git ~/.tfenv
echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
tfenv install latest
tfenv use latest
terraform -versionCreate your first configuration:
mkdir ~/terraform-demo && cd ~/terraform-demoCreate main.tf:
terraform {
required_providers {
local = {
source = "hashicorp/local"
version = "~> 2.0"
}
}
}
resource "local_file" "hello" {
content = "Hello from Terraform on AlmaLinux 10!"
filename = "${path.module}/hello.txt"
}Run:
terraform init
terraform plan
terraform apply -auto-approve
cat hello.txtsudo dnf upgrade terraformsudo dnf remove terraformwhich terraform
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcsudo chmod +x /usr/local/bin/terraform# Re-add the repository and refresh keysYou've successfully installed Terraform on AlmaLinux 10. With Terraform, you can now define, provision, and manage infrastructure across AWS, Azure, GCP, and 3,000+ providers.
Install Terraform on other Linux distributions:
Step-by-step guide to install Terraform on AlmaLinux 8. Install HashiCorp Terraform using yum, verify the installation, and configure your first project.
Step-by-step guide to install Terraform on AlmaLinux 9. Install HashiCorp Terraform using dnf, verify the installation, and configure your first project.
Step-by-step guide to install Terraform on Alpine Linux. Install HashiCorp Terraform using apk, verify the installation, and configure your first project.
Step-by-step guide to install Terraform on Amazon Linux 2023. Install HashiCorp Terraform using dnf, verify the installation, and configure your first project.