User GuidesAPI ReferenceRelease Notes
Doc HomeHelp CenterLog In
User Guides

Installing Postgres

Install Postgres 9.4 on RHEL 7 and Ubuntu 18.

In some instances, you may already have Postgres installed. In this case, you can point Tamr to it. For more information on this scenario, see Postgres and also review the Tamr Support Knowledge Base.

Installing Postgres 9.4 on RHEL 7

Before you begin, check the following:

  • Current user is the Tamr functional user, such as tamr.
  • The yum package manager software is available.
  • Outgoing connection to the Internet exists.
  1. Confirm the environment variable LANG is set to en_US.UTF-8.
echo $LANG
  1. Install the repository RPM.
sudo yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-redhat94-9.4-3.noarch.rpm
  1. Install the client packages.
sudo yum install postgresql94
  1. Install the server packages.
sudo yum install postgresql94-server
  1. Initialize the database.
sudo /usr/pgsql-9.4/bin/postgresql94-setup initdb
  1. Enable automatic service start.
sudo systemctl enable postgresql-9.4.service
  1. Optionally configure a non-default location for PGDATA. See Configuring a non-default value for PGDATA.
  2. Enable password authentication. Edit the Postgres configuration file ${PGDATA}/pg_hba.conf and change ident to md5 as follows and save it.
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
  1. Start the database.
sudo systemctl start postgresql-9.4.service
  1. Optionally, change the Postgres user's password and encrypt that password. For information, see Postgres Configuration.

Installing Postgres 9.4 on Ubuntu

important Important: Ubuntu 18.04 reached End of Standard Support in June 2023. See Notice for Ubuntu for recommended steps.

The Postgres 9.4 installation uses the PostgreSQL API Repository, or APT which maintains the PostgreSQL Global Development Group (PGDG) packages.

Before you begin, check the following:

  • Current user is the Tamr functional user, such as tamr.
  • The command line tool for managing packages, Advanced Packaging Tool (APT), or apt-get, is available.
  • Outgoing connection to the Internet exists.
  1. Confirm the environment variable LANG is set to en_US.UTF-8.
echo $LANG
  1. Create the /etc/apt/sources.list.d/pgdg.list file.
  2. Add the path of the Debian distribution repository for Postgres to the end of the file.
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 Postgres.The database is installed in the following directories: /usr/lib/postgresql/9.4/bin, /var/lib/postgresql/9.4, /etc/postgresql/9.4/main.
sudo apt-get install postgresql-9.4 postgresql-contrib-9.4 -y --no-install-recommends
  1. Optionally, edit the Postgres configuration file pg_hba.conf located in /etc/postgresql/9.4/main to enable peer authentication. Use an editor to change ident to md5 as follows and save the file.
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
  1. Start Postgres.
sudo service postgresql start
  1. Download and run the setup-tamr-database.sql script file. See Installing.
psql -f /home/tamr/setup-tamr-database.sql
CREATE ROLE
CREATE DATABASE
exit
  1. Optionally configure a non-default location for PGDATA. See Configuring a non-default value for PGDATA.
  2. Optionally, change the Postgres user's password and encrypt that password. For information, see Postgres Configuration.
  3. Install Unzip.
sudo apt install unzip

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.

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

Before you begin, check that you have installed Postgres 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 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.
sudo rm -rf /var/lib/pgsql/12/data
ln -s /data/pgdata /var/lib/pgsql/12/data 

What’s Next