Would you like to learn how to perform a Terraform installation on Ubuntu Linux? In this tutorial, we are going to show you how to install Terraform on Linux.

What is Terraform?

Terraform is an infrastructure-as-code software developed by HashiCorp and written in GO language.

It allows a user to create a configuration file that may connect to multiple cloud providers and create or update an entire infrastructure.

As an example, an administrator may create a configuration file that will automatically create 10 virtual machines using Ubuntu Linux in Amazon AWS cloud and connect to the Azure cloud and create a virtual machine running Windows.

Terraform Tutorial:

On this page, we offer quick access to a list of tutorials related to Terraform.

Tutorial - Terraform Installation

On the Linux console, use the following commands to install the required software.

# apt-get update
# apt-get install wget unzip

Access the Terraform download page and get the Linux version compatible with your environment.

Terraform Download

We are going to use the WGET command to perform the Terraform software download.

# mkdir /downloads/terraform -p
# cd /downloads/terraform
# wget https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip

After finishing the Terraform download, extract the Terraform installation package.

# unzip terraform_0.11.13_linux_amd64.zip

Archive: terraform_0.11.13_linux_amd64.zip
inflating: terraform

Install the Terraform command on Ubuntu using the following command:

# install terraform /usr/local/bin/

Verify the Terraform installation using the following commands:

# terraform -version
# terraform

You should see the following output.

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
destroy Destroy Terraform-managed infrastructure
env Workspace management
fmt Rewrites config files to canonical format
get Download and install modules for the configuration
graph Create a visual graph of Terraform resources
import Import existing infrastructure into Terraform
init Initialize a Terraform working directory
output Read an output from a state file
plan Generate and show an execution plan
providers Prints a tree of the providers used in the configuration
push Upload this Terraform module to Atlas to run
refresh Update local state file against real resources
show Inspect Terraform state or plan
taint Manually mark a resource for recreation
untaint Manually unmark a resource as tainted
validate Validates the Terraform files
version Prints the Terraform version
workspace Workspace management

All other commands:

Congratulations! You were able to install Terraform on Ubuntu Linux.

Terraform vs Ansible

Both are great products for creating infrastructure as code.

Both products can be used to deploy network environments with complex requirements.

To make a simple analogy, we could say that Ansible is an IT automation tool while using Terraform your could create a complete infrastructure using its infrastructure as a code solution, this means that you could create an entire network environment that span across multiple cloud provides like Amazon AWS, Google, Azure and others using a simple configuration file.

Here is a link to a better comparison between Terraform vs Ansible.