Installing PGD CLI on Linux
===========================

PGD CLI is available for most Linux distributions. You can install it
from the EDB repositories, which you can access with your EDB account.
PGD users and EDB Cloud Service users, including those on a free trial,
have an EDB account and access to PGD CLI.

Obtain your EDB subscription token
----------------------------------

To install the PGD CLI, you will need an EDB Repos 2.0 token to gain
access to the EDB private software repositories. For instructions on
obtaining this token, see: :ref:`Get your token <pgd node start>`  .

Set the EDB_SUBSCRIPTION_TOKEN environment variable
---------------------------------------------------

Once you have the token, execute the command shown for your operating
system, substituting your token for ``<your-token>`` .

.. code:: shell

   export EDB_SUBSCRIPTION_TOKEN=<your-token>

Then run the appropriate commands for your operating system.

Debian or Ubuntu
^^^^^^^^^^^^^^^^

On Debian or Ubuntu, you can install PGD CLI using the ``apt`` package
manager.

.. code:: bash

   curl -1sSLf "https://downloads.enterprisedb.com/$EDB_SUBSCRIPTION_TOKEN/postgres_distributed/setup.deb.sh" | sudo -E bash

If this command returns an error like
``curl: (22) The requested URL returned error: 404`` , check that you
entered the correct token.

When the command is successful, you’ll see output like this:

.. code:: console

   Executing the  setup script for the enterprisedb/postgres_distributed repository ...
   ...

You can now install the PGD CLI package using the command:

.. code:: shell

   sudo apt-get install edb-pgd6-cli

RHEL, Rocky, AlmaLinux, or Oracle Linux
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

On RHEL, Rocky, AlmaLinux, or Oracle Linux, you can install PGD CLI
using the ``yum`` package manager. You can also use the ``dnf`` package
manager, which is the default package manager for RHEL 8 and later.

.. code:: bash

   curl -1sSLf "https://downloads.enterprisedb.com/$EDB_SUBSCRIPTION_TOKEN/postgres_distributed/setup.rpm.sh" | sudo -E bash

If this command returns an error like
``curl: (22) The requested URL returned error: 404`` , check that you
entered the correct token.

When the command is successful, you’ll see output like this:

.. code:: console

   Executing the  setup script for the enterprisedb/postgres_distributed repository ......

You can now install the PGD CLI package using the command:

dnf
^^^

.. code:: bash

   sudo dnf install edb-pgd6-cli

yum
^^^

.. code:: bash

   sudo yum install edb-pgd6-cli
