AMP AMP

How to install Terraform on Oracle Linux 9.3

To Install Terraform On Oracle Linux 9.3

Introduction:

Terraform is a software application utilized for the automated construction of infrastructure, eliminating the need to manually access a cloud provider's interface. Terraform possesses the capability to automatically generate, modify, and eliminate infrastructure components. It has the capacity to generate a wide array of resources including virtual machines, users, networking apparatus, and security elements. Furthermore, Terraform facilitates compatibility with a range of cloud service providers such as AWS, Azure, Google, as well as on-premises systems including VMware, KVM, and Proxmox, among others.

Installation Procedure:

Step 1: Check the OS version by using the below Command.

[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.3"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.3

Step 2: Install yum-utils package by using the below command

[root@linuxhelp ~]# dnf install -y yum-utils
Oracle Linux 9 BaseOS Latest (x86_64)                                                                    20 kB/s | 3.6 kB     00:00    
Oracle Linux 9 BaseOS Latest (x86_64)                                                                    17 MB/s |  25 MB     00:01    
Oracle Linux 9 Application Stream Packages (x86_64)                                                      22 kB/s | 3.9 kB     00:00    
Oracle Linux 9 Application Stream Packages (x86_64)                                                      17 MB/s |  34 MB     00:02    
Oracle Linux 9 UEK Release 7 (x86_64)                                                                    10 kB/s | 3.0 kB     00:00    
Oracle Linux 9 UEK Release 7 (x86_64)                                                                    17 MB/s |  33 MB     00:01    
Last metadata expiration check: 0:00:09 ago on Sunday 19 May 2024 10:48:15 PM.
Dependencies resolved.
========================================================================================================================================
 Package                                 Architecture          Version                           Repository                        Size
========================================================================================================================================
Installing:
 yum-utils                               noarch                4.3.0-13.0.1.el9                  ol9_baseos_latest                 53 k
Upgrading:
 dnf-plugins-core                        noarch                4.3.0-13.0.1.el9                  ol9_baseos_latest                 55 k
 python3-dnf-plugins-core                noarch                4.3.0-13.0.1.el9                  ol9_baseos_latest                338 k

Transaction Summary
========================================================================================================================================
Install  1 Package
Upgrade  2 Packages

Total download size: 446 k
Downloading Packages:
(1/3): yum-utils-4.3.0-13.0.1.el9.noarch.rpm                                                            190 kB/s |  53 kB     00:00    
(2/3): dnf-plugins-core-4.3.0-13.0.1.el9.noarch.rpm                                                      82 kB/s |  55 kB     00:00    
(3/3): python3-dnf-plugins-core-4.3.0-13.0.1.el9.noarch.rpm                                             295 kB/s | 338 kB     00:01    
----------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                   384 kB/s | 446 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                1/1 
  Upgrading        : python3-dnf-plugins-core-4.3.0-13.0.1.el9.noarch                                                               1/5 
  Upgrading        : dnf-plugins-core-4.3.0-13.0.1.el9.noarch                                                                       2/5 
  Installing       : yum-utils-4.3.0-13.0.1.el9.noarch                                                                              3/5 
  Cleanup          : dnf-plugins-core-4.3.0-11.0.1.el9_3.noarch                                                                     4/5 
  Cleanup          : python3-dnf-plugins-core-4.3.0-11.0.1.el9_3.noarch                                                             5/5 
  Running scriptlet: python3-dnf-plugins-core-4.3.0-11.0.1.el9_3.noarch                                                             5/5 
  Verifying        : yum-utils-4.3.0-13.0.1.el9.noarch                                                                              1/5 
  Verifying        : dnf-plugins-core-4.3.0-13.0.1.el9.noarch                                                                       2/5 
  Verifying        : dnf-plugins-core-4.3.0-11.0.1.el9_3.noarch                                                                     3/5 
  Verifying        : python3-dnf-plugins-core-4.3.0-13.0.1.el9.noarch                                                               4/5 
  Verifying        : python3-dnf-plugins-core-4.3.0-11.0.1.el9_3.noarch                                                             5/5 
Upgraded:
  dnf-plugins-core-4.3.0-13.0.1.el9.noarch                       python3-dnf-plugins-core-4.3.0-13.0.1.el9.noarch                      
Installed:
  yum-utils-4.3.0-13.0.1.el9.noarch                                                                                                     

Complete!

Step 3: Add yum repository by using the below command.

[root@linuxhelp ~]# yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
Adding repo from: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo

Step 4: Confirm if repository is added and working by using the below command.

[root@linuxhelp ~]# dnf repolist
repo id                                            repo name
hashicorp                                          Hashicorp Stable - x86_64
ol9_UEKR7                                          Oracle Linux 9 UEK Release 7 (x86_64)
ol9_appstream                                      Oracle Linux 9 Application Stream Packages (x86_64)
ol9_baseos_latest                                  Oracle Linux 9 BaseOS Latest (x86_64)
Note: If you can see hashicorp from the list proceed to install terraform.

Step 5: Install terraform by using the below command

[root@linuxhelp ~]# yum -y install terraform
Hashicorp Stable - x86_64                                                                               3.8 MB/s | 1.4 MB     00:00    
Last metadata expiration check: 0:00:01 ago on Sunday 19 May 2024 10:49:44 PM.
Dependencies resolved.
========================================================================================================================================
 Package                            Architecture             Version                              Repository                       Size
========================================================================================================================================
Installing:
 terraform                          x86_64                   1.8.3-1                              hashicorp                        26 M
Installing dependencies:
 git                                x86_64                   2.43.0-1.el9                         ol9_appstream                    65 k
 git-core                           x86_64                   2.43.0-1.el9                         ol9_appstream                   4.5 M
 git-core-doc                       noarch                   2.43.0-1.el9                         ol9_appstream                   3.9 M
 perl-Error                         noarch                   1:0.17029-7.el9                      ol9_appstream                    57 k
 perl-Git                           noarch                   2.43.0-1.el9                         ol9_appstream                    42 k
 perl-TermReadKey                   x86_64                   2.38-11.el9                          ol9_appstream                    42 k
 perl-lib                           x86_64                   0.65-481.el9                         ol9_appstream                    13 k

Transaction Summary
========================================================================================================================================
Install  8 Packages

Total download size: 35 M
Installed size: 122 M
Downloading Packages:
(1/8): git-2.43.0-1.el9.x86_64.rpm                                                                      171 kB/s |  65 kB     00:00    
(2/8): git-core-doc-2.43.0-1.el9.noarch.rpm                                                             8.2 MB/s | 3.9 MB     00:00    
(3/8): perl-Error-0.17029-7.el9.noarch.rpm                                                              568 kB/s |  57 kB     00:00    
(4/8): perl-Git-2.43.0-1.el9.noarch.rpm                                                                 496 kB/s |  42 kB     00:00    
(5/8): perl-TermReadKey-2.38-11.el9.x86_64.rpm                                                          267 kB/s |  42 kB     00:00    
(6/8): terraform-1.8.3-1.x86_64.rpm                                                                      15 MB/s |  26 MB     00:01    
(7/8): perl-lib-0.65-481.el9.x86_64.rpm                                                                  31 kB/s |  13 kB     00:00    
(8/8): git-core-2.43.0-1.el9.x86_64.rpm                                                                 2.2 MB/s | 4.5 MB     00:02    
----------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                    17 MB/s |  35 MB     00:02     
Hashicorp Stable - x86_64                                                                                28 kB/s | 3.9 kB     00:00    
Importing GPG key 0xA621E701:
 Userid     : "HashiCorp Security (HashiCorp Package Signing) <security+packaging@hashicorp.com>"
 Fingerprint: 798A EC65 4E5C 1542 8C8E 42EE AA16 FCBC A621 E701
 From       : https://rpm.releases.hashicorp.com/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                1/1 
  Installing       : git-core-2.43.0-1.el9.x86_64                                                                                   1/8 
  Installing       : git-core-doc-2.43.0-1.el9.noarch                                                                               2/8 
  Installing       : perl-lib-0.65-481.el9.x86_64                                                                                   3/8 
  Installing       : perl-TermReadKey-2.38-11.el9.x86_64                                                                            4/8 
  Installing       : perl-Error-1:0.17029-7.el9.noarch                                                                              5/8 
  Installing       : perl-Git-2.43.0-1.el9.noarch                                                                                   6/8 
  Installing       : git-2.43.0-1.el9.x86_64                                                                                        7/8 
  Installing       : terraform-1.8.3-1.x86_64                                                                                       8/8 
  Running scriptlet: terraform-1.8.3-1.x86_64                                                                                       8/8 
  Verifying        : terraform-1.8.3-1.x86_64                                                                                       1/8 
  Verifying        : git-2.43.0-1.el9.x86_64                                                                                        2/8 
  Verifying        : git-core-2.43.0-1.el9.x86_64                                                                                   3/8 
  Verifying        : git-core-doc-2.43.0-1.el9.noarch                                                                               4/8 
  Verifying        : perl-Error-1:0.17029-7.el9.noarch                                                                              5/8 
  Verifying        : perl-Git-2.43.0-1.el9.noarch                                                                                   6/8 
  Verifying        : perl-TermReadKey-2.38-11.el9.x86_64                                                                            7/8 
  Verifying        : perl-lib-0.65-481.el9.x86_64                                                                                   8/8 
Installed:
  git-2.43.0-1.el9.x86_64      git-core-2.43.0-1.el9.x86_64        git-core-doc-2.43.0-1.el9.noarch perl-Error-1:0.17029-7.el9.noarch
  perl-Git-2.43.0-1.el9.noarch perl-TermReadKey-2.38-11.el9.x86_64 perl-lib-0.65-481.el9.x86_64     terraform-1.8.3-1.x86_64         

Complete!

Step 6: Check the version of Terraform to validate our installation by using the below command

[root@linuxhelp ~]# terraform version
Terraform v1.8.3
on linux_amd64

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Terraform on Oracle Linux 9.3. Your feedback is much welcome.

FAQ
Q
Can I uninstall Terraform from Oracle Linux 9.3?
A
Yes, you can uninstall Terraform using the package manager:
dnf remove terraform
Q
Is there a specific directory structure for Terraform projects?
A
While there's no strict directory structure, it's a common practice to organize Terraform files (.tf) into directories based on the environment or functionality.
Q
Can I upgrade Terraform to the latest version?
A
Yes, you can upgrade Terraform to the latest version using the package manager:
dnf upgrade terraform
Q
How do I check the installed Terraform version?
A
After installation, you can verify the Terraform version using the command: terraform -v
Q
What is Terraform?
A
Terraform is an open-source infrastructure as code (IaC) tool used for efficiently building, changing, and versioning infrastructure.