How to install borgmatic to CentOS7


Download and install borgmatic as the root user, run the following commands:

sudo pip3 install --user --upgrade borgmatic
Collecting borgmatic
  Downloading (113kB)
    100% |████████████████████████████████| 122kB 4.1MB/s
Collecting requests (from borgmatic)
  Downloading (57kB)
    100% |████████████████████████████████| 61kB 5.9MB/s
Collecting pykwalify<14.06,>=1.6.0 (from borgmatic)
  Downloading (40kB)
    100% |████████████████████████████████| 40kB 6.3MB/s
Collecting ruamel.yaml<0.17.0,>0.15.0 (from borgmatic)
  Downloading (123kB)
    100% |████████████████████████████████| 133kB 5.3MB/s
Collecting colorama<0.5,>=0.4.1 (from borgmatic)
Collecting setuptools (from borgmatic)
  Downloading (583kB)
    100% |████████████████████████████████| 583kB 342kB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->borgmatic)
  Downloading (125kB)
    100% |████████████████████████████████| 133kB 2.5MB/s
Collecting certifi>=2017.4.17 (from requests->borgmatic)
  Downloading (156kB)
    100% |████████████████████████████████| 163kB 3.4MB/s
Collecting idna<2.9,>=2.5 (from requests->borgmatic)
  Downloading (58kB)
    100% |████████████████████████████████| 61kB 5.4MB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests->borgmatic)
  Downloading (133kB)
    100% |████████████████████████████████| 143kB 4.1MB/s
Collecting python-dateutil>=2.4.2 (from pykwalify<14.06,>=1.6.0->borgmatic)
  Downloading (227kB)
    100% |████████████████████████████████| 235kB 422kB/s
Collecting docopt>=0.6.2 (from pykwalify<14.06,>=1.6.0->borgmatic)
Collecting PyYAML>=3.11 (from pykwalify<14.06,>=1.6.0->borgmatic)
  Downloading (265kB)
    100% |████████████████████████████████| 266kB 393kB/s
Collecting ruamel.yaml.clib>=0.1.2; platform_python_implementation == "CPython" and python_version < "3.8" (from ruamel.yaml<0.17.0,>0.15.0->borgmatic)
  Downloading (548kB)
    100% |████████████████████████████████| 552kB 309kB/s
Collecting six>=1.5 (from python-dateutil>=2.4.2->pykwalify<14.06,>=1.6.0->borgmatic)
Installing collected packages: urllib3, certifi, idna, chardet, requests, six, python-dateutil, docopt, PyYAML, pykwalify, ruamel.yaml.clib, ruamel.yaml, colorama, setuptools, borgmatic
  Running install for docopt ... done
  Running install for PyYAML ... done
Successfully installed PyYAML-5.2 borgmatic-1.4.17 certifi-2019.11.28 chardet-3.0.4 colorama-0.4.1 docopt-0.6.2 idna-2.8 pykwalify-1.7.0 python-dateutil-2.8.1 requests-2.22.0 ruamel.yaml-0.16.5 ruamel.yaml.clib-0.2.0 setuptools-42.0.2 six-1.13.0 urllib3-1.25.7

This is a recommended user site installation. You will need to ensure that /root/.local/bin is available on your $PATH so that the borgmatic executable is available. For instance, adding this to root’s ~/.profile or ~/.bash_profile may do the trick:

export PATH="$PATH:~/.local/bin"

Note that your pip binary may have a different name than “pip3”. Make sure you’re using Python 3, as borgmatic does not support Python 2.

Generate a sample configuration file:


Generated a sample configuration file at /etc/borgmatic/config.yaml.

Please edit the file to suit your needs. The values are representative.
All fields are optional except where indicated.

If you ever need help:

Validate that your borgmatic configuration is valid

# validate-borgmatic-config

All given configuration files are valid: /etc/borgmatic/config.yaml