DEB Packages Installation
DEB is a package format that was first developed and distributed by Debian Linux and widely used in Debian Linux distributions and their derivatives, such as Ubuntu Linux. Redrock Postgres provides packages in DEB format that you can download and install on Debian and Ubuntu.
Log in to the host with your
root account, and run the following commands to query installed packages, make sure none postgresql related packages already installed:
# dpkg-query -l | grep postgresql # dpkg-query -l | grep libpq5
Download the DEB Packages for Linux, and run the following commands to install:
# tar xf redrock-<version>.linux.x86_64-deb.tar.gz # cd redrock-<version>.linux.amd64-deb # dpkg -i redrock-libs_<version>_amd64.deb # dpkg -i redrock-client_<version>_amd64.deb # dpkg -i redrock-server_<version>_amd64.deb
In the commands above, the value of version represents the version of Redrock Postgres, e.g., 2.2-1
Other packages can be installed according to your needs.
Table 1. Redrock Postgres DEB Packages
||Key clients and libraries, and documentation|
||Server executables and data files|
||Client shared libraries|
||Extra documentation, such as the tutorial files|
||The contrib source tree, as well as selected binaries|
||PL/Scheme procedural language|
A standard installation of Redrock Postgres using the DEB packages 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|
|Server and contrib documentation||/usr/pgsql-12/doc|
|Templates and other shared data||/usr/pgsql-12/share|
The installation also creates a user named
postgres and a group named
postgres on the system.
After installing the packages, a database needs to be initialized and configured.
The PostgreSQL data directory contains all of the data files for the database. The variable
PGDATA is used to reference this directory.
The default data directory is
If you do not want to use the default data directory, you can go to a custom mount point (eg: /u01) and create a folder
pgdata with postgres permissions:
# cd /u01 # mkdir pgdata # chown postgres:postgres pgdata
Then, edit the postgresql service:
# systemctl edit postgresql.service
Go to the custom mount point that has the majority of the disk space, copy and paste the following into that file:
The first command (only needed once) is to initialize the database in
# /usr/pgsql-12/bin/postgresql-setup initdb
If you want PostgreSQL to start automatically when the OS starts, do the following:
# systemctl enable postgresql.service
To control the database service, use:
# systemctl <command> postgresql.service
where command can be:
- enable : enable automatical start
- start : start the database
- stop : stop the database
- restart : stop/start the database; used to read changes to core configuration files
- reload : reload configuration files while keeping database running
E.g. to start database service, use:
# systemctl start postgresql.service
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
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:
# systemctl restart postgresql.service
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.