Managing duplicati effectively is a crucial skill for any system administrator. This tutorial provides step-by-step instructions for cross-platform configuration, along with best practices for production environments.
Prerequisites
- A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)
- Root or sudo access to the server
- A remote storage destination (S3, B2, or another server)
- A registered domain name (for public-facing services)
Backup Configuration
Before making changes to the configuration, always create a backup of the existing files. This ensures you can quickly roll back if something goes wrong during the setup process.
# Install and initialize backup tool
sudo apt install -y duplicati
duplicati init --repo /backup/repo
# Create first backup
duplicati backup --repo /backup/repo /etc /home /var/www
# List backups
duplicati snapshots --repo /backup/repo
Each line in the configuration serves a specific purpose. The comments explain the reasoning behind each setting, making it easier to customize for your specific use case.
Scheduling Automated Backups
Regular maintenance is essential for keeping your duplicati installation running smoothly. Schedule periodic reviews of log files, disk usage, and security updates to prevent issues before they occur.
# Automated backup script: /usr/local/bin/backup.sh
#!/bin/bash
set -euo pipefail
BACKUP_REPO="/backup/repo"
LOG_FILE="/var/log/backup.log"
DATE=$(date +%Y-%m-%d_%H-%M)
echo "[$DATE] Starting backup..." >> $LOG_FILE
# Database dump
mysqldump --all-databases | gzip > /tmp/db-$DATE.sql.gz
# Run backup
duplicati backup --repo $BACKUP_REPO /etc /home /var/www /tmp/db-$DATE.sql.gz
# Cleanup old backups (keep 30 days)
duplicati forget --repo $BACKUP_REPO --keep-daily 7 --keep-weekly 4 --keep-monthly 3 --prune
rm /tmp/db-$DATE.sql.gz
echo "[$DATE] Backup completed successfully" >> $LOG_FILE
These commands should be run as root or with sudo privileges. If you're using a non-root user, prefix each command with sudo.
- Document all configuration changes
- Use version control for configuration files
- Maintain runbooks for common operations
- Set up monitoring before going to production
- Test disaster recovery procedures regularly
Common Issues and Solutions
- Slow performance: Check for disk I/O bottlenecks with
iostat -x 1and network issues withmtr. Review application logs for slow queries or requests. - High memory usage: Review the configuration for memory-related settings. Reduce worker counts or buffer sizes if running on a low-RAM VPS.
Next Steps
With duplicati now set up and running, consider implementing monitoring to track performance metrics over time. Regularly review your configuration as your workload changes and scale resources accordingly.