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.
- Confirm the environment variable
LANG
is set toen_US.UTF-8
.
echo $LANG
- 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
- Install the client packages.
sudo yum install postgresql94
- Install the server packages.
sudo yum install postgresql94-server
- Initialize the database.
sudo /usr/pgsql-9.4/bin/postgresql94-setup initdb
- Enable automatic service start.
sudo systemctl enable postgresql-9.4.service
- Optionally configure a non-default location for PGDATA. See Configuring a non-default value for PGDATA.
- 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
- Start the database.
sudo systemctl start postgresql-9.4.service
- Optionally, change the Postgres user's password and encrypt that password. For information, see Postgres Configuration.
Installing Postgres 9.4 on Ubuntu
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.
- Confirm the environment variable
LANG
is set toen_US.UTF-8
.
echo $LANG
- Create the
/etc/apt/sources.list.d/pgdg.list
file. - 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"
- 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
- 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
- Optionally, edit the Postgres configuration file
pg_hba.conf
located in/etc/postgresql/9.4/main
to enable peer authentication. Use an editor to changeident
tomd5
as follows and save the file.
# IPv4 local connections:
host all all 127.0.0.1/32 md5
- Start Postgres.
sudo service postgresql start
- 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
- Optionally configure a non-default location for PGDATA. See Configuring a non-default value for PGDATA.
- Optionally, change the Postgres user's password and encrypt that password. For information, see Postgres Configuration.
- Install Unzip.
sudo apt install unzip
Configuring a Non-Default Value for PGDATA
on RHEL 7
PGDATA
on RHEL 7The 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.
- Create a non-default directory for
PGDATA
, such as/data/pgdata
, and change its user and group topostgres
.
sudo mkdir /data/pgdata
sudo chown postgres:postgres /data/pgdata
- Ensure the required permissions on the directory.
sudo chmod -R 0700 /data/pgdata
- 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
- 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
Updated over 1 year ago