OpenTofu has grown really first to be super replacement to Terraform which shifted to a Business Source License (BSL) in August 2023. OpenTofu is an open source and community-driven fork of Terraform. It has matured into a production-grade, and powerful infrastructure-as-code tool in under few months. We will explain how you can install OpenTofu on Ubuntu 24.04 Linux system. The beautiful fact is OpenTofu is a drop-in replacement for Terraform, meaning it doesn’t have any learning curve.

🏆 BESTSELLER

The Ultimate Ubuntu Desktop Handbook

Master Ubuntu like a pro - from beautiful desktop customization to powerful terminal automation. Perfect for developers, system admins, and power users who want total control of their workspace.

Only $15 $30
Get Instant Access →

The OpenTofu’s stable released are available for installation on Ubuntu 24.04 server or Desktop. Additionally, the process is simplified further since the maintainers of OpenTofu provides an official APT repository with OpenTofu packages.

Add OpenTofu APT repository

Before installation of OpenTofu on Ubuntu 24.04 can begin, we need to add the repository and import GPG apt key.

First off, update your system APT cache and install dependencies.

sudo apt update
sudo apt install -y curl gnupg apt-transport-https ca-certificates

Import OpenTofu GPG key after installing the necessary packages.

curl -fsSL https://get.opentofu.org/opentofu.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/opentofu.gpg
curl -fsSL https://packages.opentofu.org/opentofu/tofu/gpgkey | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/tofu.gpg

Add OpenTofu repository to the system.

echo "deb https://packages.opentofu.org/opentofu/tofu/any/ any main"|sudo tee /etc/apt/sources.list.d/opentofu.list

Install OpenTofu on Ubuntu Linux

Update the OS repositories list using apt:

$ sudo apt update
Hit:1 https://mirror.hetzner.com/ubuntu/packages jammy InRelease
Hit:2 https://mirror.hetzner.com/ubuntu/packages jammy-updates InRelease
Hit:3 https://mirror.hetzner.com/ubuntu/packages jammy-backports InRelease
Hit:4 https://mirror.hetzner.com/ubuntu/security jammy-security InRelease
Get:5 https://packages.opentofu.org/opentofu/tofu/any any InRelease [28.0 kB]
Get:6 https://packages.opentofu.org/opentofu/tofu/any any/main amd64 Packages [3,113 B]
Fetched 31.1 kB in 2s (12.9 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

Finally install OpenTofu on Ubuntu machine:

sudo apt install tofu

The installed version of OpenTofu can be checked using the following command:

$ tofu  --version
OpenTofu v1.9.0
on linux_amd64

Learn more about OpenTofu from project’s official documentation pages.

LEAVE A REPLY

Please enter your comment!
Please enter your name here