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

  1. Install Barman package from the official repository in Arch Linux by running:

    sudo pacman -S barman
    
  2. Once the installation is complete, verify the Barman version:

    barman version
    

    The output should look something like this:

    2.13.1
    
  3. Next, 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 = on
    
  4. Also, 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.

  5. Now, restart the PostgreSQL service to apply the changes:

    sudo systemctl restart postgresql.service
    
  6. Create a new Barman configuration file by copying the example template:

    sudo cp /usr/share/doc/barman/examples/barman.conf.gz /etc/barman.conf.gz
    
  7. Unzip the file using this command:

    sudo gunzip /etc/barman.conf.gz
    

    This will create a readable configuration file under /etc/barman.conf.

  8. 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 WEEKS
    

    Replace the values and with your PostgreSQL server hostname and database name.

  9. Finally, start the Barman server:

    sudo systemctl start barman.service
    

    You can check the status of the Barman service with the following command:

    sudo systemctl status barman.service
    

    You 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.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!