Before you touch pgBackRest, you need to master the basics of PostgreSQL (psql, pg_ctl, WAL), Linux administration (users, systemd, permissions), and storage concepts. In this episode you'll also set up PostgreSQL 13-18, install pgBackRest 2.59.0, create the repository directory, and prepare SSH for remote mode.

Welcome to the Learn pgBackRest series! This series will take you to mastery of pgBackRest — a reliable, parallel, and scalable PostgreSQL backup & restore solution — from its architecture (repository, stanza, WAL archiving) to configuration, retention, encryption, and production practices for large databases. There are 23 episodes in total, organized into six phases, from conceptual foundations all the way to production readiness.
Before you run pgbackrest backup --type=full, there are foundational skills and tools you must have. Why do these prerequisites matter? Because pgBackRest works at the lowest layer of PostgreSQL: it leverages WAL archiving, communicates with the database server through libpq, and stores files into a repository. Without understanding these layers, you'll struggle to diagnose why archive-push fails or why a restore isn't consistent.
Episode 0 is your roadmap: we'll make sure the foundational skills are in place, set up PostgreSQL, install pgBackRest 2.59.0, create the repository directory, and verify the environment for the first time.
You should be comfortable with PostgreSQL's core concepts: the cluster (a set of databases managed by a single instance), psql (the client), pg_ctl (server control), and especially WAL (Write-Ahead Log). WAL is the transaction log that enables point-in-time recovery — it's the very heart of how pgBackRest works. Practice the following:
psql -U postgres -c "SELECT version();"
pg_ctl status -D /var/lib/postgresql/16/mainAlso understand pg_hba.conf (connection authentication) and postgresql.conf (server configuration) — pgBackRest touches both, particularly the archive_mode and archive_command parameters.
pgBackRest runs as a binary invoked by PostgreSQL (via archive_command) as well as by a scheduler (cron/systemd timer). You must understand user management (useradd), services (systemctl), and file permissions (owner/group/mode). The most common source of problems in production: the repository directory is owned by the wrong user, causing archive-push to fail with permission denied.
The pgBackRest repository can live on local disk, an NFS mount, or object storage (S3-compatible). You need to understand the concepts of mount points, disk size and space, and latency. Remember: a good backup is meaningless if it's stored on the same disk as the database — we'll discuss off-site backups in episode 12.
This series uses PostgreSQL in the version range 13 to 18 — pgBackRest 2.59.0 supports up to 10 PostgreSQL versions at once. Make sure one version is installed and running as a service:
psql -U postgres -c "SHOW server_version;"
systemctl status postgresqlIf it's not installed yet, install it from the distribution repository or PGDG (PostgreSQL Global Development Group):
sudo apt install -y postgresql-16Install pgBackRest 2.59.0 (released 20 July 2026) — the current stable release. From the distribution package:
sudo apt install -y pgbackrest
pgbackrest versionpgbackrest version should print pgbackrest 2.59.0. Alternatively, you can build from source (we'll cover this in more depth in episode 3).
Create the repository directory owned by the postgres user. The default pgBackRest location is /var/lib/pgbackrest:
sudo mkdir -p /var/lib/pgbackrest
sudo chown -R postgres:postgres /var/lib/pgbackrestThis directory will later hold the stanza and all backup files.
Remote mode (repository on another host, or database on another host) requires SSH with key authentication. Make sure ssh is installed and the key has been generated:
ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519We'll configure remote mode in full in episodes 12 and 13. For now, just make sure SSH works without a password.
Before moving on to episode 1, run a thorough verification:
pgbackrest version
psql -U postgres -c "SELECT version();"
ls -ld /var/lib/pgbackrest
ssh -o BatchMode=yes localhost trueAll four commands must succeed: version 2.59.0, PostgreSQL responding, the repository directory owned by postgres, and SSH running without a password prompt.
Warning
Don't store the backup repository on the same partition as the database data. If the disk fails, the backup goes with it. Use a separate mount, NFS, or object storage — this is the architectural decision that most determines the viability of your recovery in the following episodes.
Here's what you've prepared in episode 0:
psql, pg_ctl, pg_hba.conf.pgbackrest version prints the version./var/lib/pgbackrest owned by the postgres user.If anything is missing, stop here and complete it before continuing. The 22-episode journey ahead will go much more smoothly with this strong foundation.
Key takeaways:
/var/lib/pgbackrest must be owned by the postgres user.In the next episode we'll cover the history, background, and why you need pgBackRest — from its inception at Crunchy Data in 2014, the limitations of the fragile pg_basebackup + WAL archiving scripts, to the parallel backup, continuous WAL archiving, precise PITR, and retention policy features that made it the modern standard for PostgreSQL backups. Make sure your environment is ready, because the Learn pgBackRest journey has only just begun!