Skip to content

Click on each book below to review & buy on Amazon.

As an Amazon Associate, I earn from qualifying purchases.


Installing Terraform on Linux

This guide will walk you through the steps of installing Terraform on Linux.

Red Hat Based Versions7.x | 8.x | 9.x
Ubuntu Versions18.x | 20.x | 22.x

Red Hat Based Distributions

  • Install the required packages.

    sudo yum install unzip wget -y
    
  • Download the latest Terraform package for Linux from the Terraform website. The download URL may differ depending on the version you want to install. Check Terraform's releases page for the latest version.

    if [[ $(uname -m) == "x86_64" ]]; then
      wget https://releases.hashicorp.com/terraform/1.4.6/terraform_1.4.6_linux_amd64.zip
    elif [[ $(uname -m) == "arm64" ]]; then
      wget https://releases.hashicorp.com/terraform/1.4.6/terraform_1.4.6_linux_arm64.zip
    else
      echo "Unsupported architecture"
    fi
    
  • Unzip the Terraform package.

    unzip terraform_1.4.6_linux_amd64.zip
    
  • Move the Terraform binary to the /usr/local/bin directory.

    sudo mv terraform /usr/local/bin/
    
  • Verify that Terraform has been installed successfully.

    terraform version
    

    You should see the version number of Terraform that you just installed.

Ubuntu Based Distributions

  • Update your system's package manager.

    sudo apt update
    
  • Install the required packages.

        sudo apt install unzip wget -y
    
  • Download the latest Terraform package for Linux from the Terraform website. The download URL may differ depending on the version you want to install. Check Terraform's releases page for the latest version.

    if [[ $(uname -m) == "x86_64" ]]; then
      wget https://releases.hashicorp.com/terraform/1.4.6/terraform_1.4.6_linux_amd64.zip
    elif [[ $(uname -m) == "arm64" ]]; then
      wget https://releases.hashicorp.com/terraform/1.4.6/terraform_1.4.6_linux_arm64.zip
    else
      echo "Unsupported architecture"
    fi
    
  • Unzip the Terraform package.

    unzip terraform_1.4.6_linux_amd64.zip
    
  • Move the Terraform binary to the /usr/local/bin directory.

    sudo mv terraform /usr/local/bin/
    
  • Verify that Terraform has been installed successfully.

    terraform version
    

You should see the version number of Terraform that you just installed.


Support DTV Linux

Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.

NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.