TPA installation
================

To use TPA, you need to install from packages or source and run the
``tpaexec setup`` command. This document explains how to install TPA
packages. If you have an EDB subscription plan, and therefore have
access to the EDB repositories, you should follow these instructions. To
install TPA from source, please refer to :ref:`Installing TPA from source <Installing TPA from source>`  .

See :ref:`Distribution support <Distribution support>`  for information on what platforms are supported.

..  Note::
   Please make absolutely sure that your system has the correct date and time set, because various things will fail otherwise. We recommend you use a network time, for example `sudo ntpdate pool.ntp.org` 

Quickstart
----------

First, `subscribe to an EDB repository <https://www.enterprisedb.com/docs/repos/getting_started/>`_  .

Install TPA
^^^^^^^^^^^

.. code:: shell

   sudo <your-package-manager> install tpaexec

Install additional dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: shell

   sudo /opt/EDB/TPA/bin/tpaexec setup

Verify installation (run as a normal user)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: shell

   /opt/EDB/TPA/bin/tpaexec selftest

More detailed explanations of each step are given below.

Where to install TPA
--------------------

As long as you are using a supported platform, TPA can be installed and
run from your workstation. This is fine for learning, local testing or
demonstration purposes. TPA supports :ref:`Installing Docker <Installing Docker>` 

should you wish to perform a complete deployment on your own
workstation.

For production use, we recommend running TPA on a dedicated, persistent
virtual machine. We recommend this because it ensures that the cluster
directories are retained and available to your team for future cluster
management or update. It also means you only have to update one copy of
TPA and you only need to provide network access from a single TPA host
to the target instances.

Installing TPA packages
-----------------------

To install TPA, you must first `subscribe to an EDB repository <https://www.enterprisedb.com/docs/repos/getting_started/>`_  . TPA is available in all
EDB repositories.

Install TPA as follows:

Install on Debian or Ubuntu
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: shell

   sudo apt-get install tpaexec

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

.. code:: shell

   sudo dnf install tpaexec

SLES
^^^^

.. code:: shell

   sudo zypper install tpaexec

This will install TPA into ``/opt/EDB/TPA`` . It will also ensure that
other required packages (e.g., Python 3.12 or later) are installed.

We mention ``sudo`` here only to indicate which commands need root
privileges. You may use any other means to run the commands as root.

Setting up the TPA Python environment
-------------------------------------

Next, run ``tpaexec setup`` to create an isolated Python environment and
install the correct versions of all required modules.

..  Note::
   On Ubuntu versions prior to 20.04, please use `sudo -H tpaexec setup`  to avoid subsequent permission errors during `tpaexec configure` 

.. code:: shell

   sudo /opt/EDB/TPA/bin/tpaexec setup

``tpaexec setup`` will automatically use a suitable version of the
requirements.txt file to install the correct modules for your system.

You must run this as root because it writes to ``/opt/EDB/TPA`` , but
the process will not affect any system-wide Python modules you may have
installed (including Ansible).

Add ``/opt/EDB/TPA/bin`` to the ``PATH`` of the user who will normally
run ``tpaexec`` commands. For example, you could add this to your
.bashrc or equivalent shell configuration file:

.. code:: shell

   export PATH=$PATH:/opt/EDB/TPA/bin

Installing TPA without internet or network access (air-gapped)
--------------------------------------------------------------

This section describes how to install TPA onto a server which cannot
access either the EDB repositories, a Python package index, or both. For
information on how to use TPA in such an environment, please see
:ref:`Managing clusters in a disconnected or air-gapped environment <Managing clusters in a disconnected or air-gapped environment>` 

Downloading TPA packages
^^^^^^^^^^^^^^^^^^^^^^^^

If you cannot access the EDB repositories directly from the server on
which you need to install TPA, you can download the packages from an
internet-connected machine and transfer them. There are several ways to
achieve this.

If your internet-connected machine uses the same operating system as the
target, we recommend using ``yumdownloader`` (RHEL-like) or
``apt download`` (Debian-like) to download the packages.

Alternatively, you can download packages for any platform from your
browser by visiting `EDB Repos <https://www.enterprisedb.com/repos>`_  and selecting either **Enterprise**,
**Standard**, or **Community 360** under the heading **Download EDB
software packages from your browser**. To install TPA you need these
packages:

- tpaexec

- tpaexec-deps

- edb-python312

Once you have transferred the downloaded packages to the target server,
you must install them using the appropriate tool for your platform.

Installing without access to a Python package index
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When you run ``tpaexec setup`` , it will ordinarily download the Python
packages from a Python package index. Unless your environment provides a
different index the default is the official `PyPI <https://pypi.org>`_  . If no
package index is available, you should install the ``tpaexec-deps``
package in the same way your installed ``tpaexec`` . The
``tpaexec-deps`` package (available from the same repository as tpaexec)
bundles everything that would have been downloaded, so that they can be
installed without network access. Just install the package before you
run ``tpaexec setup`` and the bundled copies will be used automatically.

Verifying your TPA installation
-------------------------------

Once you’re done with all of the above steps, run the following command
to verify your local installation:

.. code:: shell

   tpaexec selftest

If that command completes without any errors, your TPA installation is
ready for use.

Upgrading TPA
-------------

To upgrade to a later release of TPA, you must:

1. Install the latest ``tpaexec`` package

2. Install the latest ``tpaexec-deps`` package (if required; see above)

3. Run ``tpaexec setup`` again

If you have subscribed to the TPA package repository as described above,
running ``apt-get update && apt-get upgrade`` or ``yum update`` should
install the latest available versions of these packages. If not, you can
install the packages by any means available.

We recommend that you run ``tpaexec setup`` again whenever a new version
of ``tpaexec`` is installed. Some new releases may not strictly require
this, but others will not work without it.

Ansible versions
----------------

TPA uses ansible-core 2.16 by default.
