How to Install Barman on Arch Linux
Barman is a backup and recovery tool for PostgreSQL that allows you to manage multiple backup servers and databases from a single point of control.
Here we will go through the process to install Barman on Arch Linux.
Prerequisites
Before starting, ensure that your system is up-to-date with the following commands;
sudo pacman -Syu
Installation
Install Barman package from the official repository in Arch Linux by running:
sudo pacman -S barmanOnce the installation is complete, verify the Barman version:
barman versionThe output should look something like this:
2.13.1Next, configure PostgreSQL to enable WAL archiving by modifying the postgresql.conf file. In the file, locate the archive_mode option and set it to on:
archive_mode = onAlso, set the archive_command to call the barman-wal-archive script:
archive_command = '/usr/bin/barman-wal-archive barman_server %(archive_mode)s %p'Save and exit the postgresql.conf file.
Now, restart the PostgreSQL service to apply the changes:
sudo systemctl restart postgresql.serviceCreate a new Barman configuration file by copying the example template:
sudo cp /usr/share/doc/barman/examples/barman.conf.gz /etc/barman.conf.gzUnzip the file using this command:
sudo gunzip /etc/barman.conf.gzThis will create a readable configuration file under /etc/barman.conf.
Edit the configuration file and replace the sample values with your PostgreSQL server details:
[barman] ; BARMAN CONFIGURATION FILE ; ; For instructions on how to fill this file, see ; /usr/share/doc/barman/README.gz. ; [barman] ; Archive information for the PostgreSQL instance to back up [postgresql] description = PostgreSQL server conninfo = host=<hostname> user=barman dbname=<database> backup_method = postgresql streaming_archiver = on slot_name = barman streaming_conninfo = host=<hostname> user=barman dbname=<database> minimum_redundancy = 1 retention_policy = RECOVERY WINDOW OF 2 WEEKSReplace the values
and with your PostgreSQL server hostname and database name. Finally, start the Barman server:
sudo systemctl start barman.serviceYou can check the status of the Barman service with the following command:
sudo systemctl status barman.serviceYou should see something like this if everything works fine:
barman.service - Barman PostgreSQL Backup Manager Loaded: loaded (/usr/lib/systemd/system/barman.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2021-08-02 03:31:02 PET; 5s ago Main PID: 7420 (barman) Tasks: 14 (limit: 9479) Memory: 7.2M CGroup: /system.slice/barman.service |-7420 /usr/bin/python /usr/bin/barman -q main . . Aug 02 03:31:02 my-arch-server barman[7420]: INFO: Barman booted and listening for connections on f…x7f590cdecdd0> Aug 02 03:31:02 my-arch-server barman[7420]: INFO: Starting job schedule
Congratulations, you have successfully installed and configured Barman on Arch Linux.