Redrock Postgres Documentation
Home Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

TAR Package Installation

Redrock Postgres provides binary packages in TAR format for x86 and ARM hardware architectures, which you can download and install on a generic Linux.

Install Packages

Prerequisite

Log in to the host with your root account, and run the following commands, to create a user named postgres and a group named postgres on the system:

# groupadd postgres
# useradd -g postgres -s /bin/bash -m postgres
# passwd postgres

Install Redrock Postgres

Download the TAR Package for Linux, select the installation path (for example: /usr/local), and run the following commands to install:

# cd /usr/local
# tar xf ~/redrock-<version>.linux.x86_64-binaries.tar.gz

In the commands above, the value of version represents the version of Redrock Postgres, e.g., 2.2-1

Installation Layout

A standard installation of Redrock Postgres using the binary package result in files and resources created under the system directories, shown in the following table.

Table 2. Redrock Postgres Installation Layout

Files or Resources Location
Executables /usr/local/redrock/bin
Libraries /usr/local/redrock/lib
Server and contrib documentation /usr/local/redrock/doc
Templates and other shared data /usr/local/redrock/share

Post-installation commands

After installing the packages, a database needs to be initialized and configured.

Create Data Directory

The PostgreSQL data directory contains all of the data files for the database. The variable PGDATA is used to reference this directory. You can go to a custom mount point (eg: /u01), this directory should have the majority of the disk space, and create a folder pgdata with postgres permissions:

# cd /u01
# mkdir pgdata
# chown postgres:postgres pgdata

Configure Environment Variables

If you installed into /usr/local/redrock or some other location that is not searched for programs by default, you should add /usr/local/redrock/bin into your PATH. Strictly speaking, this is not necessary, but it will make the use of PostgreSQL much more convenient.

To do this, you can log in to the host with your postgres account, add the following to your shell start-up file, such as ~/.bash_profile (or /etc/profile, if you want it to affect all users):

PATH=/usr/local/redrock/bin:$PATH
export PATH
PGDATA=/u01/pgdata
export PGDATA

Adding the environment variable to a user’s bash profile alone will not export it automatically. However, the variable will be exported the next time the user logs in. To immediately apply all changes to bash_profile, use the source command.

source ~/.bash_profile

Initialize

Log in to the host with your postgres account, and run the following command (only needed once) is to initialize the database in PGDATA.

$ initdb

To start database service, use:

$ pg_ctl start

After installation

Modify the pg_hba.conf file in data directory to define what authentication policy should be used from all networks to the PostgreSQL server and modify the IPv4 network access control policy (change from localhost to accept all incoming requests). Find the lines below:

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

And change it to:

# IPv4 local connections:
host    all             all             0.0.0.0/0            md5

Modify the postgresql.conf file in data directory to allow connections from all hosts by uncommenting the following line and adding an * instead of localhost:

listen_addresses = '*'

Restart the database service to reload configurations:

$ pg_ctl restart

In a production environment, you should also set up TLS-secured communication, and you should consider setting up data replication or snapshot-based backups. Consult the PostgreSQL online manual for these settings.