- はじめに
- OpenTofuのインストール
- .rpmベースのLinux (RHEL, openSUSE, AlmaLinux)
RHEL、openSUSE、AlmaLinuxおよびその他のRPMベースのディストリビューションへのOpenTofuのインストール
ご支援ありがとうございます。 OpenTofuパッケージホスティングをスポンサーしていただいています。
以下のステップバイステップの手順に従って、OpenTofuをRPMリポジトリからインストールできます。
インストーラーを使用したインストール
OpenTofuインストーラースクリプトを使用してインストールを実行できます。
# 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
# Give it execution permissions:
chmod +x install-opentofu.sh
# Please inspect the downloaded script
# Run the installer:
./install-opentofu.sh --install-method rpm
# Remove the installer:
rm -f install-opentofu.sh
ステップバイステップの手順
以下の手順では、OpenTofu RPMリポジトリを設定する方法を説明します。これらの手順は、ほとんどのRPMベースのLinuxシステムで動作するはずです。
OpenTofuリポジトリの追加
- Yum (RHEL/AlmaLinuxなど)
- Zypper (openSUSE)
次のコマンドを実行して、/etc/yum.repos.d/opentofu.repo
ファイルを作成します。
cat >/etc/yum.repos.d/opentofu.repo <<EOF
[opentofu]
name=opentofu
baseurl=https://packages.opentofu.org/opentofu/tofu/rpm_any/rpm_any/\$basearch
repo_gpgcheck=0
gpgcheck=1
enabled=1
gpgkey=https://get.opentofu.org/opentofu.gpg
https://packages.opentofu.org/opentofu/tofu/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[opentofu-source]
name=opentofu-source
baseurl=https://packages.opentofu.org/opentofu/tofu/rpm_any/rpm_any/SRPMS
repo_gpgcheck=0
gpgcheck=1
enabled=1
gpgkey=https://get.opentofu.org/opentofu.gpg
https://packages.opentofu.org/opentofu/tofu/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
EOF
次のコマンドを実行して、/etc/zypp/repos.d/opentofu.repo
ファイルを作成します。
cat >/etc/zypp/repos.d/opentofu.repo <<EOF
[opentofu]
name=opentofu
baseurl=https://packages.opentofu.org/opentofu/tofu/rpm_any/rpm_any/\$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://get.opentofu.org/opentofu.gpg
https://packages.opentofu.org/opentofu/tofu/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[opentofu-source]
name=opentofu-source
baseurl=https://packages.opentofu.org/opentofu/tofu/rpm_any/rpm_any/SRPMS
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://get.opentofu.org/opentofu.gpg
https://packages.opentofu.org/opentofu/tofu/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
EOF
OpenTofuのインストール
次に、次を実行してOpenTofuをインストールします。
- Yum (RHEL/AlmaLinuxなど)
- Zypper (openSUSE)
sudo yum install -y tofu
zypper --gpg-auto-import-keys refresh opentofu
zypper --gpg-auto-import-keys refresh opentofu-source
zypper install -y tofu