17.1. Installing Postgres Pro Enterprise on Linux
For Linux-based operating systems, Postgres Pro Enterprise is shipped as binary packages. Each Postgres Pro binary distribution consists of several packages. The package structure differs from vanilla PostgreSQL and offers the following installation modes:
Quick installation and setup. The
postgrespro-ent-12
package installs and configures all the components required for a viable ready-to-use configuration of both server and client components. Choose this option if you are going to install a single Postgres Pro instance only, and you are not worried about possible conflicts with other PostgreSQL-based products.Important
Installing the
postgrespro-ent-12
package can delete existing installations of Postgres Pro and PostgreSQL-based products. Similarly, this Postgres Pro installation may be automatically removed if you later install another PostgreSQL-based product. Do not use this package for upgrades or migrations, or if you are going to maintain several installations on the same system.Custom installation. You can select any packages required for your purposes, including development packages. This option needs manual configuration, so a good grasp of Linux and understanding of PostgreSQL architecture are required. This is the only option to choose if you are going to use Postgres Pro in one of the following scenarios:
Install several Postgres Pro versions side by side, or together with other PostgreSQL-based products.
Perform an upgrade from a previous version, or migrate from a different PostgreSQL-based product.
Control Postgres Pro server execution using high availability software, such as pacemaker, instead of the standard system service management facility.
The minimum hardware required to install Postgres Pro, create a database cluster and start the database server are as follows:
1-GHz
processor1 GB
of RAM1 GB
of disk space
Additional disk space is required for data or supporting components.
17.1.1. Supported Linux Distributions
Postgres Pro binary packages are available for the following Linux-based systems:
Red Hat Enterprise Linux (RHEL) systems and its derivatives: CentOS 7/8, Rocky Linux 8, Red Hat Enterprise Linux 7/8, Oracle Linux 7/8, Red OS Murom 7.3, AlterOS 7.5
Debian-based systems: Astra Linux 1.7, Debian 10/11/12, Ubuntu 20.04/22.04
ALT 8/9/10, ALT Linux SPT 7.0, ALT SP 8/8.2 and higher
SUSE Linux Enterprise Server (SLES) 12/15
Note
Postgres Pro binary packages rely on the tzdata library provided by the operating system, so you must ensure that the latest available version is installed. If tzdata is outdated, the time in your database may be incorrect.
17.1.2. Quick Installation and Setup
If you only need to install a single Postgres Pro instance and are not going to use any other PostgreSQL-based products on your system, you can use the quick installation mode. The typical process is as follows:
Add the package repository required for your operating system. You can get the exact repositories and commands for supported Linux distributions from the Postgres Pro Enterprise support team.
Install the
postgrespro-ent-12
package. It will bring all the required components via dependencies, create the default database, start the database server, as well as enable server autostart at system boot and make all the provided programs available inPATH
.
Note
By default, the database configuration is set for the Postgres Pro product being installed. If you need your database configured for a different product, choose custom installation and use the tune
argument of the pg-setup initdb
command.
Once the installation completes, you can launch psql on behalf of the postgres
user and connect to the newly created database, which is located in the /var/lib/pgpro/ent-12/data
directory.
Since the default database is created using the pg-setup script, the path to its data directory is stored in the /etc/default/postgrespro-ent-12
file. All the subsequent pg-setup commands, as well as any commands that manage Postgres Pro service, affect this database only. In this file, you can also change the value of PG_OOM_ADJUST_VALUE
for postmaster child processes (see Section 18.4.4 for details).
17.1.3. Custom Installation
Splitting the distribution into multiple packages enables customizing the installation for different purposes: database servers, client systems, or development workstations. Custom installations need to be configured manually, but give you more flexibility in using the product. You can install several Postgres Pro versions side by side, as well as together with other PostgreSQL-based products. In particular, this may be required when performing upgrades, or migrating from a different PostgreSQL-based product.
To perform a custom installation, complete the following steps:
Add the package repository required for your operating system. You can get the exact repositories and commands for supported Linux distributions from the Postgres Pro Enterprise support team.
Choose Postgres Pro packages required for your purposes and install them using the standard installation commands for your Linux distribution. The available packages are listed in Table 17.1.
As a result, all files get installed into the
/opt/pgpro/ent-12
directory.Run pg-wrapper as root to make the installed client and server programs available via
PATH
and add SQL man pages to the man page configuration file. This utility is provided in thepostgrespro-ent-12-client
package./opt/pgpro/ent-12/bin/pg-wrapper links update
For details on how to handle possible conflicts, see pg-wrapper description.
If you chose to install the
postgrespro-ent-12-server
package, make sure to complete the following server setup:Create the default database by running the helper script pg-setup as root with the
initdb
option:/opt/pgpro/ent-12/bin/pg-setup initdb [--tune=
conf
] [initdb_options
]where:
the
tune
command-line argument sets the database configuration.initdb_options
are regular initdb options.
Note
By default, pg-setup initializes the database cluster with checksums enabled. If this is not what you expect, specify the
--no-data-checksums
.The
pg-setup
script performs database administration operations as userpostgres
. If you do not specify any initdb options, the default database is created in the/var/lib/pgpro/ent-12/data
directory, using localization settings specified in theLANG
environment variable for the current session. All theLC_*
environment variables are ignored.Since the default database is created using the pg-setup script, the path to its data directory is stored in the
/etc/default/postgrespro-ent-12
file. All the subsequent pg-setup commands, as well as any commands that manage Postgres Pro service, affect this database only. In this file, you can also change the value ofPG_OOM_ADJUST_VALUE
for postmaster child processes (see Section 18.4.4 for details).Start the server by running
pg-setup
as root, as follows:/opt/pgpro/ent-12/bin/pg-setup service start
Like vanilla PostgreSQL, Postgres Pro server runs on behalf of the
postgres
user.Note
By default, automatic server startup is disabled, so you can manually control the database recovery after a system reboot. Optionally, you can configure the Postgres Pro server to start automatically. For details, see Section 17.1.3.2.
17.1.3.1. Choosing the Packages to Install
The table below lists all the available Postgres Pro Enterprise packages.
Table 17.1. Postgres Pro Enterprise Packages
Package | Description |
---|---|
| Top-level package that installs and configures Postgres Pro for server and client systems. Do not use this package for upgrades or migrations. Important Installing the |
| Standard client applications, such as psql or pg_dump. |
| Shared libraries required to deploy client applications, including libpq; runtime libraries for ECPG processor. |
| Postgres Pro server and PL/pgSQL server-side programming language. |
| Additional extensions and programs deployable on database servers. |
| Header files and libraries for developing client applications and server extensions. On Debian-based systems, this package is called |
| Server-side programming language based on Perl (see Chapter 46). |
| Server-side programming language based on Python (see Chapter 47). |
| Server-side programming language based on Python 3 (see Chapter 47). |
| Server-side programming language based on Tcl (see Chapter 45). |
| Documentation (English). |
| Documentation (Russian). |
| Test scripts for the server. This package is only available on RHEL-based and SUSE systems. |
| This package provides support for Just-in-Time (JIT) compilation. This package is only available for the supported Debian and Ubuntu systems, ALT 8/9/10, ALT SP 8/8.2 and higher, CentOS 7/8, Astra Linux 1.7, Rocky Linux 8, Oracle Linux 7/8, SLES 15, and RHEL 7/8. To learn more about enabling and using JIT, see Chapter 31. |
| mamonsu — a monitoring agent for collecting Postgres Pro and system metrics. |
| An extension to modify Postgres Pro cursors. |
| pg_probackup utility. |
| pgpro_controldata application to display control information of a PostgreSQL/Postgres Pro database cluster and compatibility information for a cluster and/or server. |
| pgpro_pwr extension that enables you to generate workload reports, which help to discover most resource-intensive activities in your database. |
| pgpro_stats extension that tracks execution statistics of SQL statements, calculates wait event statistics and provides other useful metrics. |
Also, Postgres Pro includes libraries and utilities required for the Postgres Pro server and provided packages. These packages are only provided for the distributions that don't include the required versions of these libraries.
Table 17.2. Third-party libraries and utilities for Postgres Pro Enterprise
Library/utility | Description |
---|---|
| A stack unwinding library used by |
| A backtrace library used by |
| Two Perl libraries used in the TAP test framework available in the |
Besides, there are separate packages providing several external modules that have been pre-built for compatibility with Postgres Pro Enterprise:
Table 17.3. Third-party Packages Built for Postgres Pro Enterprise
Package | Description |
---|---|
| A library for fast lossless data compression. |
| A Postgres Pro extension that provides a foreign data wrapper to access Oracle databases. This package is not available for Windows, ALT Linux 8.0 or lower, and Red OS Murom 7.2 or lower. |
| This package implements in Postgres Pro some of the functions from the Oracle database that are missing (or behaving differently). |
| pg_filedump utility to format Postgres Pro heap/index/control files into a human-readable form. |
| pg_hint_plan module that controls the execution plan by providing hints to the planner. |
| pg_repack extension and utility for reorganizing tables. |
| pgbouncer — a connection pooler for Postgres Pro. |
| pgbadger — Postgres Pro log analyzer that provides detailed reports and graphs. |
| A set of shared libraries that implement an API for debugging PL/pgSQL functions in Postgres Pro. |
| The shared library PLV8 that provides a Postgres Pro procedural language powered by V8 Javascript Engine. This package is available for the supported Debian and Ubuntu systems, ALT 8/9/10, SLES 15, Rosa Enterprise Linux, and RHEL 7/8. |
| Command-line utility for the |
Additionally, Postgres Pro provides separate packages with debug information for some operating systems:
On Debian-based systems, see the
postgrespro-ent-12-dbg
package.On RHEL-based systems, see the
postgrespro-ent-12-debuginfo
package.On ALT Linux systems, all packages containing binary files have the corresponding
-debuginfo
packages.
Server installations require at least the following packages:
postgrespro-ent-12-server
postgrespro-ent-12-client
postgrespro-ent-12-libs
To use additional Postgres Pro extensions, you must also install the postgrespro-ent-12-contrib
package. On Debian-based systems, postgrespro-ent-12-server
package depends on postgrespro-ent-12-contrib
package, so the latter must always be installed together with the server.
For client installations, it is usually enough to install the postgrespro-ent-12-client
and postgrespro-ent-12-libs
packages. If you use custom applications and do not need standard client utilities such as psql, you can install the postgrespro-ent-12-libs
package only.
Development workstations require at least the following packages:
postgrespro-ent-12-libs
postgrespro-ent-12-devel
/postgrespro-ent-12-dev
You may also want to install and configure the server with a test database on development systems. For details on additional configuration that may be required, Section 17.1.4.
17.1.3.2. Enabling Automatic Server Startup
If you are running a custom installation, automatic server startup is disabled by default. Once the default database is created, you can configure the server to start automatically upon system boot using service management solutions available in your operating system or third-party high-availability software. To facilitate this task, postgrespro-ent-12-server
package provides the pg-setup script, which is installed in the /opt/pgpro/ent-12/bin
directory.
To enable server autostart, run the pg-setup script with the following options:
pg-setup service enable
If required, you can disable server autostart using the same script:
pg-setup service disable
Alternatively, you can use system service management solutions directly by running the autostart scripts for SysV-style init.d and systemd provided in the postgrespro-ent-12-server
package. Depending on your Linux distribution, Postgres Pro supports different service management solutions:
Linux Distribution | Provided Scripts |
---|---|
RHEL 7/8 and compatible distributions, SLES 12/15 | systemd unit file |
Debian, Ubuntu, ALT 8/9/10 | Both systemd unit file and SysV-style init.d script |
To use systemd for automatic server startup, run the following command:
systemctl enable postgrespro-ent-12
To use SysV-style init.d script:
On ALT Linux systems, run the following command:
systemctl enable postgrespro-ent-12
On Debian systems, use
update-rc.d
. See the corresponding man page for details.
17.1.4. Setting up Development Workstations
While installing postgrespro-ent-12-libs
and postgrespro-ent-12-devel
/ postgrespro-ent-12-dev
packages may be enough, it is usually convenient to have the server set up on the development system. For quick setup, you can install postgrespro-ent-12
package, which automatically configures the provided client and server programs and creates the default database. However, if you are going to use several PostgreSQL-based products simultaneously, follow the custom installation instructions in Section 17.1.3.
To compile programs with Postgres Pro libraries using the pg_config utility shipped with Postgres Pro, make sure it appears before the path to other pg_config versions, if any. Note that on RHEL-based systems pg_config is not added to PATH
automatically. If you do not have any other pg_config versions on your system, you can use pg-wrapper provided in the postgrespro-ent-12-client
package to create a symbolic link to pg_config in the standard binary directory.
To compile programs using pkg-config command, add the /opt/pgpro/ent-12/lib/pkgconfig/
path to the PKG_CONFIG_PATH
environment variable.
If you would like to compile Postgres Pro extensions that support JIT inlining, make sure to meet the following additional requirements:
Install LLVM development package and Clang compiler. You must choose the packages of the same version that was used for the
postgrespro-ent-12-jit
to be installed on the server. To determine the required version for the current Postgres Pro release, check theCLANG
value in the/opt/pgpro/ent-12/lib/pgxs/src/Makefile.global
file.When running
make
ormake install
commands, specify thewith-llvm=yes
option to compile and install bitcode files for your extension. By default, bitcode compilation is disabled as it depends on Clang compiler availability.
17.1.4.1. Using Third-Party Programs with Postgres Pro
To use Postgres Pro server with a client program provided with a third-party product, you can install the version of PostgreSQL libraries that was used to compile this program. For example, if this program is provided with vanilla PostgreSQL, you may need to install the libpq
or postgresql-libs
packages available for your Linux distribution. In this case, the program may not be able to use some new features of Postgres Pro server, but it is probably not designed to use them anyway.
If you prefer to use Postgres Pro libraries with a third-party program, or would like to enable support for a new feature that does not require client application change, such as SCRAM authentication, you can recompile your program with Postgres Pro libraries.
Important
If the program is compiled with one version of libpq but used with another, its stable work cannot be guaranteed.
If you are creating .rpm
or .deb
packages for your program, it is recommended to do the following:
Add
/opt/pgpro/ent-12/bin
toPATH
inside your build scripts (.spec
files ordebian/rules
).Specify
postgrespro-ent-12-dev
in theBuildDepends
orBuildRequires
tags for your program.
Thus, you can ensure that your package build process calls the right version of pg_config whenever the source package is rebuilt.
17.1.5. Configuring Multiple Postgres Pro Instances
To set up several Postgres Pro server instances with different data directories on Linux, do the following:
Install and configure Postgres Pro as explained in Section 17.1.2 or Section 17.1.3.
Once the first default database is created, run initdb specifying the path to a different data directory and any other parameters required to initialize another server instance.
Specify different ports for your server instances in the corresponding
postgresql.conf
files to avoid conflicts.If required, configure automatic server startup, as follows:
Create a copy of
/etc/init.d/postgrespro-ent-12
or/lib/systemd/system/postgrespro-ent-12.service
with a different name, specifying the path to the data directory.Enable automatic server startup using the provided autostart scripts for your system service management facility instead of
pg-setup
, as described in Section 17.1.3.2. Make sure to use the renamed copies of the scripts you created in step 1.
17.1.6. Antivirus Considerations
It is strongly recommended to avoid using antivirus software on systems where Postgres Pro is running because it may cause additional load on your environment and result in unexpected database behavior that would lead to performance and reliability issues. If you need to use antivirus software, make sure to exclude the following directories from virus scanning as they do not contain any executable files:
PGDATA
directory that stores main cluster data, usually located in/var/lib/pgpro/ent-12/data
unless you specified another directory in initdb optionsPaths to created tablespaces