github.com/hugorut/terraform@v1.1.3/website/docs/cli/install/apt.mdx (about)

     1  ---
     2  page_title: APT Packages for Debian and Ubuntu
     3  description: >-
     4    The HashiCorp APT repositories contain distribution-specific Terraform
     5    packages for both Debian and Ubuntu systems.
     6  ---
     7  
     8  # APT Packages for Debian and Ubuntu
     9  
    10  The primary distribution packages for Terraform are `.zip` archives containing
    11  single executable files that you can extract anywhere on your system. However,
    12  for easier integration with configuration management tools and other systematic
    13  system configuration strategies, we also offer package repositories for
    14  Debian and Ubuntu systems, which allow you to install Terraform using the
    15  `apt install` command or any other APT frontend.
    16  
    17  If you are instead using Red Hat Enterprise Linux, CentOS, or Fedora, you
    18  might prefer to [install Terraform from our Yum repositories](/cli/install/yum).
    19  
    20  -> **Note:** The APT repositories discussed on this page are generic HashiCorp
    21  repositories that contain packages for a variety of different HashiCorp
    22  products, rather than just Terraform. Adding these repositories to your
    23  system will, by default, therefore make several other non-Terraform
    24  packages available for installation. That might then mask some packages that
    25  are available for some HashiCorp products in the main Debian and Ubuntu
    26  package repositories.
    27  
    28  ## Repository Configuration
    29  
    30  The Terraform packages are signed using a private key controlled by HashiCorp,
    31  so in most situations the first step would be to configure your system to trust
    32  that HashiCorp key for package authentication. For example:
    33  
    34  ```bash
    35  curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
    36  ```
    37  
    38  After registering the key, you can add the official HashiCorp repository to
    39  your system:
    40  
    41  ```bash
    42  sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
    43  ```
    44  
    45  The above command line uses the following sub-shell commands:
    46  
    47  * `dpkg --print-architecture` to determine your system's primary APT
    48    architecture/ABI, such as `amd64`.
    49  * `lsb_release -cs` to find the distribution release codename for your current
    50    system, such as `buster`, `groovy`, or `sid`.
    51  
    52  To install Terraform from the new repository:
    53  
    54  ```bash
    55  sudo apt update
    56  sudo apt install terraform
    57  ```
    58  
    59  ## Supported Architectures
    60  
    61  The HashiCorp APT server currently has packages only for the `amd64`
    62  architecture, which is also sometimes known as `x86_64`.
    63  
    64  There are no official packages available for other architectures, such as
    65  `arm64`. If you wish to use Terraform on a non-`amd64` system,
    66  [download a normal release `.zip` file](/downloads) instead.
    67  
    68  ## Supported Debian and Ubuntu Releases
    69  
    70  The HashiCorp APT server currently contains release repositories for the
    71  following distribution releases:
    72  
    73  * Debian 8 (`jessie`)
    74  * Debian 9 (`stretch`)
    75  * Debian 10 (`buster`)
    76  * Debian 11 (`bullseye`)
    77  * Ubuntu 16.04 (`xenial`)
    78  * Ubuntu 18.04 (`bionic`)
    79  * Ubuntu 19.10 (`eoam`)
    80  * Ubuntu 20.04 (`focal`)
    81  * Ubuntu 20.10 (`groovy`)
    82  * Ubuntu 21.04 (`hirsute`)
    83  * Ubuntu 21.10 (`impish`)
    84  
    85  No repositories are available for other Debian or Ubuntu versions or
    86  any other APT-based Linux distributions. If you add the repository using
    87  the above commands on other systems then `apt update` will report the
    88  repository index as missing.
    89  
    90  Terraform executables are statically linked and so they depend only on the
    91  Linux system call interface, not on any system libraries. Because of that,
    92  you may be able to use one of the above release codenames when adding a
    93  repository to your system, even if that codename doesn't match your current
    94  distribution release.
    95  
    96  Over time we will change the set of supported distributions, including both
    97  adding support for new releases and ceasing to publish new Terraform versions
    98  under older releases.
    99  
   100  ## Choosing Terraform Versions
   101  
   102  The HashiCorp APT repositories contain multiple versions of Terraform, but
   103  because the packages are all named `terraform` it is impossible to install
   104  more than one version at a time, and `apt install` will default to selecting
   105  the latest version.
   106  
   107  It's often necessary to match your Terraform version with what a particular
   108  configuration is currently expecting. You can use the following command to
   109  see which versions are currently available in the repository index:
   110  
   111  ```bash
   112  apt policy terraform
   113  ```
   114  
   115  There may be multiple package releases for a particular Terraform version if
   116  we need to publish an updated package for any reason. In that case, the
   117  subsequent releases will have an additional suffix, like `0.13.4-2`. In these
   118  cases, the Terraform executable inside the package should be unchanged, but its
   119  metadata and other contents may be different.
   120  
   121  You can select a specific version to install by including it in the
   122  `apt install` command line, as follows:
   123  
   124  ```bash
   125  sudo apt install terraform=0.14.0
   126  ```
   127  
   128  If your workflow requires using multiple versions of Terraform at the same
   129  time, for example when working through a gradual upgrade where not all
   130  of your configurations are upgraded yet, we recommend that you use the
   131  official release `.zip` files instead of the APT packages, so you can install
   132  multiple versions at once and then select which to use for each command you
   133  run.