2017-09-17 16:14:11 +02:00
+++
title = "Installation"
weight = 20
+++
{{% notice note %}}
Note: check out the [tutorial ]({{< relref "tutorial/_index.md" >}} ) if you want a first impression of zrepl.
{{% /notice %}}
## User Privileges
It is possible to run zrepl as an unprivileged user in combination with
[ZFS delegation ](https://www.freebsd.org/doc/handbook/zfs-zfs-allow.html ).
Also, there is the possibility to run it in a jail on FreeBSD by delegating a dataset to the jail.
However, until we get around documenting those setups, you will have to run zrepl as root or experiment yourself :)
## Installation
zrepl is currently not packaged on any operating system. Signed & versioned releases are planned but not available yet.
2017-09-24 10:52:29 +02:00
Check out the sources yourself, fetch dependencies using dep, compile and install to the zrepl user's `$PATH` .< br />
2017-09-17 16:14:11 +02:00
**Note**: if the zrepl binary is not in `$PATH` , you will have to adjust the examples in the [tutorial ]({{< relref "tutorial/_index.md" >}} ).
```bash
# NOTE: you may want to checkout & build as an unprivileged user
cd /root
git clone https://github.com/zrepl/zrepl.git
cd zrepl
2017-09-24 10:52:29 +02:00
dep ensure
2017-09-17 16:14:11 +02:00
go build -o zrepl
cp zrepl /usr/local/bin/zrepl
rehash
# see if it worked
zrepl help
```
2017-09-18 00:59:59 +02:00
## Configuration Files
2017-09-17 16:14:11 +02:00
2017-09-18 00:59:59 +02:00
zrepl searches for its main configuration file in the following locations (in that order):
2017-09-17 16:14:11 +02:00
* `/etc/zrepl/zrepl.yml`
* `/usr/local/etc/zrepl/zrepl.yml`
2017-09-24 11:02:35 +02:00
Alternatively, use CLI flags to specify a config location.
2017-10-02 12:42:09 +02:00
Copy a config from the [tutorial ]({{< relref "tutorial/_index.md" >}} ) or the `cmd/sampleconf` directory to one of these locations and customize it to your setup.
2017-09-17 16:14:11 +02:00
2017-09-18 00:59:59 +02:00
## Runtime Directories
2017-09-17 16:14:11 +02:00
2017-09-24 11:02:35 +02:00
Check the the [configuration documentation ]({{< relref "configuration/misc.md#runtime-directories-unix-sockets" >}} ) for more information.
2017-09-18 00:59:59 +02:00
For default settings, the following should to the trick.
2017-09-17 16:14:11 +02:00
```bash
mkdir -p /var/run/zrepl/stdinserver
chmod -R 0700 /var/run/zrepl
```
2017-09-18 00:59:59 +02:00
2017-09-17 16:14:11 +02:00
## Running the Daemon
2017-09-24 11:02:35 +02:00
All actual work zrepl does is performed by a daemon process.
2017-09-17 16:14:11 +02:00
2017-09-24 11:02:35 +02:00
Logging is configurable via the config file. Please refer to the [logging documentation ]({{< relref "configuration/logging.md" >}} ).
2017-09-17 16:14:11 +02:00
```bash
2017-09-18 00:59:59 +02:00
zrepl daemon
2017-09-17 16:14:11 +02:00
```
2017-09-24 11:02:35 +02:00
There are no *rc(8)* or *systemd.service(5)* service definitions yet. Note the *daemon(8)* utility on FreeBSD.
2017-09-17 16:14:11 +02:00
{{% notice info %}}
2017-09-24 11:02:35 +02:00
Make sure to actually monitor the error level output of zrepl: some configuration errors will not make the daemon exit.< br / >
Example: if the daemon cannot create the [stdinserver ]({{< relref "configuration/transports.md#stdinserver" >}} ) sockets
in the runtime directory, it will emit an error message but not exit because other tasks such as periodic snapshots & pruning are of equal importance.
2017-09-17 16:14:11 +02:00
{{% / notice %}}
### Restarting
The daemon handles SIGINT and SIGTERM for graceful shutdown.
Graceful shutdown means at worst that a job will not be rescheduled for the next interval.
2017-10-02 12:42:09 +02:00
The daemon exits as soon as all jobs have reported shut down.