Installing Terraform
Current Terraform releases and installation instructions are available on the official HashiCorp website.
If you encounter installation issues, create an issue in the Terraform repository on GitHub or write on https://discuss.hashicorp.com.
Below, for user convenience, are installation methods for major operating systems. However, these instructions may become outdated, so it is recommended to follow the instructions published on the official website.
Linux / macOS
Installation Using Package Managers
Debian / Ubuntu
The HashiCorp repository is third-party for APT; thus, its GPG key must be manually added after verifying the fingerprint to ensure source authenticity.
- Update available packages:
sudo apt update
- Check and install gnupg, ca-certificates, wget:
sudo apt install -y gnupg ca-certificates wget
- Download and install the HashiCorp GPG key:
wget -O- https://apt.releases.hashicorp.com/gpg | \ sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
- Display the GPG key fingerprint of the HashiCorp APT repository:
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint
gpg: /root/.gnupg/trustdb.gpg: trustdb created /usr/share/keyrings/hashicorp-archive-keyring.gpg ------------------------------------------------- pub rsa4096 2023-01-10 [SC] [expires: 2028-01-09] 798A EC65 4E5C 1542 8C8E 42EE AA16 FCBC A621 E701 uid [ unknown] HashiCorp Security (HashiCorp Package Signing) <[email protected]> sub rsa4096 2023-01-10 [S] [expires: 2028-01-09]
798A EC65 4E5C 1542 8C8E 42EE AA16 FCBC A621 E701
- Verify this fingerprint with https://www.hashicorp.com/security under “Linux Package Checksum Verification.” If matching, adding the repository is safe.
- Add HashiCorp repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(grep -oP '(?<=VERSION_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
- Update package lists again:
sudo apt update
- Install Terraform:
do apt install -y terraform
RHEL / CentOS / Amazon Linux
- Install the package manager if it is not already installed:
sudo yum install -y yum-utils
- Add the official HashiCorp repository:
For all except Amazon Linux:sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
- Install Terraform:
sudo yum -y install terraform
Fedora 40 / 41
- Install the package manager if it is not already installed:
sudo dnf install -y dnf-plugins-core
- Add the official HashiCorp repository:
Для Fedora 40:sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
sudo dnf config-manager addrepo --from-repofile=https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
- Install Terraform:
sudo dnf -y install terraform
Homebrew (macOS & Linux)
- Tap the HashiCorp repository:
brew tap hashicorp/tap
- Install Terraform:
brew install hashicorp/tap/terraform
Manual Installation
- Download the appropriate archive for your operating system and architecture from the official HashiCorp website.
- Check your $PATH to see where executables can be placed without a full path:
echo $PATH
- Unpack the downloaded archive into a directory listed in your $PATH.
- Navigate to the unpacked directory:
cd <path_to_terraform_directory>
- Make the Terraform binary executable:
chmod +x terraform
Windows
Installing with Chocolatey
- Open PowerShell as Administrator.
- Install Terraform:
choco install terraform -y
Manual Installation
- Download the appropriate archive for your OS and architecture from the official HashiCorp website.
- Extract the archive to a directory of your choice, for example “C:\Terraform”.
- Add the directory to your PATH:
Windows 10:
a. Click “Start”, type “Environment Variables”, and select “Edit environment variables for your account”.
b. In “System Properties”, click “Environment Variables…”.
c. Under “User variables for <Your_User>”, select “Path” and click “Edit…”.
d. Click “New”, enter the path to your Terraform folder (e.g. “C:\Terraform”), and press “Enter”.
e. Click “OK” to close each dialog.
Windows 11:
a. Press “Win + X” or right-click “Start” and choose “System”.
b. In “Settings”, select ”About”, then click “Advanced system settings” under “Related links”.
c. In “System Properties”, click “Environment Variables…”.
d. Under “User variables for <Your_User>”, select “Path” → “Edit…”.
e. Click “New”, enter the path to your Terraform folder (e.g. “C:\Terraform”), and click “OK” on all dialogs. - Close and reopen “PowerShell”, “CMD”, or “Windows Terminal” — Terraform commands will now be available.
Verifying the Installation
Open a new terminal or PowerShell session and run:
terraform version
If installed successfully, the current Terraform version will be displayed.
What’s Next?
Once Terraform is installed, you can configure it to authenticate with the Peerobyte cloud infrastructure as described in the guide "Authentication in Cloud Infrastructure via Terraform".