Installing pgBackRest from official PostgreSQL Repository

If you are looking to get the pgbackrest package from official repo of pg website, it can be get from the pgdg common repository.

Create the repo file under /etc/yum.repos.d/

# cat > /etc/yum.repos.d/pgdg-common.repo

Append with the repository information

[pgdg-common]
name=PostgreSQL common RPMs for RHEL/CentOS $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

Search for the package and get more info about it.

$ dnf search pgback
$ dnf info pgbackrest.x86_64

In case if the server in an isolated environment below steps may help.

Download without installing the package.

$ dnf install --downloadonly --downloaddir="/home/pgadmininternal/pgbackrest" pgbackrest

Then install the downloaded RPM using # yum localinstall command.

# dnf localinstall libpq5-14.5-42PGDG.rhel8.x86_64.rpm pgbackrest-2.40-1.rhel8.x86_64.rpm -y

If you are directly connected with the internet, use below command right after creating the repo file.

# dnf install libpq5-14.5-42PGDG pgbackrest-2.40-1 -y

Right after installing, check the version.

[root@server1 ~]# pgbackrest version
pgBackRest 2.40
[root@server1 ~]#

Knowing the available options and arguments for the # pgbackrest command.

[root@server1 ~]# pgbackrest help
pgBackRest 2.40 - General help

Usage:
    pgbackrest [options] [command]

Commands:
    archive-get     Get a WAL segment from the archive.
    archive-push    Push a WAL segment to the archive.
    backup          Backup a database cluster.
    check           Check the configuration.
    expire          Expire backups that exceed retention.
    help            Get help.
    info            Retrieve information about backups.
    repo-get        Get a file from a repository.
    repo-ls         List files in a repository.
    restore         Restore a database cluster.
    server          pgBackRest server.
    server-ping     Ping pgBackRest server.
    stanza-create   Create the required stanza data.
    stanza-delete   Delete a stanza.
    stanza-upgrade  Upgrade a stanza.
    start           Allow pgBackRest processes to run.
    stop            Stop pgBackRest processes from running.
    verify          Verify contents of the repository.
    version         Get version.

Use 'pgbackrest help [command]' for more information.
[root@server1 ~]#

That’s it, we are good with installing pgbackrest to start the pgSQL database backups without manual intervention.