Terraform 是 Hashicorp 的免费开源基础设施自动化工具,用于创建、构建和更改使用基础设施作为跨各种云提供商(如 AWS、Azure 云、GCP、Oracle 云等)的代码。
在 CentOS 8 上安装 Terraform
步骤 1. 首先,确保所有软件包都是最新的。
sudo dnf update
步骤 2. 在 CentOS 8 上安装 Terraform。
运行以下命令从Terraform 官方站点下载最新的 terraform 设置:
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
接下来,将提取的设置移动到目录:/usr/local/bin
sudo mv terraform /usr/local/bin/
现在可以通过运行一个简单的 terraform version 命令来验证安装:
terraform -v
成功安装后,让我们检查 terraform 命令:
terraform
输出:
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
感谢您使用本教程在 CentOS 8 系统上安装 Terraform。如需其他帮助或有用信息,我们建议您查看Terraform 官方网站。