Install terraform on CentOS 7.5

Install terraform on CentOS 7.5

Terraform is an infrastructure as code software by HashiCorp.

It is a tool for building, changing, and versioning infrastructure in efficient way.

Terraform supports many providers from Azure, AWS, Google to OpenStack, Docker and many more.


1 Download Terraform

Go to terraform download page and copy link address for Linux 64-bit:

https://releases.hashicorp.com/terraform/0.11.8/terraform_0.11.8_linux_amd64.zip

Then in CentOS download terraform package:

$ curl https://releases.hashicorp.com/terraform/0.11.8/terraform_0.11.8_linux_amd64.zip
--output terraform_0.11.8_linux_amd64.zip

Unpack the package:

$ unzip terraform_0.11.8_linux_amd64.zip


2 Install Terraform

Copy terraform whatever you want. For example it could be in $HOME/apps, where $HOME is your home directory /home/username

Set the PATH to point to terraform application.

Edit .bash_profile file and add terraform folder in the PATH: $HOME/apps

# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$HOME/apps
export PATH

Now execute the content of the .bash_profile file:

$ source .bash_profile

Remove the zip file:

$ rm -fR terraform_0.11.8_linux_amd64.zip


3 Verifying the installation

Check version installed:

$ terraform -v
Terraform v0.11.8

Run command:

$ terraform

Usage: terraform [-version] [-help] <command> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you’re just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.

Common commands:
apply Builds or changes infrastructure
console Interactive console for Terraform interpolations
…

Leave a Reply