installation.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. .. include:: global.rst.inc
  2. .. highlight:: bash
  3. .. _installation:
  4. Installation
  5. ============
  6. There are different ways to install |project_name|:
  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. As |project_name| is
  23. still a young project, such a package might be not available for your system
  24. yet.
  25. ============ ============================================= =======
  26. Distribution Source Command
  27. ============ ============================================= =======
  28. Arch Linux `[community]`_ ``pacman -S borg``
  29. Debian `stretch`_, `unstable/sid`_ ``apt install borgbackup``
  30. NetBSD `pkgsrc`_ ``pkg_add py-borgbackup``
  31. NixOS `.nix file`_ N/A
  32. OS X `Brew cask`_ ``brew cask install borgbackup``
  33. Ubuntu `Xenial 16.04`_, `Wily 15.10 (backport PPA)`_ ``apt install borgbackup``
  34. Ubuntu `Trusty 14.04 (backport PPA)`_ ``apt install borgbackup``
  35. ============ ============================================= =======
  36. .. _[community]: https://www.archlinux.org/packages/?name=borg
  37. .. _stretch: https://packages.debian.org/stretch/borgbackup
  38. .. _unstable/sid: https://packages.debian.org/sid/borgbackup
  39. .. _pkgsrc: http://pkgsrc.se/sysutils/py-borgbackup
  40. .. _Xenial 16.04: https://launchpad.net/ubuntu/xenial/+source/borgbackup
  41. .. _Wily 15.10 (backport PPA): https://launchpad.net/~costamagnagianfranco/+archive/ubuntu/borgbackup
  42. .. _Trusty 14.04 (backport PPA): https://launchpad.net/~costamagnagianfranco/+archive/ubuntu/borgbackup
  43. .. _.nix file: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/backup/borg/default.nix
  44. .. _Brew cask: http://caskroom.io/
  45. Please ask package maintainers to build a package or, if you can package /
  46. submit it yourself, please help us with that! See :issue:`105` on
  47. github to followup on packaging efforts.
  48. If a package is available, it might be interesting to check its version
  49. and compare that to our latest release and review the :doc:`changes`.
  50. .. _pyinstaller-binary:
  51. Standalone Binary
  52. -----------------
  53. .. note:: Releases are signed with an OpenPGP key, see
  54. :ref:`security-contact` for more instructions.
  55. |project_name| binaries (generated with `pyinstaller`_) are available
  56. on the releases_ page for the following platforms:
  57. * **Linux**: glibc >= 2.13 (ok for most supported Linux releases). Maybe older
  58. glibc versions also work, if they are compatible to 2.13.
  59. * **Mac OS X**: 10.10 (does not work with older OS X releases)
  60. * **FreeBSD**: 10.2 (unknown whether it works for older releases)
  61. To install such a binary, just drop it into a directory in your ``PATH``,
  62. make borg readable and executable for its users and then you can run ``borg``::
  63. sudo cp borg-linux64 /usr/local/bin/borg
  64. sudo chown root:root /usr/local/bin/borg
  65. sudo chmod 755 /usr/local/bin/borg
  66. Note that the binary uses /tmp to unpack |project_name| with all dependencies.
  67. It will fail if /tmp has not enough free space or is mounted with the ``noexec`` option.
  68. You can change the temporary directory by setting the ``TEMP`` environment variable before running |project_name|.
  69. If a new version is released, you will have to manually download it and replace
  70. the old version using the same steps as shown above.
  71. .. _pyinstaller: http://www.pyinstaller.org
  72. .. _releases: https://github.com/borgbackup/borg/releases
  73. .. _platforms:
  74. Features & platforms
  75. --------------------
  76. Besides regular file and directory structures, |project_name| can preserve
  77. * Hardlinks (considering all files in the same archive)
  78. * Symlinks (stored as symlink, the symlink is not followed)
  79. * Special files:
  80. * Character and block device files (restored via mknod)
  81. * FIFOs ("named pipes")
  82. * Special file *contents* can be backed up in ``--read-special`` mode.
  83. By default the metadata to create them with mknod(2), mkfifo(2) etc. is stored.
  84. * Timestamps in nanosecond precision: mtime, atime, ctime
  85. * Permissions:
  86. * IDs of owning user and owning group
  87. * Names of owning user and owning group (if the IDs can be resolved)
  88. * Unix Mode/Permissions (u/g/o permissions, suid, sgid, sticky)
  89. On some platforms additional features are supported:
  90. .. Yes/No's are grouped by reason/mechanism/reference.
  91. +------------------+----------+-----------+------------+
  92. | Platform | ACLs | xattr | Flags |
  93. | | [#acls]_ | [#xattr]_ | [#flags]_ |
  94. +==================+==========+===========+============+
  95. | Linux x86 | Yes | Yes | No |
  96. +------------------+ | | |
  97. | Linux PowerPC | | | |
  98. +------------------+ | | |
  99. | Linux ARM | | | |
  100. +------------------+----------+-----------+------------+
  101. | Mac OS X | Yes | Yes | Yes (all) |
  102. +------------------+----------+-----------+ |
  103. | FreeBSD | Yes | Yes | |
  104. +------------------+----------+-----------+ |
  105. | OpenBSD | n/a | n/a | |
  106. +------------------+----------+-----------+ |
  107. | NetBSD | n/a | No [2]_ | |
  108. +------------------+----------+-----------+------------+
  109. | Solaris 11 | No [3]_ | n/a |
  110. +------------------+ | |
  111. | OpenIndiana | | |
  112. +------------------+----------+-----------+------------+
  113. | Windows (cygwin) | No [4]_ | No | No |
  114. +------------------+----------+-----------+------------+
  115. Some Distributions (e.g. Debian) run additional tests after each release, these
  116. are not reflected here.
  117. Other Unix-like operating systems may work as well, but have not been tested at all.
  118. Note that most of the platform-dependent features also depend on the file system.
  119. For example, ntfs-3g on Linux isn't able to convey NTFS ACLs.
  120. .. [2] Feature request :issue:`1332`
  121. .. [3] Feature request :issue:`1337`
  122. .. [4] Cygwin tries to map NTFS ACLs to permissions with varying degress of success.
  123. .. [#acls] The native access control list mechanism of the OS. This normally limits access to
  124. non-native ACLs. For example, NTFS ACLs aren't completely accessible on Linux with ntfs-3g.
  125. .. [#xattr] extended attributes; key-value pairs attached to a file, mainly used by the OS.
  126. This includes resource forks on Mac OS X.
  127. .. [#flags] aka *BSD flags*.
  128. .. _source-install:
  129. From Source
  130. -----------
  131. Dependencies
  132. ~~~~~~~~~~~~
  133. To install |project_name| from a source package (including pip), you have to install the
  134. following dependencies first:
  135. * `Python 3`_ >= 3.4.0, plus development headers. Even though Python 3 is not
  136. the default Python version on most systems, it is usually available as an
  137. optional install.
  138. * OpenSSL_ >= 1.0.0, plus development headers.
  139. * libacl_ (that pulls in libattr_ also), both plus development headers.
  140. * liblz4_, plus development headers.
  141. * some Python dependencies, pip will automatically install them for you
  142. * optionally, the llfuse_ Python package is required if you wish to mount an
  143. archive as a FUSE filesystem. See setup.py about the version requirements.
  144. If you have troubles finding the right package names, have a look at the
  145. distribution specific sections below and also at the Vagrantfile in our repo.
  146. In the following, the steps needed to install the dependencies are listed for a
  147. selection of platforms. If your distribution is not covered by these
  148. instructions, try to use your package manager to install the dependencies. On
  149. FreeBSD, you may need to get a recent enough OpenSSL version from FreeBSD
  150. ports.
  151. After you have installed the dependencies, you can proceed with steps outlined
  152. under :ref:`pip-installation`.
  153. Debian / Ubuntu
  154. +++++++++++++++
  155. Install the dependencies with development headers::
  156. sudo apt-get install python3 python3-dev python3-pip python-virtualenv \
  157. libssl-dev openssl \
  158. libacl1-dev libacl1 \
  159. liblz4-dev liblz4-1 \
  160. build-essential
  161. sudo apt-get install libfuse-dev fuse pkg-config # optional, for FUSE support
  162. In case you get complaints about permission denied on ``/etc/fuse.conf``: on
  163. Ubuntu this means your user is not in the ``fuse`` group. Add yourself to that
  164. group, log out and log in again.
  165. Fedora / Korora
  166. +++++++++++++++
  167. Install the dependencies with development headers::
  168. sudo dnf install python3 python3-devel python3-pip python3-virtualenv
  169. sudo dnf install openssl-devel openssl
  170. sudo dnf install libacl-devel libacl
  171. sudo dnf install lz4-devel
  172. sudo dnf install gcc gcc-c++
  173. sudo dnf install fuse-devel fuse pkgconfig # optional, for FUSE support
  174. Mac OS X
  175. ++++++++
  176. Assuming you have installed homebrew_, the following steps will install all the
  177. dependencies::
  178. brew install python3 lz4 openssl
  179. brew install pkg-config # optional, for FUSE support
  180. pip3 install virtualenv
  181. For FUSE support to mount the backup archives, you need at least version 3.0 of
  182. FUSE for OS X, which is available as a pre-release_.
  183. .. _pre-release: https://github.com/osxfuse/osxfuse/releases
  184. FreeBSD
  185. ++++++++
  186. Listed below are packages you will need to install |project_name|, its dependencies,
  187. and commands to make fuse work for using the mount command.
  188. ::
  189. pkg install -y python3 openssl liblz4 fusefs-libs pkgconf
  190. pkg install -y git
  191. python3.4 -m ensurepip # to install pip for Python3
  192. To use the mount command:
  193. echo 'fuse_load="YES"' >> /boot/loader.conf
  194. echo 'vfs.usermount=1' >> /etc/sysctl.conf
  195. kldload fuse
  196. sysctl vfs.usermount=1
  197. Cygwin
  198. ++++++
  199. .. note::
  200. Running under Cygwin is experimental and has only been tested with Cygwin
  201. (x86-64) v2.5.2.
  202. Use the Cygwin installer to install the dependencies::
  203. python3 python3-setuptools
  204. binutils gcc-g++
  205. libopenssl openssl-devel
  206. liblz4_1 liblz4-devel
  207. git make openssh
  208. You can then install ``pip`` and ``virtualenv``::
  209. easy_install-3.4 pip
  210. pip install virtualenv
  211. .. _pip-installation:
  212. Using pip
  213. ~~~~~~~~~
  214. Virtualenv_ can be used to build and install |project_name| without affecting
  215. the system Python or requiring root access. Using a virtual environment is
  216. optional, but recommended except for the most simple use cases.
  217. .. note::
  218. If you install into a virtual environment, you need to **activate** it
  219. first (``source borg-env/bin/activate``), before running ``borg``.
  220. Alternatively, symlink ``borg-env/bin/borg`` into some directory that is in
  221. your ``PATH`` so you can just run ``borg``.
  222. This will use ``pip`` to install the latest release from PyPi::
  223. virtualenv --python=python3 borg-env
  224. source borg-env/bin/activate
  225. # install Borg + Python dependencies into virtualenv
  226. pip install borgbackup
  227. # or alternatively (if you want FUSE support):
  228. pip install borgbackup[fuse]
  229. To upgrade |project_name| to a new version later, run the following after
  230. activating your virtual environment::
  231. pip install -U borgbackup # or ... borgbackup[fuse]
  232. .. _git-installation:
  233. Using git
  234. ~~~~~~~~~
  235. This uses latest, unreleased development code from git.
  236. While we try not to break master, there are no guarantees on anything. ::
  237. # get borg from github
  238. git clone https://github.com/borgbackup/borg.git
  239. virtualenv --python=python3 borg-env
  240. source borg-env/bin/activate # always before using!
  241. # install borg + dependencies into virtualenv
  242. pip install sphinx # optional, to build the docs
  243. cd borg
  244. pip install -r requirements.d/development.txt
  245. pip install -r requirements.d/fuse.txt # optional, for FUSE support
  246. pip install -e . # in-place editable mode
  247. # optional: run all the tests, on all supported Python versions
  248. # requires fakeroot, available through your package manager
  249. fakeroot -u tox
  250. .. note:: As a developer or power user, you always want to use a virtual environment.