User GuidesAPI ReferenceRelease NotesEnrichment APIs
Doc HomeHelp CenterLog In

Installing PostgreSQL

Install PostgreSQL 12 on RHEL 7 or Ubuntu 18.

Starting with v2020.012, Tamr Core requires PostgreSQL 12. Tamr recommends that you install or upgrade to the latest available minor version of PostgreSQL 12. For more information, 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 Install PostgreSQL.

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 12 on RHEL 7

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-12 and postgresql12-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 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 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 7

The default value for PGDATA on RHEL is /var/lib/pgsql/12/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-12
  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/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
  1. Restart PostgreSQL.
sudo systemctl start postgresql-12

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:

  • 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-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 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/12/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/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?