installation.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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. - libb2_ >= 0.98.1 (older do not have pkg-config support)
  129. * pkg-config (cli tool) and pkgconfig python package (borg uses these to
  130. discover header and library location - if it can't import pkgconfig and
  131. is not pointed to header/library locations via env vars [see setup.py],
  132. it will fall back to using the bundled code, see above).
  133. These must be present before invoking setup.py!
  134. * some other Python dependencies, pip will automatically install them for you.
  135. * optionally, if you wish to mount an archive as a FUSE filesystem, you need
  136. a FUSE implementation for Python:
  137. - Either pyfuse3_ (preferably, newer and maintained) or llfuse_ (older,
  138. unmaintained now). See also the BORG_FUSE_IMPL env variable.
  139. - See setup.py about the version requirements.
  140. If you have troubles finding the right package names, have a look at the
  141. distribution specific sections below or the Vagrantfile in the git repository,
  142. which contains installation scripts for a number of operating systems.
  143. In the following, the steps needed to install the dependencies are listed for a
  144. selection of platforms. If your distribution is not covered by these
  145. instructions, try to use your package manager to install the dependencies. On
  146. FreeBSD, you may need to get a recent enough OpenSSL version from FreeBSD
  147. ports.
  148. After you have installed the dependencies, you can proceed with steps outlined
  149. under :ref:`pip-installation`.
  150. Debian / Ubuntu
  151. +++++++++++++++
  152. Install the dependencies with development headers::
  153. sudo apt-get install python3 python3-dev python3-pip python3-virtualenv \
  154. libacl1-dev libacl1 \
  155. libssl-dev libb2-dev \
  156. liblz4-dev libzstd-dev \
  157. build-essential \
  158. pkg-config python3-pkgconfig
  159. sudo apt-get install libfuse-dev fuse # needed for llfuse
  160. sudo apt-get install libfuse3-dev fuse3 # needed for pyfuse3
  161. In case you get complaints about permission denied on ``/etc/fuse.conf``: on
  162. Ubuntu this means your user is not in the ``fuse`` group. Add yourself to that
  163. group, log out and log in again.
  164. Fedora
  165. ++++++
  166. Install the dependencies with development headers::
  167. sudo dnf install python3 python3-devel python3-pip python3-virtualenv \
  168. libacl-devel libacl \
  169. openssl-devel libb2-devel \
  170. lz4-devel libzstd-devel \
  171. pkgconf python3-pkgconfig
  172. sudo dnf install gcc gcc-c++ redhat-rpm-config
  173. sudo dnf install fuse-devel fuse # needed for llfuse
  174. sudo dnf install fuse3-devel fuse3 # needed for pyfuse3
  175. openSUSE Tumbleweed / Leap
  176. ++++++++++++++++++++++++++
  177. Install the dependencies automatically using zypper::
  178. sudo zypper source-install --build-deps-only borgbackup
  179. Alternatively, you can enumerate all build dependencies in the command line::
  180. sudo zypper install python3 python3-devel \
  181. libacl-devel openssl-devel \
  182. python3-Cython python3-Sphinx python3-msgpack-python \
  183. python3-pytest python3-setuptools python3-setuptools_scm \
  184. python3-sphinx_rtd_theme gcc gcc-c++
  185. sudo zypper install python3-llfuse # llfuse
  186. Mac OS X
  187. ++++++++
  188. When installing via Homebrew_, dependencies are installed automatically. To install
  189. dependencies manually::
  190. brew install python3 openssl
  191. brew install pkg-config
  192. pip3 install virtualenv
  193. For FUSE support to mount the backup archives, you need at least version 3.0 of
  194. FUSE for OS X, which is available via `github
  195. <https://github.com/osxfuse/osxfuse/releases/latest>`__, or via Homebrew::
  196. brew cask install osxfuse # needed for llfuse
  197. For OS X Catalina and later, be aware that you must authorize full disk access.
  198. It is no longer sufficient to run borg backups as root. If you have not yet
  199. granted full disk access, and you run Borg backup from cron, you will see
  200. messages such as::
  201. /Users/you/Pictures/Photos Library.photoslibrary: scandir: [Errno 1] Operation not permitted:
  202. To fix this problem, you should grant full disk access to cron, and to your
  203. Terminal application. More information `can be found here
  204. <https://osxdaily.com/2020/04/27/fix-cron-permissions-macos-full-disk-access/>`__.
  205. FreeBSD
  206. ++++++++
  207. Listed below are packages you will need to install Borg, its dependencies,
  208. and commands to make FUSE work for using the mount command.
  209. ::
  210. pkg install -y python3 pkgconf
  211. pkg install openssl
  212. pkg install liblz4 zstd
  213. pkg install fusefs-libs # needed for llfuse
  214. pkg install -y git
  215. python3.5 -m ensurepip # to install pip for Python3
  216. To use the mount command:
  217. echo 'fuse_load="YES"' >> /boot/loader.conf
  218. echo 'vfs.usermount=1' >> /etc/sysctl.conf
  219. kldload fuse
  220. sysctl vfs.usermount=1
  221. Windows 10's Linux Subsystem
  222. ++++++++++++++++++++++++++++
  223. .. note::
  224. Running under Windows 10's Linux Subsystem is experimental and has not been tested much yet.
  225. Just follow the Ubuntu Linux installation steps. You can omit the FUSE stuff, it won't work anyway.
  226. Cygwin
  227. ++++++
  228. .. note::
  229. Running under Cygwin is experimental and has not been tested much yet.
  230. Use the Cygwin installer to install the dependencies::
  231. python3 python3-devel libcrypt-devel python3-setuptools
  232. binutils gcc-g++
  233. libopenssl openssl-devel
  234. git make openssh
  235. You can then install ``pip`` and ``virtualenv``::
  236. easy_install-3.6 pip
  237. pip install virtualenv
  238. .. _pip-installation:
  239. Using pip
  240. ~~~~~~~~~
  241. Virtualenv_ can be used to build and install Borg without affecting
  242. the system Python or requiring root access. Using a virtual environment is
  243. optional, but recommended except for the most simple use cases.
  244. .. note::
  245. If you install into a virtual environment, you need to **activate** it
  246. first (``source borg-env/bin/activate``), before running ``borg``.
  247. Alternatively, symlink ``borg-env/bin/borg`` into some directory that is in
  248. your ``PATH`` so you can just run ``borg``.
  249. This will use ``pip`` to install the latest release from PyPi::
  250. virtualenv --python=python3 borg-env
  251. source borg-env/bin/activate
  252. # might be required if your tools are outdated
  253. pip install -U pip setuptools wheel
  254. # install Borg + Python dependencies into virtualenv
  255. pip install borgbackup
  256. # or alternatively (if you want FUSE support):
  257. pip install borgbackup[llfuse] # to use llfuse
  258. pip install borgbackup[pyfuse3] # to use pyfuse3
  259. To upgrade Borg to a new version later, run the following after
  260. activating your virtual environment::
  261. pip install -U borgbackup # or ... borgbackup[llfuse/pyfuse3]
  262. .. _git-installation:
  263. Using git
  264. ~~~~~~~~~
  265. This uses latest, unreleased development code from git.
  266. While we try not to break master, there are no guarantees on anything.
  267. ::
  268. # get borg from github
  269. git clone https://github.com/borgbackup/borg.git
  270. # create a virtual environment
  271. virtualenv --python=${which python3} borg-env
  272. source borg-env/bin/activate # always before using!
  273. # install borg + dependencies into virtualenv
  274. cd borg
  275. pip install -r requirements.d/development.txt
  276. pip install -r requirements.d/docs.txt # optional, to build the docs
  277. pip install -e . # in-place editable mode
  278. or
  279. pip install -e .[pyfuse3] # in-place editable mode, use pyfuse3
  280. or
  281. pip install -e .[llfuse] # in-place editable mode, use llfuse
  282. # optional: run all the tests, on all supported Python versions
  283. # requires fakeroot, available through your package manager
  284. fakeroot -u tox
  285. By default the system installation of python will be used.
  286. If you need to use a different version of Python you can install this using ``pyenv``:
  287. ::
  288. ...
  289. # create a virtual environment
  290. pyenv install 3.6.0
  291. pyenv global 3.6.0
  292. pyenv local 3.6.0
  293. virtualenv --python=${pyenv which python} borg-env
  294. source borg-env/bin/activate # always before using!
  295. ...
  296. .. note:: As a developer or power user, you always want to use a virtual environment.