VOOZH about

URL: https://thenewstack.io/install-terraform-and-the-gaia-web-ui-on-ubuntu-server-22-04/

⇱ Install Terraform and the Gaia Web UI on Ubuntu Server 22.04 - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2022-07-02 06:00:40
Install Terraform and the Gaia Web UI on Ubuntu Server 22.04
DevOps

Install Terraform and the Gaia Web UI on Ubuntu Server 22.04

How to install and get started with Terraform, an Infrastrcutrure-as-code tool.
Jul 2nd, 2022 6:00am by Jack Wallen
👁 Featued image for: Install Terraform and the Gaia Web UI on Ubuntu Server 22.04

Terraform is an open source Infrastructure as Code (IaC) tool, created by HashiCorp, that allows users to define and provide data center infrastructure with either HashiCorp’s declarative configuration language (known as HashiCorp Configuration Langauge) or JSON.

With Terraform you can define both cloud and on-premises resources, using human-readable configuration files that can be versioned, reused, and shared, to create a consistent workflow for provisioning and managing all of your infrastructure. Terraform can be used to manage compute, storage, networking resources, DNS entries, and SaaS features.

Let’s get Terraform installed on my go-to open source server of choice Ubuntu and then see how to provision an AWS EC2 instance.

Installing Terraform

The first thing we must do is install Terraform. Before we do this, let’s install a few necessary dependencies. Log in to your Ubuntu instance and install those requirements with the command:

sudo apt-get install  software-properties-common gnupg2 curl -y

Once those dependencies are taken care of, download the required HashiCorp GPG key with the command:

curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > hashicorp.gpg

Next, add the GPG key with:

sudo install -o root -g root -m 644 hashicorp.gpg /etc/apt/trusted.gpg.d/

Now, we can add the official HashiCorp repository with the command:

sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com focal main"

Finally, update apt and install Terraform with the following two commands:

sudo apt update

sudo apt install terraform

Once the installation is complete, you can verify the installation with the command:

terraform version

The output should look something like this:

Terraform v1.2.4

on linux_amd64

+ provider registry.terraform.io/hashicorp/google v4.27.0

So far so good. Let’s take this one step further.

How to Provision an AWS EC2 Instance with Terraform

In order to make this work, you’re going to need both your access key and your secret key for  Amazon Web Services. These credentials are found in the Security Credentials section of your AWS Web Services console. You will then have to generate a new access key, which (once created) will display the Access Key ID and the Secret Access Key, which are both strings of random characters. You’ll need to copy those two keys down, as we’re going to use them.

On your Ubuntu instance, create a new demo directory with the command:

mkdir terraform_test

Create a new Terraform configuration file with the command:

nano awsec2.tf

In that file, paste the following:

provider "aws" {
access_key = "ACCESS_KEY"
secret_key = "SECRET_KEY"
region = "us-west-2"
}

resource "aws_instance" "terraform_demo" {
ami = "AMI"
instance_type = "t2.micro"
}

Where ACCESS_KEY is the AWS access key you created, SECRET_KEY is the associated secret key, and AMI is the ami of the Ubuntu version you want to use. For example, the ami for Ubuntu 22.04 in the us-west-1 azone is ami-09dadf5dc6cfa5248.

Save and close the file.

We can now initialize terraform with the command:

terraform init

After the initialization completes, you can move onto the plan stage, which will create an execution graph for the creation and provisioning of our infrastructure. The command for this is:

terraform plan

The above command shouldn’t take too long. Once it completes, you can then move on to the apply stage, which executes the configuration file to launch our AWS EC2 instance. For this, issue the command:

terraform apply

You will be asked to verify that you want to perform the actions, so type yes and hit Enter on your keyboard. The instance will be deployed and should be listed in your AWS dashboard.

What about a Terraform GUI

There are a few Terraform GUIs available, but many of them are either incredibly challenging to get up and running or they simply are broken. There is one, however, that can be deployed with Docker Compose, called Gaia. Let’s get that deployed.

The first thing we must do is install Docker CE.

First, add the GPG key with the command:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Next, add the Docker repository:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install the necessary dependencies with:

sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y

Finally, we can install the latest version of the Docker engine:

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io -y

To finish, add your user to the docker group with the command:

sudo usermod -aG docker $USER

Make the system aware of the changes with:

newgrp docker

Create a Docker Compose YAML with:

nano docker-compose.yml

In that file, paste the following:

version: "3.9"
services:
  gaia:
    image: "gaiaapp/gaia"
    ports:
      - "8080:8080"
    environment:
      - "GAIA_MONGODB_URI=mongodb://mongo/gaia"
      - "GAIA_RUNNER_API_PASSWORD=123456"
  runner:
    image: "gaiaapp/runner"
    environment:
      - "GAIA_URL=http://gaia:8080"
      - "GAIA_RUNNER_API_PASSWORD=123456"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
  mongo:
    image: "mongo:4.4"

Save and close the file.

Deploy the Gaia container with:

docker-compose up -d

Once the container is up and running, access the web UI by pointing a web browser to http://SERVER:8080 (where SERVER is the IP address or domain of the hosting server).

You should be greeted by the Gaia login screen (Figure 1), where the credentials are admin/admin123).

👁 Figure 1: The Gaia login screen.

Figure 1: The Gaia login screen.

Upon successful login, you’ll be directed to the main Gaia window (Figure 2), where you can start working with Terraform.

👁 The Gaia web UI makes working with Terraform considerably easier.

Figure 2: The Gaia web UI makes working with Terraform considerably easier.

Congratulations, you now have a much easier tool for managing Terraform, which will help you provision your data center infrastructure for cloud native development. Enjoy that newfound power.

TRENDING STORIES
Jack Wallen is what happens when a Gen Xer mind-melds with present-day snark. Jack is a seeker of truth and a writer of words with a quantum mechanical pencil and a disjointed beat of sound and soul. Although he resides...
Read more from Jack Wallen
SHARE THIS STORY
TRENDING STORIES
Amazon Web Services and Terraform are sponsors of The New Stack.
TNS owner Insight Partners is an investor in: Docker.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.