How to install Terraform on CentOS 8

Installing Terraform on CentOS 8 : A Step-by-Step Guide:

On this short article we will learn how to install Terraform on CentOS 8 operating system.

Introduction

Terraform is an open-source infrastructure-as-code (IaC) tool that enables users to define and provision infrastructure resources across various cloud platforms. If we are using CentOS 8 as your operating system and want to leverage the power of Terraform, this article will guide us through the installation process.

Terraform Installation Process

By following these step-by-step instructions, you’ll be ready to start managing our infrastructure with Terraform in no time.

Step 1: Update System Packages

Before installing any software, it’s always a good practice to ensure that your system is up to date. Open a terminal or connect to your CentOS 8 server via SSH and run the following command:

sudo dnf update

This will update all the installed packages to their latest versions.

Step 2: Download the Terraform Binary

Next, we need to download the Terraform binary from the official website. To do this, you can use the wget command. Run the following command to download the latest version of Terraform:

wget https://releases.hashicorp.com/terraform/<version>/terraform_<version>_linux_amd64.zip

Replace <version> with the desired version number. For example, if you want to download version 1.0.0, the command will be:

$ wget https://releases.hashicorp.com/terraform/1.5.0/terraform_1.5.0_linux_amd64.zip

Output :

ramans@otodiginet ~]$ wget https://releases.hashicorp.com/terraform/1.5.0/terraform_1.5.0_linux_amd64.zip
--2023-06-21 00:04:26-- https://releases.hashicorp.com/terraform/1.5.0/terraform_1.5.0_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 18.161.49.16, 18.161.49.22, 18.161.49.129, ...
Connecting to releases.hashicorp.com (releases.hashicorp.com)|18.161.49.16|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20957558 (20M) [application/zip]
Saving to: ‘terraform_1.5.0_linux_amd64.zip’

terraform_1.5.0_linux_amd64.zip 100%[======================================================>] 19.99M 1.02MB/s in 29s

2023-06-21 00:04:55 (717 KB/s) - ‘terraform_1.5.0_linux_amd64.zip’ saved [20957558/20957558]

Step 3: Extract the Terraform Binary

Once the download is complete, we need to extract the Terraform binary from the downloaded ZIP file. Use the following command to extract it:

unzip terraform_<version>_linux_amd64.zip

Again, replace <version> with the actual version number you downloaded. For example:

$ sudo unzip terraform_1.5.0_linux_amd64.zip

Output :

[ramans@otodiginet ~]$ sudo unzip terraform_1.5.0_linux_amd64.zip
Archive: terraform_1.5.0_linux_amd64.zip
inflating: terraform

Step 4: Move the Terraform Binary

After extracting the Terraform binary, we need to move it to a directory that is included in the system’s PATH variable so that it can be executed from anywhere on the system. Run the following command to move the binary:

sudo mv terraform /usr/local/bin/

Output :

[ramans@otodiginet ~]$ sudo mv terraform /usr/local/bin/

This command will move the binary to the /usr/local/bin/ directory.

Step 5: Verify the Installation

To verify that Terraform has been installed successfully, run the following command:

terraform version

If Terraform is installed correctly, we should see the version number displayed in the terminal output.

[ramans@otodiginet ~]$ terraform -v
Terraform v1.5.0
on linux_amd64

Congratulations! We have successfully installed Terraform on CentOS 8. You can now start using Terraform to define and manage your infrastructure resources efficiently.

Conclusion

In this article, we walked through the step-by-step process of installing Terraform on CentOS 8. By following these instructions, you have successfully set up Terraform and can now harness its capabilities to manage your infrastructure as code. Remember to regularly update Terraform to leverage the latest features and bug fixes. Enjoy exploring the possibilities that Terraform offers for automating and scaling your infrastructure!

 

(Visited 157 times, 1 visits today)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *