This post will be focused on download and install Terraform Open source package, and later on, post-installation configurations and pre-requisites required for Terraform. I am not creating something new, to be honest with you, this information is readily available on hashicorp website. Hence I have embedded the link to download the Terraform package and there is the perfect video describing how to do the installation on various operating systems. I would like to emphasize here the operating system support by Terraform package.
Following OS supported by Terraform OSS Package. Link to download package.
32 Bit | 64 Bit | ARM | |
Mac OS X | Yes | Yes (ARM64) | |
Windows | Yes | Yes | |
Free BSD (OpenSource Unix based OS | Yes | Yes | Yes |
Linux | Yes | Yes | Yes (ARM64) |
Open BSD (Security focused Unix based Server based OS) | Yes | Yes | |
Solaris | Yes |
The Video below describes the installation process.
Install Terraform | Terraform – HashiCorp Learn
Post Install Configuration
I assume the video was useful and you must have successfully installed the Terraform Package. Once you have done so you might need to configure environment variables for Terraform to function from terminal/cmd/shell. Adding environment variables is easy and it’s one time run. I assume the system on which you are planning to install and use Terraform is connected to the internet, however, there are such cases where systems don’t have internet access, in that case, there is a separate method to follow called “Air-Gapped” installation method.
Windows OS
I assume you must have used “Chocolatey” for the automated installation of Terraform on Windows OS, however, there is a manual way as well in which, you will be downloading the package and copying the “Terraform executable” in the desired location and configure the environment variable for that. If you have opted for the second option then please add the below environment variable and check the functionality by typing “terraform -help” or “terraform –version”
setx PATH "location of the terraform executable"
Linux
If you are installing on RHEL or Fedora, then there is one pre-requisite to be installed if you use yum to resolve the dependency. (Reference: Link)
yum install -y yum-utils
yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
yum -y install terraform
terraform -help
If you have downloaded the Linux zip package then run the command
yum install unzip
unzip terraform.zip (This is the .zip package reference)
# The env commmand will show what are the current environment variable patch configuration already set in your Linux OS, however you can create a new. But if you dont want to create a new then simply unzip the terraform in /usr/local/bin/ by running the command unzip terraform.zip -d /usr/local/bin/
£ In case you need to create a new environment variable then use the command export TERRAFORM_HOME="/path/to/terraformfile"
MAC OS
I assume you must have used “HomeBrew” for the automated installation of Terraform on MAC OS, however, the manual way is the same as you followed for Linux.
This completes the installation of terraform open-source package and configuration.