HomeTamr Core GuidesTamr Core API Reference
Tamr Core GuidesTamr Core API ReferenceTamr Core TutorialsEnrichment API ReferenceSupport Help CenterLog In

Installing PostgreSQL

Install PostgreSQL 12 on RHEL 7 and Ubuntu 18.

Supported Installation

For single-node Azure and GCP deployments, Tamr only supports installing PostgreSQL on the same server as Tamr. See Install Postgres and Create the Database.

For single-node AWS deployments, Tamr recommends installing PostgreSQL on the same server as Tamr. If required, you can install Postgres 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 on AWS and ensure that there is a route between the Tamr VM and the RDS network.

PostgreSQL 12 is Required

Starting with Tamr 2020.012, Tamr requires PostgreSQL 12. Before upgrading to Tamr 2020.012, you must upgrade your instance of PostgreSQL to version 12. Earlier versions of PostgreSQL are not supported beginning with Tamr 2020.012. For more information, see Upgrading PostgreSQL.

Beginning with PostgreSQL 10, a new Versioning Policy is in effect. PostgreSQL 12 denotes a major version of PostgreSQL that is required by Tamr. Minor releases of PostgreSQL contain only bug and security fixes and are fully compatible with each other. Tamr recommends that you install or upgrade to the latest available minor version of PostgreSQL 12.

Pointing Tamr to an Installed PostgreSQL Instance

For single-node AWS deployments only, if you already have PostgreSQL installed in your environment, you can point Tamr to it. For more information, see Configuring PostgreSQL.

Installing PostgreSQL 12 on RHEL 7

Before you begin, check the following:

  • Current user is an admin user with privileges to install and configure packages.
  • The yum package manager software is available.
  • Outgoing connection to the Internet exists.
    or
  • Your organization's package repository has the postgresql-12 and postgresql12-server packages.

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

To install PostgreSQL 12 on RHEL 7

  1. Confirm that the environment variable LANG is set to en_US.UTF-8.
sudo echo $LANG
  1. Install the repository RPM.
sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
  1. Install the PostgreSQL server:
sudo yum install postgresql12-server
  1. Initialize the database:
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
  1. Enable the automatic start of the PostgreSQL service.
sudo systemctl enable postgresql-12
sudo systemctl start postgresql-12
  1. Enable password authentication. Edit the PostgreSQL configuration file pg_hba.conf located (by default) in /var/lib/pgsql/12/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-12
  1. Optional. Configure a non-default location for PGDATA (the PostgreSQL data directory). Tamr recommends placing PGDATA in the same directory where the Tamr software package is installed. The size of PGDATA can be around 1GB, because Tamr stores only limited amount of data in this directory. For more information about setting PGDATA, see the following section on this page.
  2. Optional. Change the PostgreSQL user password and encrypt that password. For information, see Configuring PostgresSQL.

Configuring a Non-Default Value for PGDATA on RHEL 7

The default value of PGDATA on RHEL is /var/lib/pgsql/12/data. To change it to a custom value, use one of the following procedures:

Configuring a Non-Default Value by Soft-Linking the Directory

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

Before you begin, check that you have installed PostgreSQL and it is not running.

  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 chmod -R 0700 /data/pgdata
  1. As the user postgres, change to the directory /var/lib/pgsql/12/data and copy all files within to the directory /data/pgdata.
sudo su - postgres
cd /var/lib/pgsql/12/data
cp -R * /data/pgdata
  1. As the user postgres, remove the directory /var/lib/pgsql/12/data and create a soft link to the directory /data/pgdata.
rm -rf /var/lib/pgsql/12/data
ln -s /data/pgdata /var/lib/pgsql/12/data 
exit

Configuring a Non-Default Value by Editing the Service Definition

Important: Tamr does NOT recommend this method since the service definition can be modified during system updates.

Before you begin, check that you have installed PostgreSQL and it is not running.

To configure a non-default value for PGDATA via the service definition

  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 chmod -R 0700 /data/pgdata
  1. Edit the service definition and change the value of PGDATA to /data/pgdata.
sudo vi /usr/lib/systemd/system/postgresql-12.service
  1. Reload the service.
sudo systemctl daemon-reload
  1. Initialize the PostgreSQL database.
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb

Installing PostgreSQL 12 on Ubuntu 18

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

Before you begin, check the following:

  • Current user is an admin user with privileges to install and configure packages.
  • The command line tool for managing packages, Advanced Packaging Tool (APT), or apt-get, is available.
  • Outgoing connection to the Internet exists.
    or
  • Your organization's package repository has the postgresql-12 and postgresql12-server packages.

To install PostgreSQL 12 on Ubuntu 18

  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/ bionic-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/12/bin, /var/lib/postgresql/12, /etc/postgresql/12/main.
sudo apt-get install postgresql-12 postgresql-client-12 -y --no-install-recommends
  1. Edit the PostgreSQL configuration file pg_hba.conf located in /etc/postgresql/12/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 software package is installed. The size of PGDATA can be around 1GB, because Tamr stores only limited amount of data in this directory. For more information about setting PGDATA, see the following section on this page.
  2. Optional. Change the PostgreSQL user password and encrypt that password. For information, see Configuring PostgresSQL.

Configuring a Non-Default Value for PGDATA on Ubuntu

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

Before you begin, check that you have installed PostgreSQL and 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 chmod -R 0700 /data/pgdata
  1. As the user postgres, change to the directory /var/lib/postgresql/12/main and copy all files within to the directory /data/pgdata.
cd /var/lib/postgresql/12/main
cp -R * /data/pgdata
  1. As the user postgres, remove the directory /var/lib/postgresql/12/main and create a soft link to the directory /data/pgdata.
rm -rf /var/lib/postgresql/12/main
ln -s /data/pgdata /var/lib/postgresql/12/main

Did this page help you?