Terraform is a well-known Infrastructure as a Code (IaaC) platform. Terraform makes it easy to create and provision full-fledged data center infrastructures by using the HashiCorp Configuration Language (HCL). This article shows you how to install Terraform on Ubuntu 20.04.
Installing Terraform on Ubuntu 20.04
For installing Terraform on Ubuntu 20.04, you need to perform all the steps described below:
Step # 1: Update Ubuntu 20.04 System
First, you have to update your system’s cache with the following command so that there are no more broken links or dependencies:
sudo apt update
Step # 2: Install the “wget” and “unzip” Utilities on Ubuntu 20.04 System:
Now, you need to install two utilities on your Ubuntu 20.04 system that you are going to use later on. These two utilities are “wget” and “unzip” respectively and they can easily be installed with the following command:
sudo apt-get install wget unzip -y
In our case, since both of these utilities were already installed on our Ubuntu 20.04 system, that is why we received the messages shown in the image below:
Step # 3: Install Terraform on Ubuntu 20.04 System:
After the successful installation of the “wget” and “unzip” utilities, we can now install Terraform on Ubuntu 20.04 system with the following command:
sudo wget https://releases.hashicorp.com/terraform/0.14.3/terraform_0.14.3_linux_amd64.zip
After a few seconds, the execution of this command will finish hence displaying the messages shown in the image below on your screen:
Step # 4: Unzip the Installed Terraform File on Ubuntu 20.04 System:
Since we have installed the zip file of Terraform, therefore, we need to unzip it with the following command:
sudo unzip terraform_0.14.3_linux_amd64.zip
Running this command will create an unzipped file named “terraform” as shown in the image below:
Step # 5: Move the Unzipped Terraform File to the /usr/local/bin Directory in Ubuntu 20.04 System:
Now, we need to move this unzipped Terraform file to our /usr/local/bin directory for this tool to work properly. This can be done by executing the following command in your Ubuntu 20.04 terminal:
sudo mv terraform /usr/local/bin
If this movement takes place successfully, then no messages will be produced on the terminal as shown in the image below:
Step # 6: Verify the Installation of Terraform on Ubuntu 20.04:
Up till now, Terraform will be successfully installed on your Ubuntu 20.04 system. You can check it out if it is so or not by using the “whereis” command. This command is used to find the path of the source code, binary, and man pages of any particular tool or package. You can use it in the following manner:
whereis terraform
Here is the output:
Removing Terraform from Ubuntu 20.04
If you want to remove Terraform from your Ubuntu 20.04 system, then you will have to run the commands shown below successively:
sudo apt-get purge terraform
sudo apt-get autoremove
Conclusion
Installing Terraform on Ubuntu 20.04 will no longer be a hassle for you after going through this article. However, whenever you feel like you do not want this platform any longer, then you can simply uninstall it from your Ubuntu 20.04 system without thinking about anything else.