您想学习如何在Ubuntu Linux上执行Terraform安装吗? 在本教程中,我们将向您展示如何在Linux上安装Terraform。

什么是Terraform?

Terraform是由HashiCorp开发并以GO语言编写的基础架构代码软件。

它允许用户创建可连接到多个云提供商并创建或更新整个基础架构的配置文件。

例如,管理员可以创建一个配置文件,该文件将使用Amazon AWS云中的Ubuntu Linux自动创建10个虚拟机,并连接到Azure云并创建运行Windows的虚拟机。

Terraform教程:

在此页面上,我们提供了与Terraform相关的教程列表的快速访问。

教程 - Terraform安装

在Linux控制台上,使用以下命令安装所需的软件。

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

访问Terraform下载页面 并使Linux版本与您的环境兼容。

Terraform Download

我们将使用WGET命令执行Terraform软件下载。

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

完成Terraform下载后,提取Terraform安装包。

# unzip terraform_0.11.13_linux_amd64.zip

Archive: terraform_0.11.13_linux_amd64.zip
inflating: terraform

使用以下命令在Ubuntu上安装Terraform命令:

# install terraform /usr/local/bin/

使用以下命令验证Terraform安装:

# terraform -version
# 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 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:

恭喜! 你可以在Ubuntu Linux上安装Terraform。

Terraform与Ansible

两者都是用于创建基础架构代码的好产品。

这两种产品都可用于部署具有复杂要求的网络环境。

简单来说,我们可以说Ansible是一个IT自动化工具,在使用Terraform时,您可以使用其基础架构作为代码解决方案创建一个完整的基础架构,这意味着您可以创建跨越多个云提供的整个网络环境,如 亚马逊AWS,谷歌,Azure和其他使用简单配置文件的人。

这是一个更好的比较链接 Terraform与Ansible