2017-09-30 20:01:19 +00:00
|
|
|
..
|
|
|
|
Normally, there are no heading levels assigned to certain characters as the structure is
|
|
|
|
determined from the succession of headings. However, this convention is used in Python’s
|
|
|
|
Style Guide for documenting which you may follow:
|
|
|
|
|
|
|
|
# with overline, for parts
|
|
|
|
* for chapters
|
|
|
|
= for sections
|
|
|
|
- for subsections
|
|
|
|
^ for subsubsections
|
|
|
|
" for paragraphs
|
|
|
|
|
|
|
|
############
|
|
|
|
Installation
|
|
|
|
############
|
|
|
|
|
|
|
|
Packages
|
|
|
|
********
|
|
|
|
|
2018-03-15 18:07:51 +00:00
|
|
|
Note that if at any point the package you’re trying to use is outdated, you
|
|
|
|
always have the option to use an official binary from the restic project.
|
|
|
|
|
|
|
|
These are up to date binaries, built in a reproducible and verifiable way, that
|
|
|
|
you can download and run without having to do additional installation work.
|
|
|
|
|
|
|
|
Please see the :ref:`official_binaries` section below for various downloads.
|
2018-09-04 12:33:26 +00:00
|
|
|
Official binaries can be updated in place by using the ``restic self-update``
|
2018-08-12 21:32:01 +00:00
|
|
|
command.
|
2018-03-15 18:07:51 +00:00
|
|
|
|
2020-10-11 16:31:07 +00:00
|
|
|
Alpine Linux
|
|
|
|
============
|
|
|
|
|
|
|
|
On `Alpine Linux <https://www.alpinelinux.org>`__ you can install the ``restic``
|
|
|
|
package from the official community repos, e.g. using ``apk``:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ apk add restic
|
|
|
|
|
2017-09-30 20:01:19 +00:00
|
|
|
Arch Linux
|
|
|
|
==========
|
|
|
|
|
2023-03-12 23:11:22 +00:00
|
|
|
On `Arch Linux <https://archlinux.org/>`__, there is a package called ``restic``
|
2018-10-20 13:09:52 +00:00
|
|
|
installed from the official community repos, e.g. with ``pacman -S``:
|
2017-09-30 20:01:19 +00:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2018-10-20 13:09:52 +00:00
|
|
|
$ pacman -S restic
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2018-09-04 12:33:26 +00:00
|
|
|
Debian
|
|
|
|
======
|
|
|
|
|
|
|
|
On Debian, there's a package called ``restic`` which can be
|
|
|
|
installed from the official repos, e.g. with ``apt-get``:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ apt-get install restic
|
|
|
|
|
|
|
|
|
|
|
|
Fedora
|
|
|
|
======
|
|
|
|
|
|
|
|
restic can be installed using ``dnf``:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ dnf install restic
|
|
|
|
|
|
|
|
If you used restic from copr previously, remove the copr repo as follows to
|
|
|
|
avoid any conflicts:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ dnf copr remove copart/restic
|
|
|
|
|
2018-09-05 18:41:37 +00:00
|
|
|
macOS
|
|
|
|
=====
|
2018-09-04 12:33:26 +00:00
|
|
|
|
2024-03-09 23:20:26 +00:00
|
|
|
If you are using macOS, you can install restic using `Homebrew <https://brew.sh/>`__:
|
2018-09-04 12:33:26 +00:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ brew install restic
|
|
|
|
|
2023-11-19 10:03:42 +00:00
|
|
|
On Linux and macOS, you can also install it using `pkgx <https://pkgx.sh/>`__:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ pkgx install restic
|
|
|
|
|
2019-01-21 07:13:53 +00:00
|
|
|
You may also install it using `MacPorts <https://www.macports.org/>`__:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ sudo port install restic
|
|
|
|
|
2017-09-30 20:01:19 +00:00
|
|
|
Nix & NixOS
|
|
|
|
===========
|
|
|
|
|
2023-03-22 16:37:58 +00:00
|
|
|
If you are using `Nix / NixOS <https://nixos.org>`__
|
2017-09-30 20:01:19 +00:00
|
|
|
there is a package available named ``restic``.
|
2018-09-04 12:33:26 +00:00
|
|
|
It can be installed using ``nix-env``:
|
2017-09-30 20:01:19 +00:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2018-09-04 12:33:26 +00:00
|
|
|
$ nix-env --install restic
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2018-09-04 12:33:26 +00:00
|
|
|
OpenBSD
|
|
|
|
=======
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2018-09-04 12:33:26 +00:00
|
|
|
On OpenBSD 6.3 and greater, you can install restic using ``pkg_add``:
|
2017-09-30 20:01:19 +00:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2018-09-04 12:33:26 +00:00
|
|
|
# pkg_add restic
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2018-09-05 18:40:28 +00:00
|
|
|
FreeBSD
|
|
|
|
=======
|
|
|
|
|
|
|
|
On FreeBSD (11 and probably later versions), you can install restic using ``pkg install``:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# pkg install restic
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2019-10-28 09:42:58 +00:00
|
|
|
openSUSE
|
|
|
|
========
|
|
|
|
|
|
|
|
On openSUSE (leap 15.0 and greater, and tumbleweed), you can install restic using the ``zypper`` package manager:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# zypper install restic
|
|
|
|
|
2018-03-04 20:50:30 +00:00
|
|
|
RHEL & CentOS
|
|
|
|
=============
|
|
|
|
|
2022-02-06 20:31:18 +00:00
|
|
|
For RHEL / CentOS Stream 8 & 9 restic can be installed from the EPEL repository:
|
2022-02-05 21:18:33 +00:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ dnf install epel-release
|
|
|
|
$ dnf install restic
|
|
|
|
|
|
|
|
For RHEL7/CentOS there is a copr repository available, you can try the following:
|
2018-03-04 20:50:30 +00:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ yum install yum-plugin-copr
|
|
|
|
$ yum copr enable copart/restic
|
|
|
|
$ yum install restic
|
|
|
|
|
2018-06-09 21:41:35 +00:00
|
|
|
If that doesn't work, you can try adding the repository directly, for CentOS6 use:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/copart/restic/repo/epel-6/copart-restic-epel-6.repo
|
|
|
|
|
|
|
|
For CentOS7 use:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/copart/restic/repo/epel-7/copart-restic-epel-7.repo
|
|
|
|
|
2018-03-30 21:36:29 +00:00
|
|
|
Solus
|
|
|
|
=====
|
|
|
|
|
|
|
|
restic can be installed from the official repo of Solus via the ``eopkg`` package manager:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ eopkg install restic
|
2018-03-15 18:07:51 +00:00
|
|
|
|
2018-09-23 16:25:21 +00:00
|
|
|
Windows
|
|
|
|
=======
|
|
|
|
|
|
|
|
restic can be installed using `Scoop <https://scoop.sh/>`__:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
scoop install restic
|
|
|
|
|
|
|
|
Using this installation method, ``restic.exe`` will automatically be available
|
|
|
|
in the ``PATH``. It can be called from cmd.exe or PowerShell by typing ``restic``.
|
|
|
|
|
2018-09-05 18:40:28 +00:00
|
|
|
|
|
|
|
.. _official_binaries:
|
|
|
|
|
2018-03-15 18:07:51 +00:00
|
|
|
Official Binaries
|
|
|
|
*****************
|
|
|
|
|
|
|
|
Stable Releases
|
|
|
|
===============
|
|
|
|
|
|
|
|
You can download the latest stable release versions of restic from the `restic
|
|
|
|
release page <https://github.com/restic/restic/releases/latest>`__. These builds
|
|
|
|
are considered stable and releases are made regularly in a controlled manner.
|
|
|
|
|
|
|
|
There's both pre-compiled binaries for different platforms as well as the source
|
|
|
|
code available for download. Just download and run the one matching your system.
|
|
|
|
|
2020-12-13 16:00:00 +00:00
|
|
|
On your first installation, if you desire, you can verify the integrity of your
|
|
|
|
downloads by testing the SHA-256 checksums listed in ``SHA256SUMS`` and verifying
|
|
|
|
the integrity of the file ``SHA256SUMS`` with the PGP signature in ``SHA256SUMS.asc``.
|
2021-11-19 14:47:59 +00:00
|
|
|
The PGP signature was created using the key (`0x91A6868BD3F7A907 <https://restic.net/gpg-key-alex.asc>`__):
|
2020-12-13 16:00:00 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
pub 4096R/91A6868BD3F7A907 2014-11-01
|
|
|
|
Key fingerprint = CF8F 18F2 8445 7597 3F79 D4E1 91A6 868B D3F7 A907
|
|
|
|
uid Alexander Neumann <alexander@bumpern.de>
|
|
|
|
sub 4096R/D5FC2ACF4043FDF1 2014-11-01
|
|
|
|
|
|
|
|
Once downloaded, the official binaries can be updated in place using the
|
|
|
|
``restic self-update`` command (needs restic 0.9.3 or later):
|
2018-08-12 21:32:01 +00:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ restic version
|
2019-03-30 08:44:59 +00:00
|
|
|
restic 0.9.3 compiled with go1.11.2 on linux/amd64
|
2018-08-12 21:32:01 +00:00
|
|
|
|
|
|
|
$ restic self-update
|
|
|
|
find latest release of restic at GitHub
|
2019-03-30 08:44:59 +00:00
|
|
|
latest version is 0.9.4
|
2018-08-12 21:32:01 +00:00
|
|
|
download file SHA256SUMS
|
|
|
|
download SHA256SUMS
|
|
|
|
download file SHA256SUMS
|
|
|
|
download SHA256SUMS.asc
|
|
|
|
GPG signature verification succeeded
|
2019-03-30 08:44:59 +00:00
|
|
|
download restic_0.9.4_linux_amd64.bz2
|
|
|
|
downloaded restic_0.9.4_linux_amd64.bz2
|
2018-08-12 21:32:01 +00:00
|
|
|
saved 12115904 bytes in ./restic
|
2019-03-30 08:44:59 +00:00
|
|
|
successfully updated restic to version 0.9.4
|
2018-08-12 21:32:01 +00:00
|
|
|
|
|
|
|
$ restic version
|
2019-03-30 08:44:59 +00:00
|
|
|
restic 0.9.4 compiled with go1.12.1 on linux/amd64
|
2018-08-12 21:32:01 +00:00
|
|
|
|
|
|
|
The ``self-update`` command uses the GPG signature on the files uploaded to
|
|
|
|
GitHub to verify their authenticity. No external programs are necessary.
|
|
|
|
|
|
|
|
.. note:: Please be aware that the user executing the ``restic self-update``
|
|
|
|
command must have the permission to replace the restic binary.
|
|
|
|
If you want to save the downloaded restic binary into a different file, pass
|
|
|
|
the file name via the option ``--output``.
|
|
|
|
|
2018-03-15 18:07:51 +00:00
|
|
|
Unstable Builds
|
|
|
|
===============
|
|
|
|
|
|
|
|
Another option is to use the latest builds for the master branch, available on
|
|
|
|
the `restic beta download site
|
|
|
|
<https://beta.restic.net/?sort=time&order=desc>`__. These too are pre-compiled
|
|
|
|
and ready to run, and a new version is built every time a push is made to the
|
|
|
|
master branch.
|
|
|
|
|
2018-01-19 11:24:09 +00:00
|
|
|
Windows
|
|
|
|
=======
|
|
|
|
|
2018-07-18 01:28:23 +00:00
|
|
|
On Windows, put the `restic.exe` binary into `%SystemRoot%\\System32` to use restic
|
2018-01-19 11:24:09 +00:00
|
|
|
in scripts without the need for absolute paths to the binary. This requires
|
2018-07-18 01:28:23 +00:00
|
|
|
administrator rights.
|
2018-01-19 11:24:09 +00:00
|
|
|
|
2017-10-07 14:03:08 +00:00
|
|
|
Docker Container
|
|
|
|
****************
|
|
|
|
|
2018-04-28 14:19:16 +00:00
|
|
|
We're maintaining a bare docker container with just a few files and the restic
|
|
|
|
binary, you can get it with `docker pull` like this:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ docker pull restic/restic
|
|
|
|
|
2023-06-09 10:40:25 +00:00
|
|
|
The container is also available on the GitHub Container Registry:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ docker pull ghcr.io/restic/restic
|
|
|
|
|
2023-06-22 17:03:29 +00:00
|
|
|
Restic relies on the hostname for various operations. Make sure to set a static
|
|
|
|
hostname using `--hostname` when creating a Docker container, otherwise Docker
|
|
|
|
will assign a random hostname each time.
|
|
|
|
|
2017-09-30 20:01:19 +00:00
|
|
|
From Source
|
|
|
|
***********
|
|
|
|
|
|
|
|
restic is written in the Go programming language and you need at least
|
2023-10-23 17:02:20 +00:00
|
|
|
Go version 1.19. Building for Solaris requires at least Go version 1.20.
|
2023-04-07 13:31:20 +00:00
|
|
|
Building restic may also work with older versions of Go,
|
2017-09-30 20:01:19 +00:00
|
|
|
but that's not supported. See the `Getting
|
2023-03-12 23:11:22 +00:00
|
|
|
started <https://go.dev/doc/install>`__ guide of the Go project for
|
2017-09-30 20:01:19 +00:00
|
|
|
instructions how to install Go.
|
|
|
|
|
|
|
|
In order to build restic from source, execute the following steps:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ git clone https://github.com/restic/restic
|
|
|
|
[...]
|
|
|
|
|
|
|
|
$ cd restic
|
|
|
|
|
2020-03-01 10:32:36 +00:00
|
|
|
$ go run build.go
|
2018-08-30 20:49:39 +00:00
|
|
|
|
2017-09-30 20:01:19 +00:00
|
|
|
You can easily cross-compile restic for all supported platforms, just
|
|
|
|
supply the target OS and platform via the command-line options like this
|
|
|
|
(for Windows and FreeBSD respectively):
|
|
|
|
|
2018-04-28 14:19:16 +00:00
|
|
|
.. code-block:: console
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2020-03-01 10:32:36 +00:00
|
|
|
$ go run build.go --goos windows --goarch amd64
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2020-03-01 10:32:36 +00:00
|
|
|
$ go run build.go --goos freebsd --goarch 386
|
2018-08-30 20:49:39 +00:00
|
|
|
|
2020-03-01 10:32:36 +00:00
|
|
|
$ go run build.go --goos linux --goarch arm --goarm 6
|
2018-08-30 20:49:39 +00:00
|
|
|
|
2022-01-10 08:04:18 +00:00
|
|
|
$ go run build.go --goos solaris --goarch amd64
|
|
|
|
|
2017-09-30 20:01:19 +00:00
|
|
|
The resulting binary is statically linked and does not require any
|
|
|
|
libraries.
|
|
|
|
|
|
|
|
At the moment, the only tested compiler for restic is the official Go
|
|
|
|
compiler. Building restic with gccgo may work, but is not supported.
|
|
|
|
|
|
|
|
Autocompletion
|
|
|
|
**************
|
|
|
|
|
2022-09-10 22:44:12 +00:00
|
|
|
Restic can write out man pages and bash/fish/zsh/powershell compatible autocompletion scripts:
|
2017-09-30 20:01:19 +00:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2018-04-12 15:50:26 +00:00
|
|
|
$ ./restic generate --help
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2020-04-03 17:46:30 +00:00
|
|
|
The "generate" command writes automatically generated files (like the man pages
|
2022-09-10 22:44:12 +00:00
|
|
|
and the auto-completion files for bash, fish, zsh and powershell).
|
2017-09-30 20:01:19 +00:00
|
|
|
|
|
|
|
Usage:
|
2020-08-27 03:29:43 +00:00
|
|
|
restic generate [flags] [command]
|
2017-09-30 20:01:19 +00:00
|
|
|
|
|
|
|
Flags:
|
2018-04-12 15:50:26 +00:00
|
|
|
--bash-completion file write bash completion file
|
2021-03-01 02:15:59 +00:00
|
|
|
--fish-completion file write fish completion file
|
2018-04-12 15:50:26 +00:00
|
|
|
-h, --help help for generate
|
|
|
|
--man directory write man pages to directory
|
2022-09-10 22:44:12 +00:00
|
|
|
--powershell-completion write powershell completion file
|
2018-04-12 15:50:26 +00:00
|
|
|
--zsh-completion file write zsh completion file
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2018-04-12 15:50:26 +00:00
|
|
|
Example for using sudo to write a bash completion script directly to the system-wide location:
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2018-04-12 15:50:26 +00:00
|
|
|
.. code-block:: console
|
2017-09-30 20:01:19 +00:00
|
|
|
|
2018-04-12 15:50:26 +00:00
|
|
|
$ sudo ./restic generate --bash-completion /etc/bash_completion.d/restic
|
|
|
|
writing bash completion file to /etc/bash_completion.d/restic
|
2021-02-23 08:32:31 +00:00
|
|
|
|
2022-03-30 08:45:52 +00:00
|
|
|
Example for using sudo to write a zsh completion script directly to the system-wide location:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ sudo ./restic generate --zsh-completion /usr/local/share/zsh/site-functions/_restic
|
|
|
|
writing zsh completion file to /usr/local/share/zsh/site-functions/_restic
|
|
|
|
|
2021-02-23 08:32:31 +00:00
|
|
|
.. note:: The path for the ``--bash-completion`` option may vary depending on
|
|
|
|
the operating system used, e.g. ``/usr/share/bash-completion/completions/restic``
|
|
|
|
in Debian and derivatives. Please look up the correct path in the appropriate
|
|
|
|
documentation.
|
2024-03-16 17:54:27 +00:00
|
|
|
|
|
|
|
Example for setting up a powershell completion script for the local user's profile:
|
|
|
|
|
|
|
|
.. code-block:: pwsh-session
|
|
|
|
|
|
|
|
# Create profile if one does not exist
|
|
|
|
PS> If (!(Test-Path $PROFILE.CurrentUserAllHosts)) {New-Item -Path $PROFILE.CurrentUserAllHosts -Force}
|
|
|
|
|
|
|
|
PS> $ProfileDir = (Get-Item $PROFILE.CurrentUserAllHosts).Directory
|
|
|
|
|
|
|
|
# Generate Restic completions in the same directory as the profile
|
|
|
|
PS> restic generate --powershell-completion "$ProfileDir\restic-completion.ps1"
|
|
|
|
|
|
|
|
# Append to the profile file the command to load Restic completions
|
|
|
|
PS> Add-Content -Path $Profile.CurrentUserAllHosts -Value "`r`nImport-Module $ProfileDir\restic-completion.ps1"
|