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.

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

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

Recent Post

Leave a Comment

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

Related Post

Let’s clarify the differences between merge requests (commonly called pull requests in GitHub), releases, release candidates (RCs), tags, and branches […]

Kind (which in full means “Kubernetes IN Docker”), is a command line tool that enables you to run Kubernetes clusters […]

Are you looking for an easy way to migrate packages from one cPanel server to a new cPanel server? In […]

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.