How to Install Infrastructure Automation Software Terraform on Ubuntu 18.04 / CentOS 7

How to Install Infrastructure Automation Software Terraform on Ubuntu 18.04 / CentOS 7

Terraform is one of the best infrastructure as code tools on the market. It allows you to create, change and enhance structure securely on the most popular service providers.

You can use it to manage Cloud Compute, Networking, Load Balancers and DNS efficiently using simple Declarative Programming Language. It is available on Github. In this article, you will find step by step guide for installing Terraform on Ubuntu 18.04 and CentOS 7.

Installing Terraform on Ubuntu 18.04 / CentOS 7

  1. First, ensure that wget is installed on your PC by using the following command in the Terminal:

$ sudo apt-get install wget # Ubuntu
$ sudo yum install wget # CentOS

  1. Now, get Terraform archive.

export VER="0.11.8"
wget https://releases.hashicorp.com/terraform/${VER}/terraform_${VER}_linux_amd64.zip

  1. After downloading, extract the archive by typing the following command:

$ sudo apt-get install unzip # Ubuntu
$ sudo yum install unzip     # CentOS 7
$ unzip terraform_${VER}_linux_amd64.zip
Archive:  terraform_0.11.8_linux_amd64.zip
  inflating: terraform

  1. A terraform binary file has been created in the working directory. Now, you have to move the file to the directory /usr/local/bin. Type the following line:

sudo mv terraform /usr/local/bin/

  1. Now, all the users in your PC can get access to Terraform. Type these lines to verify the accessibility:

$which terraform
/usr/local/bin/terraform

  1. Check the version number of Terraform.

$ terraform -v
Terraform v0.11.8

  1. Now, verify the functionality of Terraform.

# 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
    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             Readan 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            Updatelocal 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:
    debug              Debug output management (experimental)
    force-unlock       Manually unlock the terraform state
    state              Advanced state management

Conclusion

If everything works correctly, Terraform has been successfully installed in your PC. Now, you have the power to build, change and combine infrastructure efficiently and safely.

Check out these top 3 Linux hosting services

FastComet
$1.79 /mo
Starting price
Visit FastComet
Rating based on expert review
  • User Friendly
    4.7
  • Support
    5.0
  • Features
    4.8
  • Reliability
    4.5
  • Pricing
    5.0
HostArmada
$2.49 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
Hostinger
$2.99 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.7
  • Support
    4.7
  • Features
    4.8
  • Reliability
    4.8
  • Pricing
    4.7

How to Create New MySQL Users Accounts and Manage MySQL Privileges

This tutorial will help you create new MySQL (database) user accounts and grant
4 min read
David Malcom
David Malcom
Author

How To Set up a VSFTPD Server on a CentOS 7 VPS or Dedicated Server

Brief Description FTP is usually insecure exposing clear-text passwords, userna
2 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

How to Install MongoDB on Your CentOS 7 VPS or Dedicated Server

MongoDB is designed for extensive databases and is mainly used for data analytic
2 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How to Set Up a Linux VPN Server from a Windows Client

VPN is important for securely connecting to server’s resource
5 min read
Vladimir Rakov
Vladimir Rakov
Hosting Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top