how to install terraform in Linux : CentOS-Ubuntu

In this post we will learn how to install terraform on linux operating system. Terraform is open source infrastructure automation tool.In other words, for infrastructure as code you can use terraform. It works basically with providers like aws, azure, vmware etc. Due to hypbrid network like cloud and on premises network, terraform is playing a instrumental role.

This post will help you to set your first foundation that is installing terraform.

Installing Terraform on CentOS/RHEL system

  1. Install wget and unzip package
  2. sudo yum install wget unzip
    
  3. Download terraform package
  4. We will strongly suggest to always download and use latest package. Visit to terraform website to download terraform latest package.

    wget https://releases.hashicorp.com/terraform/0.11.8/terraform_0.11.8_linux_amd64.zip
    
  5. Unzip the downloaded package
  6. By using unzip command, it will extract one binary file called ‘terraform’

    unzip terraform_0.11.8_linux_amd64.zip 
    
  7. Copy unzipped terraform file to /usr/local/bin
  8. sudo cp terraform /usr/local/bin
    
  9. Give executable permission
  10. sudo chmod +x /usr/local/bin
    
  11. Now check terraform
  12. Because we have copied the binary file to /usr/local/bin, the terraform command is available. You can check its absolute path by using command which terraform

    The below command will show the version of terraform.

    terraform --version 
    

Installing Terraform on Ubuntu/Debian system

  1. Install wget and unzip package
  2. sudo apt-get install wget unzip
    
  3. Download terraform package
  4. Visit to terraform website and download terraform latest package.

    wget https://releases.hashicorp.com/terraform/0.11.8/terraform_0.11.8_linux_amd64.zip
    
  5. Unzip downloaded package
  6. Unzip the downloaded package.

    unzip terraform_0.11.8_linux_amd64.zip 
    
  7. Copy unzipped terraform file to /usr/local/bin
  8. sudo cp terraform /usr/local/bin
    
  9. Give executable permission
  10. sudo chmod +x /usr/local/bin
    
  11. Now check terraform
  12. Because terraform extracted file copied to /usr/local/bin, the terraform command is available. Check the absolute path by command which terraform

    Check the version of terraform by given below command.

    terraform --version