Barman

# install barman
apt-get install barman

# generate ssh keys for user barman
sudo -u barman -i
ssh-keygen
cd ~/.ssh/
cp id_rsa.pub authorized_keys
# cat id_rsa.pub and copy it
exit

# generate ssh keys for user postgres
sudo -u postgres -i
ssh-keygen
cd ~/.ssh/
cp id_rsa.pub authorized_keys
# put barman's id_rsa.pub into postgres's authorized_keys
# cat postgres'sid_rsa.pub and copy it
exit

sudo -u barman -i
# put id_rsa.pub postgres's id_rsa.pub into barman's authorized_keys
exit

add config of your postgresql server into /etc/barman.conf:

1
2
3
4
[srv1]
description = "srv1 pgsql"
ssh_command = ssh postgres@127.0.0.1
conninfo = host=127.0.0.1 user=postgres

where srv1 — name of server

barman check
barman status srv1
barman backup srv1
barman cron
man barman