Backup your Linux Server with Duplicati

Self-Hosting Jan 21, 2021

What is Duplicati?

Duplicati is an Open Source backup client that can run encrypted incremental backups to local storage or offsite with support for a large array of different file transfer protocols.

Supported Storage Protocols:

  • FTP
  • OpenStack Object Storage
  • S3 Compatible
  • SFTP (SSH)
  • WebDAV

Proprietary Protocols:

  • Amazon S3
  • Azure Blob
  • B2 Cloud Storage
  • Box.com
  • Dropbox
  • Google Cloud Storage
  • Google Drive
  • HubiC
  • Jottacloud
  • Mega.nz
  • Microsoft Onedrive
  • Microsoft Sharepoint
  • Rackspace CloudFiles
  • Rclone
  • Sia Decentralised Cloud

Install

This will be using Ubuntu 20.04 with Docker Compose but it should work on other distributions without issues.

  1. Install Docker
  2. Install docker-compose:
    sudo apt install docker-compose
  3. Make a duplicati directory to place the docker-compose file within:
    sudo mkdir duplicati
    cd duplicati
  4. Use the following docker compose template:

sudo nano docker-compose.yaml

version: "2.1"
services:
  duplicati:
    image: ghcr.io/linuxserver/duplicati
    container_name: duplicati
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    volumes:
      - ./config:/config
      - <Path to store local backups>:/backups
      #Remove :ro (Read Only) when restoring! 
      - <Path to source for files to backup>:/source:ro
    restart: unless-stopped
    networks:
      default:
        ipv4_address: 10.10.10.10
        
networks:
  default:
    external:
      name: dockernet

Please change the volume locations and potentially the IP.

  1. Startup the docker container:
    sudo docker-compose up -d

  2. Reverse Proxy Setup
    The WebUI operates on port 8200.
    Example Caddy setup:

backup.example.com {
  reverse_proxy 10.10.10.10:8200
}
  1. Set a password for the WebUI, to prevent unauthorised access.
    dupliciti-password

  2. Configure a Name and Encryption Password (Make sure you save this) for your backup.
    dupliciti-step1

  3. Select the storage type and enter your credentials.

  4. Source Data
    The source directory should contain the data you want to backup.
    dupliciti-step3

  5. Select your Backup Schedule
    Once a day is recommended but feel free to adjust this.

  6. You are safe to save this and finish the setup.

  7. Press Run now and hope it runs without errors.

If errors do occur this is probably due to file permissions.

Please note when restoring the data you will want to remove :ro on the source volume otherwise it will be read only.


Cover Image Credit: https://unsplash.com/@benjaminlehman

Tags