Skip to content
logo
Percona Product Documentation
Installing Percona Distribution for PostgreSQL
Initializing search
    percona/postgresql-docs
    percona/postgresql-docs
    • Percona Distribution for PostgreSQL 12 Documentation
    • Installation and Upgrade
      • Installing Percona Distribution for PostgreSQL
        • Repositories overview
        • Install percona-release
        • Enable the repository
        • Install Percona Distribution for PostgreSQL packages
          • Platform Specific Notes
          • Install the Percona Distribution for PostgreSQL components
          • Starting the service
        • Enabling extensions
        • Connect to the PostgreSQL server
      • Migrate from PostgreSQL to Percona Distribution for PostgreSQL
      • Upgrading Percona Distribution for PostgreSQL from 11 to 12
      • Minor Upgrade of Percona Distribution for PostgreSQL
    • Extensions
      • pg_stat_monitor
      • High availability
        • Deploying on Debian or Ubuntu
        • Deploying on RHEL or CentOS
        • Testing the Patroni PostgreSQL Cluster
      • Backup and disaster recovery
        • Deploying backup and disaster recovery solution in Percona Distribution for PostgreSQL
      • LDAP authentication
    • Uninstall
    • Release Notes
      • Percona Distribution for PostgreSQL 12.11 (2022-06-06)
      • Percona Distribution for PostgreSQL 12.10 Second Update (2022-05-05)
      • Percona Distribution for PostgreSQL 12.10 Update (2022-04-14)
      • Percona Distribution for PostgreSQL 12.10 (2022-03-30)
      • Percona Distribution for PostgreSQL 12.9 (2021-12-13)
      • Percona Distribution for PostgreSQL 12.8 Update (2021-12-07)
      • Percona Distribution for PostgreSQL 12.8 (2021-09-09)
      • Percona Distribution for PostgreSQL 12.7 Third Update (2021-07-15)
      • Percona Distribution for PostgreSQL 12.7 Second Update (2021-07-01)
      • Percona Distribution for PostgreSQL 12.7 Update (2021-06-10)
      • Percona Distribution for PostgreSQL 12.7 (2021-05-24)
      • Percona Distribution for PostgreSQL 12.6 Fourth Update (2021-06-10)
      • Percona Distribution for PostgreSQL 12.6 Third Update (2021-05-10)
      • Percona Distribution for PostgreSQL 12.6 Second Update (2021-04-27)
      • Percona Distribution for PostgreSQL 12.6 Update (2021-04-12)
      • Percona Distribution for PostgreSQL 12.6 (2021-03-09)
      • Percona Distribution for PostgreSQL 12.5 (2020-12-07)
      • Percona Distribution for PostgreSQL 12.4 Update (2020-09-22)
      • Percona Distribution for PostgreSQL 12.4 (2020-09-11)
      • Percona Distribution for PostgreSQL 12.3 (2020-06-11)
      • Percona Distribution for PostgreSQL 12.2 (2020-05-15)
    • Licensing
    • Repositories overview
    • Install percona-release
    • Enable the repository
    • Install Percona Distribution for PostgreSQL packages
      • Platform Specific Notes
      • Install the Percona Distribution for PostgreSQL components
      • Starting the service
    • Enabling extensions
    • Connect to the PostgreSQL server

    Installing Percona Distribution for PostgreSQL¶

    Percona provides installation packages in DEB and RPM format for 64-bit Linux distributions. Find the full list of supported platforms on the Percona Software and Platform Lifecycle page.

    Like many other Percona products, we recommend installing Percona Distribution for PostgreSQL from Percona repositories by using the percona-release utility. The percona-release utility automatically enables the required repository for you so you can easily install and update Percona Distribution for PostgreSQL packages and their dependencies through the package manager of your operating system.

    The installation process includes the following steps:

    1. Install percona-release

    2. Enable the repository

    3. Install the packages

    4. Start the postgresql service

    5. Connect to the server

    Repositories overview¶

    There are two repositories available for Percona Distribution for PostgreSQL. We recommend installing Percona Distribution for PostgreSQL from the Major Release repository (e.g. ppg-12) as it includes the latest version packages. Whenever a package is updated, the package manager of your operating system detects that and prompts you to update. As long as you update all Distribution packages at the same time, you can ensure that the packages you’re using have been tested and verified by Percona.

    The Minor Release repository includes a particular minor release of the database and all of the packages that were tested and verified to work with that minor release (e.g. ppg-12.5). You may choose to install Percona Distribution for PostgreSQL from the Minor Release repository if you have decided to standardize on a particular release which has passed rigorous testing procedures and which has been verified to work with your applications. This allows you to deploy to a new host and ensure that you’ll be using the same version of all the Distribution packages, even if newer releases exist in other repositories.

    The disadvantage of using a Minor Release repository is that you are locked in this particular release. When potentially critical fixes are released in a later minor version of the database, you will not be prompted for an upgrade by the package manager of your operating system. You would need to change the configured repository in order to install the upgrade.

    Install percona-release¶

    Install percona-release utility. If you have installed it before, update it to the latest version.

    Enable the repository¶

    As soon as percona-release is installed or up-to-date, enable the repository for Percona Distribution for PostgreSQL (ppg-12). We recommend using the set up command as it enables the specified repository and updates the platform’s package manager database.

    $ sudo percona-release setup ppg-12
    

    To install a specific minor version of Percona Distribution for PostgreSQL, enable the Minor release repository. For example, to install Percona Distribution for PostgreSQL 12.5, enable the ppg-12.5 repository using the following command:

    $ sudo percona-release setup ppg-12.5
    

    Install Percona Distribution for PostgreSQL packages¶

    After you’ve installed percona-release and enabled the desired repository, install Percona Distribution for PostgreSQL using the commands of your package manager (the procedure differs depending on the package manager of your operating system).

    Note

    Debian and other systems that use the apt package manager include the upstream PostgreSQL server package (postgresql-12) by default. The components of Percona Distribution for PostgreSQL 11 can only be installed together with the PostgreSQL server shipped by Percona (percona-postgresql-12). If you wish to use Percona Distribution for PostgreSQL, uninstall the PostgreSQL package provided by your distribution (postgresql-12) and then install the chosen components from Percona Distribution for PostgreSQL.

    Install the percona-postgresql-12 package using apt.

    $ sudo apt install percona-postgresql-12
    

    Platform Specific Notes¶

    If you intend to install Percona Distribution for PostgreSQL on Red Hat Enterprise Linux v8, disable the postgresql and llvm-toolsetmodules:

    $ sudo dnf module disable postgresql llvm-toolset
    

    On CentOS 7, you should install the epel-release package:

    $ sudo yum -y install epel-release
    $ sudo yum repolist
    

    Install the percona-postgresql-12 package using yum install.

    $ sudo yum install percona-postgresql12-server
    

    Install the Percona Distribution for PostgreSQL components¶

    Use the following commands to install components’ packages:

    Install pg_repack:

    $ sudo apt install percona-postgresql-12-repack
    

    Install pgAudit:

    $ sudo apt install percona-postgresql-12-pgaudit
    

    Install pgBackRest:

    $ sudo apt install percona-pgbackrest
    

    Install Patroni:

    $ sudo apt install percona-patroni
    

    Install pg_stat_monitor

    Install PgBouncer:

    $ sudo apt install percona-pgbouncer
    

    Install pgAudit-set_user:

    $ sudo apt install percona-pgaudit12-set-user
    

    Install pgBadger:

    $ sudo apt install percona-pgbadger
    

    Install wal2json:

    $ sudo apt install percona-postgresql-12-wal2json
    

    Install PostgreSQL contrib extensions:

    $ sudo apt install percona-postgresql-contrib
    

    Install pg_repack:

    $ sudo yum install percona-pg_repack12
    

    Install pgAudit:

    $ sudo yum install percona-pgaudit
    

    Install pgBackRest:

    $ sudo yum install percona-pgbackrest
    

    Install Patroni:

    $ sudo yum install percona-patroni
    

    Install pg_stat_monitor

    Install PgBouncer:

    $ sudo yum install percona-pgbouncer
    

    Install pgAudit-set_user:

    $ sudo yum install percona-pgaudit12_set_user
    

    Install pgBadger:

    $ sudo yum install percona-pgbadger
    

    Install wal2json:

    $ sudo yum install percona-wal2json12
    

    Install PostgreSQL contrib extensions:

    $ sudo yum install percona-postgresql12-contrib
    

    Some extensions require additional setup in order to use them with Percona Distribution for PostgreSQL. For more information, refer to Enabling extensions.

    Starting the service¶

    The installation process automatically initializes the and starts the default database. Thus, to check the status of Percona Distribution for PostgreSQL, use the following command:

     ```sh
     $ sudo systemctl status postgresql.service
     ```
    

    After the installation, the default database storage is not automatically initialized. To complete the installation and start Percona Distribution for PostgreSQL, initialize the database using the following command:

    $ /usr/pgsql-12/bin/postgresql-12-setup initdb
    

    Next steps: connect to PostgreSQL.

    Enabling extensions¶

    Some extensions require additional configuration before using them with Percona Distribution for PostgreSQL. This sections provides configuration instructions per extension.

    Patroni

    Patroni is the third-party high availability solution for PostgreSQL. The High Availability in PostgreSQL with Patroni chapter provides details about the solution overview and architecture deployment.

    While setting up a high availability PostgreSQL cluster with Patroni, you will need the following components:

    • Patroni on every postresql node.

    • Distributed Configuration Store (DCS). Patroni supports such DCSs as ETCD, zookeeper, Kubernetes though ETCD is the most popular one. It is available upstream as DEB packages for Debian 10 and Ubuntu 18.04, 20.04.

      For Debian 9 (“stretch”), a DEB package for ETCD is available within Percona Distribution for PostreSQL. You can install it using the following command:

      $ apt install etcd
      

      For CentOS 8, RPM packages for ETCD is available within Percona Distribution for PostreSQL. You can install it using the following command:

      $ yum install etcd python3-python-etcd 
      
    • HAProxy.

    See the configuration guidelines for Debian and Ubuntu and RHEL and CentOS.

    Seealso

    • Patroni documentation

    • Percona Blog:

      • PostgreSQL HA with Patroni: Your Turn to Test Failure Scenarios

    pgBadger

    Enable the following options in postgresql.conf configuration file before starting the service:

    log_min_duration_statement = 0
    log_line_prefix = '%t [%p]: '
    log_checkpoints = on
    log_connections = on
    log_disconnections = on
    log_lock_waits = on
    log_temp_files = 0
    log_autovacuum_min_duration = 0
    log_error_verbosity = default
    

    For details about each option, see pdBadger documentation.

    pgAudit set-user

    Add the set-user to shared_preload_libraries in postgresql.conf. The recommended way is to use the ALTER SYSTEM command. Connect to psql and use the following command:

    $ ALTER SYSTEM SET shared_preload_libraries = 'set-user';
    

    Start/restart the server to apply the configuration.

    You can fine-tune user behavior with the custom parameters supplied with the extension.

    wal2json

    After the installation, enable the following option in postgresql.conf configuration file before starting the service:

    wal_level = logical
    

    Connect to the PostgreSQL server¶

    By default, postgres user and postgres database are created in PostgreSQL upon its installation and initialization. This allows you to connect to the database as the postgres user.

    $ sudo su postgres
    

    Open the PostgreSQL interactive terminal:

    $ psql
    

    Hint

    You can connect to psql as the postgres user in one go:

    $ sudo su postgres psql 
    

    To exit the psql terminal, use the following command:

    $ \q
    

    Contact Us

    For free technical help, visit the Percona Community Forum.

    To report bugs or submit feature requests, open a JIRA ticket.

    For paid support and managed or consulting services , contact Percona Sales.


    Last update: 2022-04-26
    Back to top
    Previous Installation and Upgrade
    Next Migrate from PostgreSQL to Percona Distribution for PostgreSQL
    Percona LLC, © 2022
    Made with Material for MkDocs