How To Install OpenTofu on Ubuntu 24.04

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.

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.7.3
on linux_amd64

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

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Unlock the Right Solutions with Confidence

At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

In this tutorial we will cover step-by-step procedure of compiling Open vSwitch (OVS) from source code on Rocky Linux, AlmaLinux, […]

Open vSwitch (OVS) is an open source virtual switch widely adopted in network virtualization. OVS is popular in platforms like […]

Photoshop can be such a headache for both experts and beginners alike. Every time you open photoshop there’s always a […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.