# Installation

- Uncompress / clone the client to a local directory
- create a backup target (once for all systems that write their backup there)
- go to jobs directory to copy the *.job.dist files to*.job
- configure *.job files
- manual test run
- create a cronjob

## Installation with git clone

The most easy way to install it and keep it up to date is to use `git clone|pull`.
If you don't have / want to use git see the next chapter "Manual installation: uncompress archive".

As user **root**:

```shell
# Create the directory level above
mdir -p /opt/imlbackup/
cd /opt/imlbackup/

# Get the software into subdir "client"
git clone https://git-repo.iml.unibe.ch/iml-open-source/iml-backup.git client

# to set working directory to /opt/imlbackup/client:
cd client
```

## Manual installation: uncompress archive

To put all files into a directory i.e.

```text
/opt/imlbackup/client
```

then use the **root** user and follow these steps:

```shell
# Create the directory level above
mdir -p /opt/imlbackup/

# download
cd /opt/imlbackup/
wget https://git-repo.iml.unibe.ch/iml-open-source/iml-backup/-/archive/master/iml-backup-master.tar.gz

# extract
tar -xzf iml-backup-master.tar.gz
mv iml-backup-master client

# remove downloaded file
rm -f iml-backup-master.tar.gz

# to set working directory to /opt/imlbackup/client:
cd client
```

## Create backup target

My scenario is a backup target within my company network.

To store all backup data you need diskspace that is mounted on a server (=backup target server).
Maybe you mount a volume of a Ceph cluster or mount an NFS share of a storage system.

The size depends on the count of systems and how many backup sets you want to store.

Restic and Duplicity support several backends.

### Initialize server backup via SSH/ SFTP/ RSync

The backup target server needs a running ssh service.

- As root:
  - create an unprivileged user "imlbackup".
  - allow write permissions for "imlbackup" on /mnt/backupdata
  - Test write permissions:

```shell
su - imlbackup
touch /mnt/backupdata/hello && echo OK
rm -f  /mnt/backupdata/hello
```

* Create an SSH keypair for user "imlbackup"

```
ssh-keygen
```

Now it is time to test access from another system

* copy the created private key (~imlbackup/.ssh/id_rsa) on backup target server to /opt/imlbackup/client/keys/imlbackup@backup-target.example.com
* Open ssh shell with referencing that key

```
ssh -i keys/imlbackup@backup-target.example.com imlbackup@backup-target.example.com
```