# Terraform Installation on Ubuntu 22.04

Terraform is an open-source infrastructure as code (IaC) tool developed by HashiCorp. It allows you to define and manage your infrastructure using a declarative configuration language, known as HashiCorp Configuration Language (HCL), or JSON.

**<mark>Step 1: Update your system's package list</mark>**

```plaintext
sudo apt-get update
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723726042008/f981dbcc-6c28-4e71-8771-7905444dd51c.png align="center")

**<mark>Step 2: Install Required Dependencies</mark>**

One such dependency is `unzip`, which is used to extract the Terraform package after downloading it. To install `unzip`, use the following command:

```plaintext
sudo apt install unzip
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723726084560/fddcb40e-dd14-4098-bbca-953cd05b13d2.png align="center")

**<mark>Step 3: Download Terraform</mark>**

Next, we need to download the Terraform binary from the official HashiCorp website. At the time of writing, the latest version is 1.9.4. You can download it using the `wget` command:

```plaintext
wget https://releases.hashicorp.com/terraform/1.9.4/terraform_1.9.4_linux_amd64.zip
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723726128829/1efafb43-f406-4733-a02e-5c19f0c47f8c.png align="center")

**<mark>Step 4: Unzip the Downloaded File</mark>**

Once the download is complete, you'll need to unzip the downloaded file to extract the Terraform binary. Run the following command:

```plaintext
unzip terraform_1.9.4_linux_amd64.zip
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723726163568/e073ed6e-377a-4634-b9a9-351598fb1206.png align="center")

After unzipping, you can verify the contents of the directory using the `ls -lrt` command:

```plaintext
ls -lrt
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723726227674/9440fe9a-0d37-45c1-be5b-c7a80e371e59.png align="center")

**<mark>Step 5: Move the Terraform Binary to a Directory in Your PATH</mark>**

To make Terraform accessible from anywhere in your terminal, move the Terraform binary to a directory that is included in your system's PATH. A common choice is `/usr/local/bin`:

```plaintext
mv terraform /usr/local/bin
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723726285802/d3d58948-b5d0-4dfa-a843-8eb5b5b05e6a.png align="center")

**<mark>Step 6: Verify the Installation</mark>**

Finally, you should verify that Terraform has been installed correctly by checking its version. Run the following command:

```plaintext
terraform --version
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723726346038/89487a96-a4a8-41a3-b2c9-abaca470fa42.png align="center")

### Conclusion

You've now successfully installed Terraform on your Ubuntu system! You can now start using Terraform to define, provision, and manage your infrastructure with ease. Happy coding!
