mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
website: Split installation instructions (#887)
Signed-off-by: Janos Bonic <86970079+janosdebugs@users.noreply.github.com>
This commit is contained in:
parent
c5170df91a
commit
0a0787edf2
@ -1,67 +0,0 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: |-
|
||||
Learn how to install OpenTofu.
|
||||
---
|
||||
|
||||
# Installing OpenTofu
|
||||
|
||||
## Installing via direct download
|
||||
|
||||
The most direct method to install OpenTofu is to download it from GitHub releases. Each GitHub release has an Assets section, where you can find the `zip` archive for your platform and download it.
|
||||
|
||||
Once you download a zip archive from there, you can unzip it and move the `tofu` binary into your $PATH, e.g. into `/usr/local/bin` on many Unix operating systems.
|
||||
|
||||
You could, for example, run these commands:
|
||||
|
||||
```bash
|
||||
wget https://github.com/opentofu/opentofu/releases/download/v1.6.0-alpha2/tofu_1.6.0-alpha2_darwin_arm64.zip
|
||||
unzip tofu_1.6.0-alpha2_darwin_arm64.zip
|
||||
mv tofu /usr/local/bin/tofu
|
||||
```
|
||||
|
||||
to install OpenTofu on an arm64 MacOS system.
|
||||
|
||||
You can find the latest GitHub release of OpenTofu [here](https://github.com/opentofu/opentofu/releases/latest).
|
||||
|
||||
## Installing on MacOS
|
||||
|
||||
### Homebrew
|
||||
|
||||
OpenTofu is available in the Homebrew Core repository, so you can install it by running:
|
||||
|
||||
```bash
|
||||
brew install opentofu
|
||||
```
|
||||
|
||||
## Installing on Linux
|
||||
|
||||
OpenTofu is available via [PackageCloud](https://packagecloud.io/opentofu/tofu) and Snapcraft
|
||||
|
||||
### Debian and derivatives:
|
||||
```bash
|
||||
curl -s https://packagecloud.io/install/repositories/opentofu/tofu/script.deb.sh?any=true -o /tmp/tofu-repository-setup.sh
|
||||
# Inspect the downloaded script at /tmp/tofu-repository-setup.sh before running
|
||||
sudo bash /tmp/tofu-repository-setup.sh
|
||||
rm /tmp/tofu-repository-setup.sh
|
||||
|
||||
sudo apt install tofu
|
||||
```
|
||||
|
||||
### RedHat and derivatives:
|
||||
```bash
|
||||
curl -s https://packagecloud.io/install/repositories/opentofu/tofu/script.rpm.sh?any=true -o /tmp/tofu-repository-setup.sh
|
||||
# Inspect the downloaded script at /tmp/tofu-repository-setup.sh before running
|
||||
sudo bash /tmp/tofu-repository-setup.sh
|
||||
rm /tmp/tofu-repository-setup.sh
|
||||
|
||||
sudo yum install tofu
|
||||
```
|
||||
|
||||
### Ubuntu (Snapcraft)
|
||||
|
||||
If you're on Ubuntu and using Snapcraft you can install OpenTofu by running:
|
||||
|
||||
```bash
|
||||
snap install opentofu
|
||||
```
|
26
website/docs/intro/install/alpine.mdx
Normal file
26
website/docs/intro/install/alpine.mdx
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
sidebar_label: Alpine Linux
|
||||
description: |-
|
||||
Install OpenTofu on Alpine Linux.
|
||||
---
|
||||
|
||||
# Installing OpenTofu on Alpine Linux
|
||||
|
||||
OpenTofu is available in the [Alpine Linux testing repository](https://pkgs.alpinelinux.org/packages?name=opentofu) or as an `.apk` package from the [GitHub releases page](https://github.com/opentofu/opentofu/releases/latest/).
|
||||
|
||||
## Installing from the testing repository
|
||||
|
||||
OpenTofu is available in the Alpine Testing repository and can be installed from there:
|
||||
|
||||
```bash
|
||||
apk add opentofu --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing/
|
||||
```
|
||||
|
||||
## Installing the .apk
|
||||
|
||||
You can also [download the .apk](https://github.com/opentofu/opentofu/releases/latest/) and install it on your Alpine Linux. You can install the `.apk` package after downloading it:
|
||||
|
||||
```bash
|
||||
apk add --allow-untrusted tofu_*.apk
|
||||
```
|
64
website/docs/intro/install/deb.mdx
Normal file
64
website/docs/intro/install/deb.mdx
Normal file
@ -0,0 +1,64 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
sidebar_label: .deb-based Linux (Debian, Ubuntu)
|
||||
description: |-
|
||||
Install OpenTofu on Debian Linux and its derivatives.
|
||||
---
|
||||
|
||||
# Installing OpenTofu on .deb-based Linux (Debian, Ubuntu, etc.)
|
||||
|
||||
OpenTofu is distributed in the .deb package format on [Packagecloud](https://packagecloud.io/opentofu/tofu). You can install it using a convenience script or by following the step-by-step instructions below.
|
||||
|
||||
## Installing using the convenience script
|
||||
|
||||
You can install OpenTofu using the [convenience script](https://packagecloud.io/install/repositories/opentofu/tofu/script.deb.sh?any=true) with the following commands:
|
||||
|
||||
```bash
|
||||
curl -s https://packagecloud.io/install/repositories/opentofu/tofu/script.deb.sh?any=true -o /tmp/tofu-repository-setup.sh
|
||||
# Inspect the downloaded script at /tmp/tofu-repository-setup.sh before running
|
||||
sudo bash /tmp/tofu-repository-setup.sh
|
||||
rm /tmp/tofu-repository-setup.sh
|
||||
|
||||
sudo apt-get install tofu
|
||||
```
|
||||
|
||||
## Step-by-step instructions
|
||||
|
||||
The following steps explain how to set up the OpenTofu Debian repositories. These instructions should work on most Debian-based Linux systems.
|
||||
|
||||
### Installing tooling
|
||||
|
||||
In order to add the repositories, you will need to install some tooling. On most Debian-based operating systems, these tools will already be installed.
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install apt-transport-https ca-certificates curl gnupg
|
||||
```
|
||||
|
||||
### Set up the OpenTofu repository
|
||||
|
||||
First, you need to make sure you have a copy of the OpenTofu GPG key. This verifies that your packages have indeed been created using the official pipeline and have not been tampered with.
|
||||
|
||||
```bash
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://packagecloud.io/opentofu/tofu/gpgkey | sudo gpg --dearmor -o /etc/apt/keyrings/opentofu.gpg
|
||||
sudo chmod a+r /etc/apt/keyrings/opentofu.gpg
|
||||
```
|
||||
|
||||
Now you have to create the OpenTofu source list.
|
||||
|
||||
```bash
|
||||
echo \
|
||||
"deb [signed-by=/etc/apt/keyrings/opentofu.gpg] https://packagecloud.io/opentofu/tofu/any/ any main
|
||||
deb-src [signed-by=/etc/apt/keyrings/opentofu.gpg] https://packagecloud.io/opentofu/tofu/any/ any main" | \
|
||||
sudo tee /etc/apt/sources.list.d/opentofu.list > /dev/null
|
||||
```
|
||||
|
||||
### Installing OpenTofu
|
||||
|
||||
Finally, you can install OpenTofu:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install tofu
|
||||
```
|
58
website/docs/intro/install/index.mdx
Normal file
58
website/docs/intro/install/index.mdx
Normal file
@ -0,0 +1,58 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: |-
|
||||
Learn how to install OpenTofu.
|
||||
---
|
||||
|
||||
import DocCardList from "@theme/DocCardList";
|
||||
|
||||
# Installing OpenTofu
|
||||
|
||||
You can install OpenTofu via a wide range of methods. Please select your operating system and installation method:
|
||||
|
||||
<DocCardList
|
||||
items={[
|
||||
{
|
||||
type: "link",
|
||||
href: "/docs/intro/install/alpine",
|
||||
label: "Alpine Linux (.apk)",
|
||||
description:
|
||||
"Install OpenTofu from an .apk package directly.",
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
href: "/docs/intro/install/deb",
|
||||
label: "Debian Linux and derivatives (.deb)",
|
||||
description:
|
||||
"Install OpenTofu on Debian, Ubuntu, or any other .deb-based Linux distribution using your package manager.",
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
href: "/docs/intro/install/rpm",
|
||||
label: "RHEL and derivatives (.rpm)",
|
||||
description:
|
||||
"Install OpenTofu on RHEL, Fedora, openSUSE, or any other .rpm-based Linux distribution using your package manager.",
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
href: "/docs/intro/install/snap",
|
||||
label: "Ubuntu Linux (Snap)",
|
||||
description:
|
||||
"Install OpenTofu on Ubuntu, Manjaro, or any other Linux distribution using Snap.",
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
href: "/docs/intro/install/macos",
|
||||
label: "MacOS (Homebrew)",
|
||||
description:
|
||||
"Install OpenTofu on MacOS using Homebrew.",
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
href: "/docs/intro/install/portable",
|
||||
label: "Portable (Linux/MacOS/Windows)",
|
||||
description:
|
||||
"Use OpenTofu without installation on Linux, MacOS, or Windows.",
|
||||
},
|
||||
]}
|
||||
/>
|
1
website/docs/intro/install/install-yum.sh
Normal file
1
website/docs/intro/install/install-yum.sh
Normal file
@ -0,0 +1 @@
|
||||
yum install tofu
|
3
website/docs/intro/install/install-zypper.sh
Normal file
3
website/docs/intro/install/install-zypper.sh
Normal file
@ -0,0 +1,3 @@
|
||||
zypper --gpg-auto-import-keys refresh opentofu
|
||||
zypper --gpg-auto-import-keys refresh opentofu-source
|
||||
zypper install tofu
|
14
website/docs/intro/install/macos.mdx
Normal file
14
website/docs/intro/install/macos.mdx
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
sidebar_label: MacOS
|
||||
description: |-
|
||||
Install OpenTofu on MacOS.
|
||||
---
|
||||
|
||||
# Installing OpenTofu on MacOS
|
||||
|
||||
You can use OpenTofu as a [portable binary](portable.mdx) or you can install it using [Homebrew](https://formulae.brew.sh/formula/opentofu). OpenTofu is available in the Homebrew Core repository, so you can install it by running:
|
||||
|
||||
```
|
||||
brew install opentofu
|
||||
```
|
10
website/docs/intro/install/portable-install.ps1
Normal file
10
website/docs/intro/install/portable-install.ps1
Normal file
@ -0,0 +1,10 @@
|
||||
$TOFU_VERSION="1.6.0-alpha2"
|
||||
$TARGET=Join-Path $env:LOCALAPPDATA OpenTofu
|
||||
New-Item -ItemType Directory -Path $TARGET
|
||||
Push-Location $TARGET
|
||||
Invoke-WebRequest -Uri "https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_windows_amd64.zip" -OutFile "tofu_${TOFU_VERSION}_windows_amd64.zip"
|
||||
Expand-Archive "tofu_${TOFU_VERSION}_windows_amd64.zip" -DestinationPath $TARGET
|
||||
Remove-Item "tofu_${TOFU_VERSION}_windows_amd64.zip"
|
||||
$TOFU_PATH=Join-Path $TARGET tofu.exe
|
||||
Pop-Location
|
||||
echo "OpenTofu is now available at ${TOFU_PATH}. Please add it to your path for easier access."
|
13
website/docs/intro/install/portable-install.sh
Normal file
13
website/docs/intro/install/portable-install.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
TOFU_VERSION="1.6.0-alpha2"
|
||||
OS="$(uname | tr '[:upper:]' '[:lower:]')"
|
||||
ARCH="$(uname -m | sed -e 's/aarch64/arm64/' -e 's/x86_64/amd64/')"
|
||||
TEMPDIR="$(mktemp -d)"
|
||||
pushd "${TEMPDIR}" >/dev/null
|
||||
wget "https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_${OS}_${ARCH}.zip"
|
||||
unzip "tofu_${TOFU_VERSION}_${OS}_${ARCH}.zip"
|
||||
sudo mv tofu /usr/local/bin/tofu
|
||||
popd >/dev/null
|
||||
rm -rf "${TEMPDIR}"
|
||||
echo "OpenTofu is now available at /usr/local/bin/tofu."
|
31
website/docs/intro/install/portable.mdx
Normal file
31
website/docs/intro/install/portable.mdx
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
sidebar_position: 99
|
||||
sidebar_label: Portable (Linux/MacOS/Windows)
|
||||
description: |-
|
||||
Use OpenTofu as a portable binary without installation.
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import CodeBlock from '@theme/CodeBlock';
|
||||
import LinuxScript from '!!raw-loader!./portable-install.sh'
|
||||
import WindowsScript from '!!raw-loader!./portable-install.ps1'
|
||||
|
||||
# Using OpenTofu as a portable binary
|
||||
|
||||
You can run OpenTofu without installation as a portable binary. You can [download the latest release](https://github.com/opentofu/opentofu/releases/latest/) for your operating system from the [GitHub releases page](https://github.com/opentofu/opentofu/releases/latest/), unpack the zip and start using it. For easier updates, we recommend using the **non-portable packaged versions for your operating system**.
|
||||
|
||||
:::tip Scripting downloads
|
||||
|
||||
If you want to automate the updates of the portable binaries yourself you can do so by adapting the following scripts to your needs:
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="linux-macos" label="Linux/MacOS" default>
|
||||
<CodeBlock language="bash">{LinuxScript}</CodeBlock>
|
||||
</TabItem>
|
||||
<TabItem value="windows" label="Windows (PowerShell)">
|
||||
<CodeBlock language="powershell">{WindowsScript}</CodeBlock>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
:::
|
23
website/docs/intro/install/repo-yum.sh
Normal file
23
website/docs/intro/install/repo-yum.sh
Normal file
@ -0,0 +1,23 @@
|
||||
cat >/etc/yum.repos.d/opentofu.repo <<EOF
|
||||
[opentofu]
|
||||
name=opentofu
|
||||
baseurl=https://packagecloud.io/opentofu/tofu/rpm_any/rpm_any/\$basearch
|
||||
repo_gpgcheck=1
|
||||
gpgcheck=1
|
||||
enabled=1
|
||||
gpgkey=https://packagecloud.io/opentofu/tofu/gpgkey
|
||||
sslverify=1
|
||||
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
|
||||
metadata_expire=300
|
||||
|
||||
[opentofu-source]
|
||||
name=opentofu-source
|
||||
baseurl=https://packagecloud.io/opentofu/tofu/rpm_any/rpm_any/SRPMS
|
||||
repo_gpgcheck=1
|
||||
gpgcheck=1
|
||||
enabled=1
|
||||
gpgkey=https://packagecloud.io/opentofu/tofu/gpgkey
|
||||
sslverify=1
|
||||
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
|
||||
metadata_expire=300
|
||||
EOF
|
23
website/docs/intro/install/repo-zypper.sh
Normal file
23
website/docs/intro/install/repo-zypper.sh
Normal file
@ -0,0 +1,23 @@
|
||||
cat >/etc/zypp/repos.d/opentofu.repo <<EOF
|
||||
[opentofu]
|
||||
name=opentofu
|
||||
baseurl=https://packagecloud.io/opentofu/tofu/rpm_any/rpm_any/\$basearch
|
||||
repo_gpgcheck=1
|
||||
gpgcheck=1
|
||||
enabled=1
|
||||
gpgkey=https://packagecloud.io/opentofu/tofu/gpgkey
|
||||
sslverify=1
|
||||
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
|
||||
metadata_expire=300
|
||||
|
||||
[opentofu-source]
|
||||
name=opentofu-source
|
||||
baseurl=https://packagecloud.io/opentofu/tofu/rpm_any/rpm_any/SRPMS
|
||||
repo_gpgcheck=1
|
||||
gpgcheck=1
|
||||
enabled=1
|
||||
gpgkey=https://packagecloud.io/opentofu/tofu/gpgkey
|
||||
sslverify=1
|
||||
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
|
||||
metadata_expire=300
|
||||
EOF
|
62
website/docs/intro/install/rpm.mdx
Normal file
62
website/docs/intro/install/rpm.mdx
Normal file
@ -0,0 +1,62 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
sidebar_label: .rpm-based Linux (RHEL, openSUSE, Fedora)
|
||||
description: |-
|
||||
Install OpenTofu on Red Hat Enterprise Linux.
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import CodeBlock from '@theme/CodeBlock';
|
||||
import YumRepoScript from '!!raw-loader!./repo-yum.sh'
|
||||
import ZypperRepoScript from '!!raw-loader!./repo-zypper.sh'
|
||||
import YumInstallScript from '!!raw-loader!./install-yum.sh'
|
||||
import ZypperInstallScript from '!!raw-loader!./install-zypper.sh'
|
||||
|
||||
# Installing OpenTofu on RHEL, Fedora, openSUSE, and other RPM-based distributions
|
||||
|
||||
OpenTofu is distributed in the .rpm package format on [Packagecloud](https://packagecloud.io/opentofu/tofu). You can install it using a convenience script or by following the step-by-step instructions below.
|
||||
|
||||
## Installing using the convenience script
|
||||
|
||||
You can install OpenTofu using the [convenience script](https://packagecloud.io/install/repositories/opentofu/tofu/script.rpm.sh?any=true) with the following commands:
|
||||
|
||||
```bash
|
||||
curl -s https://packagecloud.io/install/repositories/opentofu/tofu/script.rpm.sh?any=true -o /tmp/tofu-repository-setup.sh
|
||||
# Inspect the downloaded script at /tmp/tofu-repository-setup.sh before running
|
||||
sudo bash /tmp/tofu-repository-setup.sh
|
||||
rm /tmp/tofu-repository-setup.sh
|
||||
|
||||
sudo yum install tofu
|
||||
```
|
||||
|
||||
## Step-by-step instructions
|
||||
|
||||
The following steps explain how to set up the OpenTofu RPM repositories. These instructions should work on most RPM-based Linux systems.
|
||||
|
||||
### Adding the OpenTofu repository
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="redhat" label="Yum (RHEL/Fedora/etc.)" default>
|
||||
Create the <code>/etc/yum.repos.d/opentofu.repo</code> file by running the following command:
|
||||
<CodeBlock language={"bash"}>{YumRepoScript}</CodeBlock>
|
||||
</TabItem>
|
||||
<TabItem value="opensuse-leap" label="Zypper (openSUSE)">
|
||||
Create the <code>/etc/zypp/repos.d/opentofu.repo</code> file by running the following command:
|
||||
<CodeBlock language={"bash"}>{ZypperRepoScript}</CodeBlock>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Installing OpenTofu
|
||||
|
||||
Now you install OpenTofu by running:
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="redhat" label="Yum (RHEL/Fedora/etc)" default>
|
||||
<CodeBlock language={"bash"}>{YumInstallScript}</CodeBlock>
|
||||
</TabItem>
|
||||
<TabItem value="opensuse-leap" label="Zypper (openSUSE)">
|
||||
<CodeBlock language={"bash"}>{ZypperInstallScript}</CodeBlock>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
16
website/docs/intro/install/snap.mdx
Normal file
16
website/docs/intro/install/snap.mdx
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
sidebar_label: Snapcraft (Linux)
|
||||
description: |-
|
||||
Install OpenTofu on via Snap
|
||||
---
|
||||
|
||||
# Installing OpenTofu via Snapcraft (Linux)
|
||||
|
||||
OpenTofu is available on [Snapcraft](https://snapcraft.io/) and you can install it by running:
|
||||
|
||||
```bash
|
||||
snap install --classic opentofu
|
||||
```
|
||||
|
||||
Snap is available by default on Ubuntu Linux and [can be installed on other Linux distributions, too](https://snapcraft.io/docs/installing-snapd).
|
Loading…
Reference in New Issue
Block a user