- はじめに
- OpenTofuのインストール
- スタンドアロン (Linux/MacOS/Windows/BSD)
GitHub Releases から OpenTofu をインストールする
インストーラスクリプトの使用
- Linux/MacOS/BSD/Unix (POSIX)
- Windows (PowerShell)
# Download the installer script:
curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
# Alternatively: wget --secure-protocol=TLSv1_2 --https-only https://get.opentofu.org/install-opentofu.sh -O install-opentofu.sh
# Grant execution permissions:
chmod +x install-opentofu.sh
# Please inspect the downloaded script at this point.
# Run the installer:
./install-opentofu.sh --install-method standalone
# Remove the installer:
rm -f install-opentofu.sh
# Download the installer script:
Invoke-WebRequest -outfile "install-opentofu.ps1" -uri "https://get.opentofu.org/install-opentofu.ps1"
# Please inspect the downloaded script at this point.
# Run the installer:
& .\install-opentofu.ps1 -installMethod standalone
# Remove the installer:
Remove-Item install-opentofu.ps1
注意
このスクリプトの実行時にスクリプト実行ポリシーの問題が発生した場合は、インストーラを実行する前に`Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process`を実行してください。
スタンドアロンバイナリとしてOpenTofuを使用する
インストールせずに、スタンドアロンバイナリとしてOpenTofuを実行できます。最新リリースをGitHubリリースページからダウンロードし、zipファイルを解凍して使用を開始できます。より簡単にアップデートを行うには、**オペレーティングシステム用のポータブルではないパッケージ版**を使用することをお勧めします。
コミュニティサポートアーキテクチャ
注意
これらは、OpenTofuが正式にサポートしていないアーキテクチャ用のビルドです。これらのビルドに関する問題は、それぞれのメンテナにお知らせください。
ppc64leの最新バイナリはこちらからダウンロードできます。ppc64leのメンテナに連絡する (このバイナリに関する問題について)
ファイルの整合性を検証する
リリースから`tofu_YOURVERSION_SHA256SUMS`ファイルをダウンロードしてください。このファイルには、すべてのファイルのSHA256チェックサムが含まれています。次のコマンドを実行して、ファイルの整合性を検証できます。
- Linux (sha256sum)
- MacOS (shasum)
- Windows (PowerShell)
ZIPFILE=tofu_*.zip
CHECKSUM=$(sha256sum "${ZIPFILE}" | cut -f 1 -d ' ')
EXPECTED_CHECKSUM=$(grep "${ZIPFILE}" tofu_*_SHA256SUMS | cut -f 1 -d ' ')
if [ "${CHECKSUM}" = "${EXPECTED_CHECKSUM}" ]; then
echo "OK"
else
echo "MISMATCH"
fi
ZIPFILE=tofu_*.zip
CHECKSUM=$(shasum -a 256 "tofu_*.zip" | cut -f 1 -d ' ')
EXPECTED_CHECKSUM=$(grep "${ZIPFILE}" tofu_*_SHA256SUMS | cut -f 1 -d ' ')
if [ "${CHECKSUM}" = "${EXPECTED_CHECKSUM}" ]; then
echo "OK"
else
echo "MISMATCH"
fi
$zipFile="tofu_YOURVERSION_REPLACEME.zip"
$checksum = $(Get-FileHash -Algorithm SHA256 $zipFile).Hash
$expectedChecksum = $((Get-Content "tofu_YOURVERSION_REPLACEME_SHA256SUMS" | Select-String -Pattern $zipFile) -split '\s+')[0]
if ($realHash -ne $expectedHash) {
Write-Error "Checksum mismatch"
}
Cosignを使用したバイナリの検証
チェックサムを検証した後、Cosignを使用してチェックサムファイル自体の整合性を検証できます。Cosignがインストールされていることを確認し、リリース用の`tofu_YOURVERSION_SHA256SUMS.pem`ファイルと`tofu_YOURVERSION_SHA256SUMS.sig`ファイルをダウンロードしてください。その後、整合性検証を実行できます。
- Linux/MacOS/BSD/UNIX (POSIX)
- Windows (PowerShell)
OPENTOFU_VERSION_MAJORMINOR="Add your OpenTofu major and minor version here"
IDENTITY="https://github.com/opentofu/opentofu/.github/workflows/release.yml@refs/heads/v${OPENTOFU_VERSION_MAJORMINOR}"
# For alpha and beta builds use /main
cosign \
verify-blob \
--certificate-identity "${IDENTITY}" \
--signature "tofu_*.sig" \
--certificate "tofu_*.pem" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
"tofu_*_SHA256SUMS"
$version = [version]"YOUR_OPENTOFU_VERSION"
$identity = "https://github.com/opentofu/opentofu/.github/workflows/release.yml@refs/heads/v${version.Major}.${version.Minor}"
# For alpha and beta builds use /main
cosign.exe `
verify-blob `
--certificate-identity $identity `
--signature "tofu_YOURVERSION_REPLACEME.sig" `
--certificate "tofu_YOURVERSION_REPLACEME.pem" `
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" `
"tofu_YOURVERSION_REPLACEME_SHA256SUMS"