# Back up with Duplicati

{{< recipes-disclaimer >}}

## Overview

Duplicati was designed for online backups from scratch. Not only is Duplicati
data efficient, but it also handles network issues nicely. The backup client
allows interrupted backups to resume, and regularly tests the content of
backups. This allows an early detection of broken backups on corrupt storage
systems.

A graphical user interface with a wizard-style interface as well as a
command-line version for usage in headless environments is provided by
Duplicati. Both interfaces use the same core, so they have the same set of
features and capabilities.

This step-by-step guide will help you to get started with Duplicati on Exoscale.
Duplicati is compatible with Linux as well as Windows.

## Setup

### Linux / Ubuntu

1. Create an Exoscale SOS bucket to store your backups.
2. Create an IAM Key to have access to your Exoscale SOS bucket.
3. Install the necessary packages on Ubuntu (see the [Duplicati documentation](https://duplicati.readthedocs.io/en/latest/02-installation/) for details).

For this guide, we use the following commands:
```bash
wget https://updates.duplicati.com/beta/duplicati_2.0.6.3-1_all.deb
apt install ./duplicati_2.0.6.3-1_all.deb
```

Change `/etc/default/duplicati` to add the `webservice` part, and make sure to
restrict access to it in your Security Group settings. See our
[Security Groups section]({{< ref "/product/networking/security-group/" >}})
 for more details.

```bash
cat /etc/default/duplicati
```

Output:

```bash
# Defaults for duplicati initscript
# sourced by /etc/init.d/duplicati
# installed at /etc/default/duplicati by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Additional options that are passed to the Daemon.
DAEMON_OPTS="--webservice-interface=any --webservice-port=8200 --portable-mode"
```

Enable and start the Duplicati service.
```bash
vi /etc/default/duplicati
systemctl enable duplicati.service
```

Output:

```bash
 Created symlink /etc/systemd/system/multi-user.target.wants/duplicati.service → /lib/systemd/system/duplicati.service.
 ```
 
 ```bash
systemctl daemon-reload
systemctl start duplicati.service
systemctl status duplicati.service
```

Output:

```bash
 duplicati.service - Duplicati web-server
 Loaded: loaded (/lib/systemd/system/duplicati.service; enabled; vendor preset: enabled)
 Active: active (running) since Wed 2022-06-01 10:46:52 UTC; 4s ago
 Main PID: 14187 (mono)
 Tasks: 16 (limit: 4672)
 Memory: 33.3M
 CGroup: /system.slice/duplicati.service
     ├─14187 DuplicatiServer /usr/lib/duplicati/Duplicati.Server.exe --webservice-interface=any --webservice-port=8200 --portable-mode
     └─14207 /usr/bin/mono-sgen /usr/lib/duplicati/Duplicati.Server.exe --webservice-interface=any --webservice-port=8200 --portable-mode
 Jun 01 10:46:52 vm2backup systemd[1]: Started Duplicati web-server.
```

4. Connect to the Duplicati web interface to configure your backup.

![](duplicati-setup-1.png "Webinterface")

![](duplicati-setup-2.png "Configure new backup")

![](duplicati-setup-3.png "Set name and security")

**Change to S3 for destination**

![](duplicati-setup-4.png "S3 Destination")

In this example, we are using a bucket in BG-SOF-1 to store our backups.
![](duplicati-setup-5.png "Name bucket")

Select **NO**.
![](duplicati-setup-6.png "Decline automatic naming")

Select **YES**.
![](duplicati-setup-7.png "Create Folder")

> [!NOTE]
> If you run backups from multiple instances to the same bucket, 
> please create separate folders for each instance (such as **vmbackup/"instancename"**)

![](duplicati-setup-8.png "Destination set")

Select the folders and files which you want to back up.
![](duplicati-setup-9.png "Source data")

Define a schedule.
![](duplicati-setup-10.png "Define a scheduele")

Choose your retention.
![](duplicati-setup-11.png "Options")

Confirm that the passphrase will be safely stored.
![](duplicati-setup-12.png "Store passphrase safely")

Click **Run now** to start the backup immediately.
![](duplicati-setup-13.png "Start backup")

Duplicati starts the backup to your bucket.
![](duplicati-setup-14.png "Progress")

## Restore files from the backup

Choose the restore source.
![](duplicati-setup-15.png "Choose restore source")

Select files to restore.
![](duplicati-setup-16.png "Restore - Select files")

Set restore options.
![](duplicati-setup-17.png "Restore - Restore options")

The restore starts.
![](duplicati-setup-18.png "Restore starts")

**Check restore on vm2backup**

```bash
cd /tmp/restore/
ls -ltr
```

Output:

```bash
total 15528
-rw-r--r-- 1 root root 15898608 Jun 17  2021 duplicati_2.0.6.3-1_all.deb
root@vm2backup:/tmp/restore#
```

## Additional resources

[Duplicati User's Manual](https://duplicati.readthedocs.io/en/latest/)

