Install Terraform and Docker in Linux Mint Victoria (21.2)

Tri Juhari
3 min readJan 1, 2024

--

If you follow the installation guides for Terraform ( https://developer.hashicorp.com/terraform/install) and Docker ( https://docs.docker.com/engine/install/ubuntu/) on their websites, you may encounter some problems if you are using Linux Mint version Victoria (21.2).

The problem is that Terraform and Docker do not yet have version lists for their Apt sources. Therefore, if you try to install Terraform or Docker directly following the instructions on their websites, you will get an error when you run the command. The error will look like this:

E: The repository 'https://apt.releases.hashicorp.com/ stable' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) for more details.

Therefore the command needs to be modified to read the UBUNTU_CODENAME instead of the VERSION_CODENAME.

So here are the modified installation commands for installing Docker and Terraform.

Docker

Official Installation Guide

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Modification Installation Command

According to the Official Installation Guide, the command to add an apt sources repository is:

$(. /etc/os-release && echo "$VERSION_CODENAME") stable

We change it to the following, because here we use the version of the distribution (Linux Mint is based on Ubuntu) that is used.

$(. /etc/os-release && echo "$UBUNTU_CODENAME") stable

The complete command is as follows

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$UBUNTU_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Terraform

Official Installation Guide

wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform

Modification Installation Command

According to the Official Installation Guide, the command to add an apt sources repository is:

$(lsb_release -cs)

We change it to the following, because here we use the version of the distribution (Linux Mint is based on Ubuntu) that is used.

$(. /etc/os-release && echo "$UBUNTU_CODENAME")

The complete command is as follows

wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(. /etc/os-release && echo "$UBUNTU_CODENAME") main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform

Terraform and Docker were successfully installed without any errors.

--

--

Responses (1)