Postgresql – how to install pg_archivecleanup for postgresql 9.3 on Ubuntu

postgresqlreplication

I am trying to get streaming replication working with postgresql 9.3 on Ubuntu 13.04 (Raring Ringtail). I installed postgresql on master and slave by doing:

apt-get install postgresql

I believe I have all the bits in place for replication, except, pg_archivecleanup does not work. If I attempt to run it, I get it

The program 'pg_archivecleanup' is currently not installed. You can install it by typing: apt-get install postgres-xc-contrib

But that package installs Postgres-XC and blows up my postgresql which I do not wish to do.

The best my googling has come up with is this thread wherein a guy has the same issue with 9.2 and the only response is "You probably need to install -contrib subpackage as well." But doing:

apt-get install postgresql-contrib

I get:

postgresql-contrib is already the newest version.

So how the heck do I get pg_archivecleanup installed for PostgreSQL 9.3 on Ubuntu 13.04 (Raring Ringtail)?

Thanks!

Brad

Best Answer

postgresql-contrib is a metapackage that depending on the context leads to the install of postgresql-contrib-9.3. The latter contains the files of interest.

Normally if you ran: dpkg -L postgresql-contrib-9.3 you should see among the files:

/usr/lib/postgresql/9.3/bin/pg_archivecleanup

It's not in the default PATH, but that's expected.

And in reverse, the command dpkg -S pg_archivecleanup should output postgresql-contrib-9.3.

The suggestion from the shell's command-not-found handler to get it from postgres-xc is just not helpful in this case. Presumably it hits the first package that contains the command name.