Installing TPA from source v23

You can use TPA from a copy of the source code repository.

Note

To receive EDB support for the software, EDB customers must install TPA from packages.

To run TPA from source, you must install all of the dependencies (for example, Python 3.9+) that the packages would handle for you. Or, download the source and run TPA in a Docker container. (Either way works fine on Linux and macOS.)

Quickstart

First, you must install the various dependencies: Python 3, Python venv, git, openvpn, and patch. Installing from EDB repositories installs these for you along with the TPA packages.

Before you install TPA, you must install the required packages:

  • Debian/Ubuntu
    sudo apt-get install python3 python3-pip python3-venv git openvpn patch
  • Redhat, Rocky or AlmaLinux (RHEL7)
    sudo yum install python3 python3-pip epel-release git openvpn patch
  • Redhat, Rocky or AlmaLinux (RHEL8)
    sudo yum install python36 python3-pip epel-release git openvpn patch

Clone and setup

After the prerequisites are installed, you can clone the repository:

git clone https://github.com/enterprisedb/tpa.git ~/tpa

Cloning creates a tpa directory in your home directory.

If you prefer to check out with SSH, use:

git clone ssh://git@github.com/EnterpriseDB/tpa.git ~/tpa

Add the bin directory to your path. You can find the bin directory in your newly created clone.

Add this line to your .bashrc file (or other profile file for your preferred shell):

export PATH=$PATH:$HOME/tpa/bin

You can now create a working TPA environment by running:

tpaexec setup

This command creates the Python virtual environment that TPA will use in future. All needed packages are installed in this environment. To test whether this was configured correctly, run:

tpaexec selftest

tpaexec is now installed.

Dependencies

Python 3.9+

TPA requires Python 3.9 or later, available on most modern distributions. If you don't have it, you can use pyenv to install any version of Python you like without affecting the system packages. (If you weren't already using pyenv, add pyenv to your PATH in .bashrc, and call eval "$(pyenv init -)" as described in the pyenv documentation.)

# First, install pyenv and activate it in ~/.bashrc
# See https://github.com/pyenv/pyenv#installation
# (e.g., `brew install pyenv` on MacOS X)

$ pyenv install 3.9.0
Downloading Python-3.9.0.tar.xz...
-> https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz
Installing Python-3.9.0...
Installed Python-3.9.0 to /home/ams/.pyenv/versions/3.9.0

$ pyenv local 3.9.0
$ pyenv version
3.9.0 (set by /home/ams/pyenv/.python-version)

$ pyenv which python3
/home/ams/.pyenv/versions/3.9.0/bin/python3
$ python3 --version
3.9.0

Virtual environment options

By default, tpaexec setup uses the builtin Python 3 -m venv to create a venv under $TPA_DIR/tpa-venv and activate it whenever tpaexec is invoked.

You can run tpaexec setup --venv /other/location to specify a different location for the new venv.

However, we strongly suggest leaving the default venv location. If you use a different location, you must also set the environment variable TPA_VENV to that location. For example, add the following line to your .bashrc or other shell startup scripts:

export TPA_VENV="/other/location"