Cyberithub

How to install Terraform on CentOS/RedHat 7 with Best Example

Advertisements

In this article, i will take you through the steps to install terraform on CentOS/RedHat 7. Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision a datacenter infrastructure using a high-level configuration language known as Hashicorp Configuration Language, or optionally JSON.

I have already covered How to install terraform on Ubuntu 18.04 in the previous article. Here we will see how to install terraform on CentOS/RedHat 7.

Advertisements

Install Terraform on CentOS/RedHat 7

Before going through the steps to install terraform on CentOS, you need to make sure to have prerequisites in place.

Prerequisites

Make sure you have wget and unzip tool installed in your system. If you don't have then you can download from below command.

Advertisements
[root@localhost ~]# yum install wget unzip

How to install Terraform on CentOS/RedHat 7 with Best Example 1

Step 1: Update the System

First you need to update your system by using yum update command.

[root@localhost ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 9.0 kB 00:00
* base: centos.excellmedia.net
* epel: kartolo.sby.datautama.net.id
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
base | 3.6 kB 00:00
epel | 5.3 kB 00:00
extras | 2.9 kB 00:00
kubernetes/signature | 454 B 00:00
kubernetes/signature | 1.4 kB 00:00 !!!
puppetlabs-pc1 | 2.5 kB 00:00
updates | 2.9 kB 00:00
(1/2): epel/x86_64/updateinfo | 1.0 MB 00:01
(2/2): epel/x86_64/primary_db | 6.9 MB 00:02
Resolving Dependencies
--> Running transaction check
---> Package ca-certificates.noarch 0:2018.2.22-70.0.el7_5 will be updated
---> Package ca-certificates.noarch 0:2019.2.32-76.el7_7 will be an update
---> Package curl.x86_64 0:7.29.0-54.el7 will be updated
---> Package curl.x86_64 0:7.29.0-54.el7_7.1 will be an update
---> Package epel-release.noarch 0:7-11 will be updated
---> Package epel-release.noarch 0:7-12 will be an update
---> Package iproute.x86_64 0:4.11.0-25.el7 will be updated
---> Package iproute.x86_64 0:4.11.0-25.el7_7.2 will be an update
---> Package kernel.x86_64 0:3.10.0-1062.9.1.el7 will be installed
---> Package kernel-tools.x86_64 0:3.10.0-1062.4.3.el7 will be updated
---> Package kernel-tools.x86_64 0:3.10.0-1062.9.1.el7 will be an update
---> Package kernel-tools-libs.x86_64 0:3.10.0-1062.4.3.el7 will be updated
---> Package kernel-tools-libs.x86_64 0:3.10.0-1062.9.1.el7 will be an update

........................................................................................................................................................

Step 2: Download Terraform Package

Then you need to download the latest version of Terraform package.

Advertisements
[root@localhost ~]# wget https://releases.hashicorp.com/terraform/0.12.17/terraform_0.12.17_linux_amd64.zip
--2019-12-08 17:35:28-- https://releases.hashicorp.com/terraform/0.12.17/terraform_0.12.17_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.157.183, 2a04:4e42:25::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.157.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16494567 (16M) [application/zip]
Saving to: ‘terraform_0.12.17_linux_amd64.zip’

100%[==============================================================================================================================>] 16,494,567 6.40MB/s in 2.5s

2019-12-08 17:35:31 (6.40 MB/s) - ‘terraform_0.12.17_linux_amd64.zip’ saved [16494567/16494567]

Step 3: Unzip Package

Once downloaded you need to unzip the package on /usr/local/bin.

[root@localhost ~]# unzip terraform_0.12.17_linux_amd64.zip -d /usr/local/bin/
Archive: terraform_0.12.17_linux_amd64.zip
inflating: /usr/local/bin/terraform

Step 4: Check Terraform Version

After successfully unzipping the package, you can check the terraform version using terraform -v command.

Advertisements
[root@localhost ~]# terraform -v
Terraform v0.12.17

Congratulations!!!You have installed Terraform on CentOS 7.

Also Read: How to install Terraform on Ubuntu 18.04

Reference: Terraform Documentation

1 thought on “How to install Terraform on CentOS/RedHat 7 with Best Example”

Leave a Comment