To install Terraform on Ubuntu, you can follow the steps below:
-
Update and refresh your repository list:
sudo apt-get update
-
Download the Terraform binary:
You can download Terraform from the official Terraform downloads page. Here's a command that downloads Terraform 1.4.6. Make sure to check the official download page for the latest version:
wget https://releases.hashicorp.com/terraform/1.4.6/terraform_1.4.6_linux_amd64.zip
-
Install zip to unzip the downloaded file:
sudo apt-get install zip -y
-
Unzip the downloaded file to extract the Terraform binary:
unzip terraform_1.4.6_linux_amd64.zip
-
Move the Terraform binary to a location in your system's PATH:
sudo mv terraform /usr/local/bin/
-
Verify the installation:
terraform --version
This should return the version of Terraform that you installed.
These instructions assume that you have sudo
access on your system. If you don't, you might need to ask your system administrator to install Terraform for you, or install it in a location where you have write access.
Keep in mind that the specific version of Terraform you should use may vary depending on your use case. Be sure to use the version of Terraform that's compatible with your scripts.