installation.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. .. include:: global.rst.inc
  2. .. highlight:: bash
  3. .. _installation:
  4. Installation
  5. ============
  6. There are different ways to install Borg:
  7. - :ref:`distribution-package` - easy and fast if a package is
  8. available from your distribution.
  9. - :ref:`pyinstaller-binary` - easy and fast, we provide a ready-to-use binary file
  10. that comes bundled with all dependencies.
  11. - :ref:`source-install`, either:
  12. - :ref:`pip-installation` - installing a source package with pip needs
  13. more installation steps and requires all dependencies with
  14. development headers and a compiler.
  15. - :ref:`git-installation` - for developers and power users who want to
  16. have the latest code or use revision control (each release is
  17. tagged).
  18. .. _distribution-package:
  19. Distribution Package
  20. --------------------
  21. Some distributions might offer a ready-to-use ``borgbackup``
  22. package which can be installed with the package manager.
  23. .. important:: Those packages may not be up to date with the latest
  24. Borg releases. Before submitting a bug
  25. report, check the package version and compare that to
  26. our latest release then review :doc:`changes` to see if
  27. the bug has been fixed. Report bugs to the package
  28. maintainer rather than directly to Borg if the
  29. package is out of date in the distribution.
  30. .. keep this list in alphabetical order
  31. ============ ============================================= =======
  32. Distribution Source Command
  33. ============ ============================================= =======
  34. Alpine Linux `Alpine repository`_ ``apk add borgbackup``
  35. Arch Linux `[community]`_ ``pacman -S borg``
  36. Debian `Debian packages`_ ``apt install borgbackup``
  37. Gentoo `ebuild`_ ``emerge borgbackup``
  38. GNU Guix `GNU Guix`_ ``guix package --install borg``
  39. Fedora/RHEL `Fedora official repository`_ ``dnf install borgbackup``
  40. FreeBSD `FreeBSD ports`_ ``cd /usr/ports/archivers/py-borgbackup && make install clean``
  41. macOS `Homebrew`_ ``brew install borgbackup``
  42. Mageia `cauldron`_ ``urpmi borgbackup``
  43. NetBSD `pkgsrc`_ ``pkg_add py-borgbackup``
  44. NixOS `.nix file`_ ``nix-env -i borgbackup``
  45. OpenBSD `OpenBSD ports`_ ``pkg_add borgbackup``
  46. OpenIndiana `OpenIndiana hipster repository`_ ``pkg install borg``
  47. openSUSE `openSUSE official repository`_ ``zypper in borgbackup``
  48. Raspbian `Raspbian testing`_ ``apt install borgbackup``
  49. Ubuntu `Ubuntu packages`_, `Ubuntu PPA`_ ``apt install borgbackup``
  50. ============ ============================================= =======
  51. .. _Alpine repository: https://pkgs.alpinelinux.org/packages?name=borgbackup
  52. .. _[community]: https://www.archlinux.org/packages/?name=borg
  53. .. _Debian packages: https://packages.debian.org/search?keywords=borgbackup&searchon=names&exact=1&suite=all&section=all
  54. .. _Fedora official repository: https://apps.fedoraproject.org/packages/borgbackup
  55. .. _FreeBSD ports: https://www.freshports.org/archivers/py-borgbackup/
  56. .. _ebuild: https://packages.gentoo.org/packages/app-backup/borgbackup
  57. .. _GNU Guix: https://www.gnu.org/software/guix/package-list.html#borg
  58. .. _pkgsrc: http://pkgsrc.se/sysutils/py-borgbackup
  59. .. _cauldron: http://madb.mageia.org/package/show/application/0/release/cauldron/name/borgbackup
  60. .. _.nix file: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/backup/borg/default.nix
  61. .. _OpenBSD ports: https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/sysutils/borgbackup/
  62. .. _OpenIndiana hipster repository: https://pkg.openindiana.org/hipster/en/search.shtml?token=borg&action=Search
  63. .. _openSUSE official repository: https://software.opensuse.org/package/borgbackup
  64. .. _Homebrew: https://formulae.brew.sh/formula/borgbackup
  65. .. _Raspbian testing: https://archive.raspbian.org/raspbian/pool/main/b/borgbackup/
  66. .. _Ubuntu packages: https://packages.ubuntu.com/xenial/borgbackup
  67. .. _Ubuntu PPA: https://launchpad.net/~costamagnagianfranco/+archive/ubuntu/borgbackup
  68. Please ask package maintainers to build a package or, if you can package /
  69. submit it yourself, please help us with that! See :issue:`105` on
  70. github to followup on packaging efforts.
  71. **Current status of package in the repositories**
  72. .. start-badges
  73. |Packaging status|
  74. .. |Packaging status| image:: https://repology.org/badge/vertical-allrepos/borgbackup.svg
  75. :alt: Packaging status
  76. :target: https://repology.org/project/borgbackup/versions
  77. .. end-badges
  78. .. _pyinstaller-binary:
  79. Standalone Binary
  80. -----------------
  81. .. note:: Releases are signed with an OpenPGP key, see
  82. :ref:`security-contact` for more instructions.
  83. Borg x86/x64 amd/intel compatible binaries (generated with `pyinstaller`_)
  84. are available on the releases_ page for the following platforms:
  85. * **Linux**: glibc >= 2.13 (ok for most supported Linux releases).
  86. Older glibc releases are untested and may not work.
  87. * **Mac OS X**: 10.10 (does not work with older OS X releases)
  88. * **FreeBSD**: 10.2 (unknown whether it works for older releases)
  89. ARM binaries are built by Johann Bauer, see: https://borg.bauerj.eu/
  90. To install such a binary, just drop it into a directory in your ``PATH``,
  91. make borg readable and executable for its users and then you can run ``borg``::
  92. sudo cp borg-linux64 /usr/local/bin/borg
  93. sudo chown root:root /usr/local/bin/borg
  94. sudo chmod 755 /usr/local/bin/borg
  95. Optionally you can create a symlink to have ``borgfs`` available, which is an
  96. alias for ``borg mount``::
  97. ln -s /usr/local/bin/borg /usr/local/bin/borgfs
  98. Note that the binary uses /tmp to unpack Borg with all dependencies. It will
  99. fail if /tmp has not enough free space or is mounted with the ``noexec``
  100. option. You can change the temporary directory by setting the ``TEMP``
  101. environment variable before running Borg.
  102. If a new version is released, you will have to manually download it and replace
  103. the old version using the same steps as shown above.
  104. .. _pyinstaller: http://www.pyinstaller.org
  105. .. _releases: https://github.com/borgbackup/borg/releases
  106. .. _source-install:
  107. From Source
  108. -----------
  109. .. note::
  110. Some older Linux systems (like RHEL/CentOS 5) and Python interpreter binaries
  111. compiled to be able to run on such systems (like Python installed via Anaconda)
  112. might miss functions required by Borg.
  113. This issue will be detected early and Borg will abort with a fatal error.
  114. Dependencies
  115. ~~~~~~~~~~~~
  116. To install Borg from a source package (including pip), you have to install the
  117. following dependencies first:
  118. * `Python 3`_ >= 3.6.0, plus development headers. Even though Python 3 is not
  119. the default Python version on most systems, it is usually available as an
  120. optional install.
  121. * OpenSSL_ >= 1.0.0, plus development headers.
  122. * libacl_ (which depends on libattr_), both plus development headers.
  123. * We have bundled code of the following packages, but borg by default (see
  124. setup.py if you want to change that) prefers a shared library if it can
  125. be found on the system (lib + dev headers) at build time:
  126. - liblz4_ >= 1.7.0 (r129)
  127. - libzstd_ >= 1.3.0
  128. * pkg-config (cli tool) and pkgconfig python package (borg uses these to
  129. discover header and library location - if it can't import pkgconfig and
  130. is not pointed to header/library locations via env vars [see setup.py],
  131. it will fall back to using the bundled code, see above).
  132. These must be present before invoking setup.py!
  133. * some other Python dependencies, pip will automatically install them for you.
  134. * optionally, if you wish to mount an archive as a FUSE filesystem, you need
  135. a FUSE implementation for Python:
  136. - Either pyfuse3_ (preferably, newer and maintained) or llfuse_ (older,
  137. unmaintained now). See also the BORG_FUSE_IMPL env variable.
  138. - See setup.py about the version requirements.
  139. If you have troubles finding the right package names, have a look at the
  140. distribution specific sections below or the Vagrantfile in the git repository,
  141. which contains installation scripts for a number of operating systems.
  142. In the following, the steps needed to install the dependencies are listed for a
  143. selection of platforms. If your distribution is not covered by these
  144. instructions, try to use your package manager to install the dependencies. On
  145. FreeBSD, you may need to get a recent enough OpenSSL version from FreeBSD
  146. ports.
  147. After you have installed the dependencies, you can proceed with steps outlined
  148. under :ref:`pip-installation`.
  149. Debian / Ubuntu
  150. +++++++++++++++
  151. Install the dependencies with development headers::
  152. sudo apt-get install python3 python3-dev python3-pip python3-virtualenv \
  153. libacl1-dev libacl1 \
  154. libssl-dev \
  155. liblz4-dev libzstd-dev \
  156. build-essential \
  157. pkg-config python3-pkgconfig
  158. sudo apt-get install libfuse-dev fuse # needed for llfuse
  159. sudo apt-get install libfuse3-dev fuse3 # needed for pyfuse3
  160. In case you get complaints about permission denied on ``/etc/fuse.conf``: on
  161. Ubuntu this means your user is not in the ``fuse`` group. Add yourself to that
  162. group, log out and log in again.
  163. Fedora
  164. ++++++
  165. Install the dependencies with development headers::
  166. sudo dnf install python3 python3-devel python3-pip python3-virtualenv \
  167. libacl-devel libacl \
  168. openssl-devel \
  169. lz4-devel libzstd-devel \
  170. pkgconf python3-pkgconfig
  171. sudo dnf install gcc gcc-c++ redhat-rpm-config
  172. sudo dnf install fuse-devel fuse # needed for llfuse
  173. sudo dnf install fuse3-devel fuse3 # needed for pyfuse3
  174. openSUSE Tumbleweed / Leap
  175. ++++++++++++++++++++++++++
  176. Install the dependencies automatically using zypper::
  177. sudo zypper source-install --build-deps-only borgbackup
  178. Alternatively, you can enumerate all build dependencies in the command line::
  179. sudo zypper install python3 python3-devel \
  180. libacl-devel openssl-devel \
  181. python3-Cython python3-Sphinx python3-msgpack-python \
  182. python3-pytest python3-setuptools python3-setuptools_scm \
  183. python3-sphinx_rtd_theme gcc gcc-c++
  184. sudo zypper install python3-llfuse # llfuse
  185. Mac OS X
  186. ++++++++
  187. When installing via Homebrew_, dependencies are installed automatically. To install
  188. dependencies manually::
  189. brew install python3 openssl
  190. brew install pkg-config
  191. pip3 install virtualenv
  192. For FUSE support to mount the backup archives, you need at least version 3.0 of
  193. FUSE for OS X, which is available via `github
  194. <https://github.com/osxfuse/osxfuse/releases/latest>`__, or via Homebrew::
  195. brew cask install osxfuse # needed for llfuse
  196. For OS X Catalina and later, be aware that you must authorize full disk access.
  197. It is no longer sufficient to run borg backups as root. If you have not yet
  198. granted full disk access, and you run Borg backup from cron, you will see
  199. messages such as::
  200. /Users/you/Pictures/Photos Library.photoslibrary: scandir: [Errno 1] Operation not permitted:
  201. To fix this problem, you should grant full disk access to cron, and to your
  202. Terminal application. More information `can be found here
  203. <https://osxdaily.com/2020/04/27/fix-cron-permissions-macos-full-disk-access/>`__.
  204. FreeBSD
  205. ++++++++
  206. Listed below are packages you will need to install Borg, its dependencies,
  207. and commands to make FUSE work for using the mount command.
  208. ::
  209. pkg install -y python3 pkgconf
  210. pkg install openssl
  211. pkg install liblz4 zstd
  212. pkg install fusefs-libs # needed for llfuse
  213. pkg install -y git
  214. python3.5 -m ensurepip # to install pip for Python3
  215. To use the mount command:
  216. echo 'fuse_load="YES"' >> /boot/loader.conf
  217. echo 'vfs.usermount=1' >> /etc/sysctl.conf
  218. kldload fuse
  219. sysctl vfs.usermount=1
  220. Windows 10's Linux Subsystem
  221. ++++++++++++++++++++++++++++
  222. .. note::
  223. Running under Windows 10's Linux Subsystem is experimental and has not been tested much yet.
  224. Just follow the Ubuntu Linux installation steps. You can omit the FUSE stuff, it won't work anyway.
  225. Cygwin
  226. ++++++
  227. .. note::
  228. Running under Cygwin is experimental and has not been tested much yet.
  229. Use the Cygwin installer to install the dependencies::
  230. python3 python3-devel libcrypt-devel python3-setuptools
  231. binutils gcc-g++
  232. libopenssl openssl-devel
  233. git make openssh
  234. You can then install ``pip`` and ``virtualenv``::
  235. easy_install-3.6 pip
  236. pip install virtualenv
  237. .. _pip-installation:
  238. Using pip
  239. ~~~~~~~~~
  240. Virtualenv_ can be used to build and install Borg without affecting
  241. the system Python or requiring root access. Using a virtual environment is
  242. optional, but recommended except for the most simple use cases.
  243. .. note::
  244. If you install into a virtual environment, you need to **activate** it
  245. first (``source borg-env/bin/activate``), before running ``borg``.
  246. Alternatively, symlink ``borg-env/bin/borg`` into some directory that is in
  247. your ``PATH`` so you can just run ``borg``.
  248. This will use ``pip`` to install the latest release from PyPi::
  249. virtualenv --python=python3 borg-env
  250. source borg-env/bin/activate
  251. # might be required if your tools are outdated
  252. pip install -U pip setuptools wheel
  253. # install Borg + Python dependencies into virtualenv
  254. pip install borgbackup
  255. # or alternatively (if you want FUSE support):
  256. pip install borgbackup[llfuse] # to use llfuse
  257. pip install borgbackup[pyfuse3] # to use pyfuse3
  258. To upgrade Borg to a new version later, run the following after
  259. activating your virtual environment::
  260. pip install -U borgbackup # or ... borgbackup[llfuse/pyfuse3]
  261. .. _git-installation:
  262. Using git
  263. ~~~~~~~~~
  264. This uses latest, unreleased development code from git.
  265. While we try not to break master, there are no guarantees on anything.
  266. ::
  267. # get borg from github
  268. git clone https://github.com/borgbackup/borg.git
  269. # create a virtual environment
  270. virtualenv --python=${which python3} borg-env
  271. source borg-env/bin/activate # always before using!
  272. # install borg + dependencies into virtualenv
  273. cd borg
  274. pip install -r requirements.d/development.txt
  275. pip install -r requirements.d/docs.txt # optional, to build the docs
  276. pip install -e . # in-place editable mode
  277. or
  278. pip install -e .[pyfuse3] # in-place editable mode, use pyfuse3
  279. or
  280. pip install -e .[llfuse] # in-place editable mode, use llfuse
  281. # optional: run all the tests, on all installed Python versions
  282. # requires fakeroot, available through your package manager
  283. fakeroot -u tox --skip-missing-interpreters
  284. By default the system installation of python will be used.
  285. If you need to use a different version of Python you can install this using ``pyenv``:
  286. ::
  287. ...
  288. # create a virtual environment
  289. pyenv install 3.6.0
  290. pyenv global 3.6.0
  291. pyenv local 3.6.0
  292. virtualenv --python=${pyenv which python} borg-env
  293. source borg-env/bin/activate # always before using!
  294. ...
  295. .. note:: As a developer or power user, you always want to use a virtual environment.