Duplicati is an open-source, self-hosted backup solution designed to securely manage and store your data on your preferred destination, including cloud storage providers or local file systems. It offers advanced encryption, compression, and deduplication features, making it an excellent choice for users who value data control and customization. In this guide, youโll learn how to install, configure, manage, and leverage Duplicatiโs unique features through practical, code-focused examples.
Installing Duplicati
๐ฆ Docker/Docker Compose Setup
The easiest way to deploy Duplicati is via Docker. Below is a docker-compose.yml
configuration tailored for Duplicati.
version: '3.7'
services:
duplicati:
image: lscr.io/linuxserver/duplicati:latest
container_name: duplicati
environment:
- PUID=1000 # Adjust this to your user ID
- PGID=1000 # Adjust this to your group ID
- TZ=Etc/UTC # Set the correct timezone
volumes:
- /path/to/config:/config # Path to store configuration files
- /path/to/backups:/backups # Path where backups will be stored
ports:
- 8200:8200 # Port for accessing the web interface
restart: unless-stopped
Deploy the container using the following commands:
nano docker-compose.yml
## Start the container
docker-compose up -d
## Confirm Duplicati is running
docker ps | grep duplicati
Access the web interface at http://<your-server-ip>:8200
.
๐ Manual Installation
To install Duplicati manually on a Linux server, follow these steps:
## Update your system
sudo apt update && sudo apt upgrade -y
## Install required dependencies
sudo apt install -y wget apt-transport-https gnupg
## Add Duplicatiโs repository and key
wget https://updates.duplicati.com/beta/duplicati.asc
sudo apt-key add duplicati.asc
echo "deb https://updates.duplicati.com/beta/ stable main" | sudo tee /etc/apt/sources.list.d/duplicati.list
## Install Duplicati
sudo apt update
sudo apt install -y duplicati
## Enable and start the Duplicati service
sudo systemctl enable duplicati
sudo systemctl start duplicati
## Check service status
sudo systemctl status duplicati
Access the Duplicati interface at http://<your-server-ip>:8200
.
Configuring Nginx as a Reverse Proxy
๐ Nginx Configuration
Set up Nginx to route traffic to Duplicati for better accessibility and security. Below is an example duplicati.conf
:
server {
listen 80;
server_name backup.example.com;
location / {
proxy_pass http://127.0.0.1:8200;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Save the configuration file in /etc/nginx/sites-available/duplicati.conf
and create a symbolic link:
sudo ln -s /etc/nginx/sites-available/duplicati.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
๐ SSL/TLS Setup
Secure your Duplicati instance with Letโs Encrypt using Certbot:
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d backup.example.com
Automate certificate renewal:
sudo crontab -e
## Add the following line
0 3 * * * /usr/bin/certbot renew --quiet
๐ ๏ธ Testing and Reloading Nginx
Check and reload your Nginx configuration:
sudo nginx -t
sudo systemctl reload nginx
Access Duplicati via https://backup.example.com
.
Logging and Debugging Duplicati
๐๏ธ Enabling Debug Logs
Enable detailed debug logs in Duplicati for troubleshooting:
-
Access the web interface.
-
Go to Settings โ Advanced Options.
-
Set
--log-level=Profiling
.
๐ Viewing Logs
For Docker deployments, view logs using:
docker logs duplicati
For manual installations, logs are stored in:
~/.config/Duplicati/Duplicati-server.sqlite
๐ ๏ธ Troubleshooting Common Issues
For common issues like permission errors, check the logs for /backups
directory access:
sudo chmod -R 770 /path/to/backups
๐ค Exporting Logs
Send logs to ELK Stack using a utility like Filebeat:
-
Install Filebeat:
sudo apt install filebeat
. -
Edit
/etc/filebeat/filebeat.yml
to include Duplicati logs. -
Start Filebeat:
sudo systemctl start filebeat
.
Backup and Restore
๐๏ธ File-Based Backups
Run a manual backup of a directory via the Duplicati CLI:
duplicati-cli backup "file://path/to/backup/location" "/path/to/data" --backup-name="My Backup" --dbpath="/path/to/db" --encryption-module=aes --compression-module=zip
๐ Database Backups
Export Duplicatiโs internal database:
duplicati-cli export-db /path/to/store.db
Restore from the database:
duplicati-cli restore "file://path/to/backup/location" --restore-path="/path/to/restore"
๐ Automated Backup Scripts
Set up a cron job for automated backups:
crontab -e
## Run backup daily at midnight
0 0 * * * duplicati-cli backup "file://path/to/backup/location" "/path/to/data"
Updating and Upgrading Duplicati
โฌ๏ธ Updating Docker Images
Update your Duplicati Docker container:
docker-compose pull duplicati
docker-compose up -d
๐ ๏ธ Manual Updates
For manual installations, update the package:
sudo apt update
sudo apt upgrade duplicati
๐ Checking for Updates
Verify available updates in the Duplicati UI under Settings โ About.
Leveraging Duplicatiโs Unique Features
๐ง Enabling APIs
Activate Duplicatiโs API for advanced automation:
-
Go to Settings โ Advanced Options.
-
Enable
--webservice-interface=any
. -
Use the API via
curl
:
curl -X GET http://127.0.0.1:8200/api/v1/version
๐ Advanced Configurations
Use Duplicatiโs pre-backup scripting capabilities to run custom commands:
duplicati-cli backup "file://path/to/backup" "/path/to/data" --run-script-before="/path/to/script.sh"
Wrapping Up
Duplicati provides a robust, flexible solution for managing backups on your terms. From secure installation to advanced configurations and automation, this guide equips you with the tools to self-host and optimize Duplicati for your needs. Start implementing these steps today and take control of your data backup strategy!