16

I need to use the pg_basebackup/pg_dump program on an Ubuntu 18.04 system to connect to a remote PostgreSQL 11.6 server.

However, the current system only contains pg_basebackup 10.10 and the remote database is using PostgreSQL 11.6. Running pg_basebackup give the error

pg_basebackup: incompatible server version 11.6

Tried to install the correct version of pg_basebackup using the command:

apt install postgresql-client-11

but the apt package is not found. Only postgresql-client, postgresql-client-10 and postgresql-client-common are available the system's apt repos.

Question: How can we install the correct version of pg_basebackup without having to copy it over from the remote database server, and without installing PostgreSQL 11.6 on this machine?

1 Answer 1

34

Install it from PostgreSQL's own apt repository, adapted from these instructions.

sudo apt-get install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt install postgresql-client-11
pg_basebackup -V

pg_basebackup (PostgreSQL) 11.7 (Ubuntu 11.7-1.pgdg18.04+1)

1
  • 3
    This also works with version 12 (using sudo apt install postgresql-client-12) Commented Jul 1, 2020 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.