User GuidesAPI ReferenceRelease Notes
Doc HomeHelp CenterLog In
User Guides

Installing PostgreSQL

Install PostgreSQL 15 on RHEL or Ubuntu.

Install PostgreSQL 15 on RHEL or Ubuntu. See Requirements for Installing Tamr Core for supported OS versions. To ensure your installation has the latest bug and security fixes, install or upgrade to the latest minor version of PostgreSQL v15.

For upgrade instructions, see Upgrading PostgreSQL.

Supported Installations

For single-node Azure and GCP deployments:

Tamr only supports installing PostgreSQL on the same server as Tamr Core. See Installing Tamr Core.

For single-node AWS deployments:

Tamr recommends installing PostgreSQL on the same server as Tamr Core.

  • If required, you can install PostgreSQL on a separate AWS RDS Postgres instance using the Tamr AWS RDS Terraform module. If deploying via RDS, you must follow Tamr's terraform module instructions in Deploying Tamr Core on AWS and ensure that there is a route between the Tamr Core VM and the RDS network.
  • If you already have PostgreSQL installed in your environment, you can point Tamr Core to it. For more information, see Configuring PostgreSQL.

Installing PostgreSQL 15 on RHEL

Before You Begin:

  • Verify that the current user is an admin user with privileges to install and configure packages.
  • Verify that the yum package manager software is available.
  • Verify either that an outgoing connection to the Internet exists,
    or
  • Your organization's package repository has the postgresql-15 and postgresql15-server packages.

The following installation instructions are based on the procedure described in the RHEL YUM PostgreSQL Repository, which maintains the PostgreSQL packages for RHEL.

To install PostgreSQL 15 on RHEL:

  1. Confirm that the environment variable LANG is set to en_US.UTF-8.
sudo echo $LANG
  1. Install the repository RPM. The command you use differs based on the version of RHEL you are running.

RHEL 9:

sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm

RHEL 8.6:

sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

RHEL 7:

sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
  1. RHEL 9 and 8.6 only: Disable the built-in PostgreSQL module:
sudo dnf -qy module disable postgresql
  1. Install the PostgreSQL server. The command you use differs based on the version of RHEL you are running.

RHEL 9 or 8.6:

sudo dnf install -y postgresql15-server

RHEL 7:

sudo yum install postgresql15-server
  1. Initialize the database.
sudo /usr/pgsql-12/bin/postgresql-15-setup initdb
  1. Enable the automatic start of the PostgreSQL service.
sudo systemctl enable postgresql-15
sudo systemctl start postgresql-15
  1. Enable password authentication. Edit the PostgreSQL configuration file pg_hba.conf located (by default) in /var/lib/pgsql/15/data to change the settings for IPv4 and IPv6 local connections as follows, and save the file.
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
  1. Restart the database.
sudo systemctl restart postgresql-15
  1. Use the PostgreSQL interactive terminal to verify that idle_in_transaction_session_timeout is set to 0.
SHOW idle_in_transaction_session_timeout;
  1. Optional. Configure a non-default location for the PostgreSQL data directory (PGDATA). Tamr recommends placing PGDATA in the same directory where the Tamr Core software package is installed. The size of PGDATA can be around 1GB, because Tamr Core stores only limited amount of data in this directory. For more information about setting PGDATA, see the next section in this topic.
  2. Optional. Change the PostgreSQL user password and encrypt that password. See Configuring PostgresSQL.

Configuring a Non-Default Value for PGDATA on RHEL

The default value for PGDATA on RHEL is /var/lib/pgsql/15/data. You can change it to a different value by soft linking the directory.

Before You Begin:
Check that you have installed PostgreSQL.

To configure a non-default value for PGDATA via a soft-link:

  1. Ensure that PostgreSQL is not running.
sudo systemctl stop postgresql-15
  1. Create a non-default directory for PGDATA, such as /data/pgdata, and change its user and group to postgres.
sudo mkdir /data/pgdata
sudo chown postgres:postgres /data/pgdata
  1. Ensure the required permissions are set for the directory.
sudo setfacl -Rm u:postgres:r /data
sudo setfacl -Rm u:postgres:x /data
sudo chmod -R 0700 /data/pgdata
  1. As the user postgres, change to the directory /var/lib/pgsql/15/data and copy all files within to the directory /data/pgdata.
sudo su - postgres
cd /var/lib/pgsql/15/data
cp -R * /data/pgdata
  1. As the user postgres, remove the directory /var/lib/pgsql/15/data and create a soft link to the directory /data/pgdata.
rm -rf /var/lib/pgsql/15/data
ln -s /data/pgdata /var/lib/pgsql/15/data 
exit
  1. Restart PostgreSQL.
sudo systemctl start postgresql-15

Installing PostgreSQL 15 on Ubuntu

These PostgreSQL 15 installation instructions are based on instructions from the PostgreSQL APT Repository, or APT, which maintains the PostgreSQL Global Development Group (PGDG) packages.

Before You Begin:

  • Verify that the current user is an admin user with privileges to install and configure packages.
  • Verify that the command line tool for managing packages, Advanced Packaging Tool (APT), or apt-get, is available.
  • Verify either that an outgoing connection to the Internet exists,
    or
  • Your organization's package repository has the postgresql-15 and postgresql15-client packages.

To install PostgreSQL 15 on Ubuntu:

  1. Confirm the environment variable LANG is set to en_US.UTF-8.
sudo echo $LANG
  1. Add the path of the Debian distribution repository for PostgreSQL to the end of the file /etc/apt/sources.list.d/pgdg.list, creating it if it doesn't exist.
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main' >> /etc/apt/sources.list.d/pgdg.list"
  1. Import the repository signing key, and update the package lists.
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
  1. Install PostgreSQL. PostgreSQL is installed in the following directories: /usr/lib/postgresql/15/bin, /var/lib/postgresql/15, /etc/postgresql/15/main.
sudo apt-get install postgresql-15 postgresql-client-15 -y --no-install-recommends
  1. Edit the PostgreSQL configuration file pg_hba.conf located in /etc/postgresql/1/main to verify that peer authentication is enabled. Use an editor to change the settings for IPv4 and IPv6 local connections as follows, and save the file.
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
  1. Restart the PostgreSQL service.
sudo service postgresql start
  1. Optional. Configure a non-default location for PGDATA. Tamr recommends placing PGDATA in the same directory where the Tamr Core software package is installed. The size of PGDATA can be around 1GB, because Tamr Core stores only limited amount of data in this directory. For more information about setting PGDATA, see the next section in this topic.
  2. Optional. Change the PostgreSQL user password and encrypt that password. See Configuring PostgreSQL.

Configuring a Non-Default Value for PGDATA on Ubuntu

The default value of PGDATA on Ubuntu is /var/lib/postgresql/15/main.

Before You Begin:
Check that you have installed PostgreSQL and that it is not running.

To configure a non-default value for PGDATA on Ubuntu:

  1. Create a non-default directory for PGDATA, such as /data/pgdata, and change its user and group to postgres.
sudo mkdir /data/pgdata
sudo chown postgres:postgres /data/pgdata
  1. Ensure the required permissions on the directory.
sudo setfacl -Rm u:postgres:r /data
sudo chmod -R 0700 /data/pgdata
  1. As the user postgres, change to the directory /var/lib/postgresql/15/main and copy all files within to the directory /data/pgdata.
cd /var/lib/postgresql/15/main
cp -R * /data/pgdata
  1. As the user postgres, remove the directory /var/lib/postgresql/15/main and create a soft link to the directory /data/pgdata.
rm -rf /var/lib/postgresql/15/main
ln -s /data/pgdata /var/lib/postgresql/12/main