

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Linux および macOS 用の Guard のインストール
<a name="setting-up-linux"></a>

Linux および macOS AWS CloudFormation Guard 用の をインストールするには、構築済みのリリースバイナリ、Cargo、または Homebrew を使用します。

## ビルド済みリリースバイナリから Guard をインストールする
<a name="install-pre-built-binaries"></a>

ビルド済みのバイナリから Guard をインストールするには、次の手順に従います。

1. ターミナルを開き、次のコマンドを実行します。

   ```
   curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/aws-cloudformation/cloudformation-guard/main/install-guard.sh | sh
   ```

1. 次のコマンドを実行して、`PATH`変数を設定します。

   ```
   export PATH=~/.guard/bin:$PATH
   ```

   *結果:* Guard が正常にインストールされ、 `PATH`変数が設定されました。

   1. (オプション) Guard のインストールを確認するには、次のコマンドを実行します。

     ```
     cfn-guard --version
     ```

     このコマンドは、以下の出力を返します。

     ```
     cfn-guard 3.1.2
     ```

## Cargo から Guard をインストールする
<a name="install-guard-from-cargo"></a>

貨物は Rust パッケージマネージャーです。Cargo を含む Rust をインストールするには、次の手順を実行します。次に、Cargo から Guard をインストールします。

1. ターミナルから次のコマンドを実行し、画面の指示に従って Rust をインストールします。

   ```
   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
   ```

   1. (オプション) Ubuntu 環境の場合は、次のコマンドを実行します。

     ```
     sudo apt-get update; sudo apt install build-essential
     ```

1. `PATH` 環境変数を設定し、次のコマンドを実行します。

   ```
   source $HOME/.cargo/env
   ```

1. Cargo がインストールされたら、次のコマンドを実行して Guard をインストールします。

   ```
   cargo install cfn-guard
   ```

   *結果*: Guard が正常にインストールされました。

   1. (オプション) Guard のインストールを確認するには、次のコマンドを実行します。

     ```
     cfn-guard --version
     ```

     このコマンドは、以下の出力を返します。

     ```
     cfn-guard 3.1.2
     ```

## Homebrew から Guard をインストールする
<a name="install-guard-from-homebrew"></a>

Homebrew は、macOS および Linux 用のパッケージマネージャーです。Homebrew をインストールするには、次の手順を実行します。次に、Homebrew から Guard をインストールします。

1. ターミナルから次のコマンドを実行し、画面の指示に従って Homebrew をインストールします。

   ```
   /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
   ```

1. Homebrew がインストールされたら、次のコマンドを実行して Guard をインストールします。

   ```
   brew install cloudformation-guard
   ```

   *結果*: Guard が正常にインストールされました。

   1. (オプション) Guard のインストールを確認するには、次のコマンドを実行します。

     ```
     cfn-guard --version
     ```

     このコマンドは、以下の出力を返します。

     ```
     cfn-guard 3.1.2
     ```