In this tutorial, we will show you how to install Terraform on CentOS 8. For those of you who didn’t know, Terraform is a free and open-source Infrastructure automation tool by Hashicorp which is used to create, build and change using infrastructure as a code across various cloud providers like AWS, Azure cloud, GCP, Oracle cloud, and many others.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of Terraform on a CentOS 8.
- A server running one of the following operating systems: CentOS 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Terraform on CentOS 8
Step 1. First of all, make sure that all packages are up to date.
sudo dnf update
Step 2. Installing Terraform on CentOS 8.
Run the following command to download the latest terraform setup from Terraform official site:
wget https://releases.hashicorp.com/terraform/1.0.0/terraform_1.0.0_linux_amd64.zip sudo unzip terraform_1.0.0_linux_amd64.zip
Next, move the extracted setup to
sudo mv terraform /usr/local/bin/
Now the installation can be verified by running a simple terraform version command:
Once successfully installed, let’s check to terraform commands:
terraform Usage: terraform [-version] [-help]
[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 login Obtain and save credentials for a remote host logout Remove locally-stored credentials for a remote host 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 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: 0.12upgrade Rewrites pre-0.12 module source code for v0.12 debug Debug output management (experimental) force-unlock Manually unlock the terraform state push Obsolete command for Terraform Enterprise legacy (v1) state Advanced state management
Congratulations! You have successfully installed Terraform. Thanks for using this tutorial for installing the Terraform on CentOS 8 system. For additional help or useful information, we recommend you check the official Terraform website.