本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
安装适用于 Linux 和 macOS 的 Guard
你可以使用预先构建 AWS CloudFormation Guard 的发行版二进制文件 Cargo 或 Homebrew 在 Linux 和 macOS 上安装。
从预先构建的发行版二进制文件安装 Guard
使用以下步骤从预先构建的二进制文件安装 Guard。
-
打开终端,然后运行以下命令。
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/aws-cloudformation/cloudformation-guard/main/install-guard.sh | sh
-
运行以下命令来设置您的
PATH
变量。export PATH=~/.guard/bin:$PATH
结果:您已成功安装了 Guard 并设置了
PATH
变量。-
(可选)要确认 Guard 的安装,请运行以下命令。
cfn-guard --version
该命令将返回以下输出。
cfn-guard 3.0.0
-
安装货物防护
Cargo 是 Rust 包管理器。完成以下步骤来安装 Rust,其中包括 Cargo。然后,安装 Guard from Cargo。
-
从终端运行以下命令,然后按照屏幕上的说明安装 Rust。
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
(可选)对于 Ubuntu 环境,请运行以下命令。
sudo apt-get update; sudo apt install build-essential
-
-
配置您的
PATH
环境变量,然后运行以下命令。source $HOME/.cargo/env
-
安装了 Cargo 后,运行以下命令来安装 Guard。
cargo install cfn-guard
结果:你已经成功安装了 Guard。
-
(可选)要确认 Guard 的安装,请运行以下命令。
cfn-guard --version
该命令将返回以下输出。
cfn-guard 3.0.0
-
从 Homebrew 安装 Guard
Homebrew 是一款适用于 macOS 和 Linux 的软件包管理器。完成以下步骤来安装 Homebrew。然后,从 Homebrew 中安装 Guard。
-
从终端运行以下命令,然后按照屏幕上的说明安装 Homebrew。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
安装了 Homebrew 后,运行以下命令来安装 Guard。
brew install cloudformation-guard
结果:你已经成功安装了 Guard。
-
(可选)要确认 Guard 的安装,请运行以下命令。
cfn-guard --version
该命令将返回以下输出。
cfn-guard 3.0.0
-