In this lesson, we will cover the steps to install and configure Duplicati for creating backups from a variety of sources: MariaDB on Debian, a website on Debian, a Windows File Server, Windows Desktops, and macOS Desktops. These backups will be stored in Amazon S3 for durability and scalability.
Prerequisites
- Amazon S3 Bucket with programmatic access (Access Key ID and Secret Access Key).
- Duplicati installed on all systems needing backup.
- Basic understanding of MariaDB, file structures, and system administration on Linux, Windows, and macOS.
1. Install Duplicati on Debian (MariaDB & Website)
Step 1: Install Duplicati
First, let’s install Duplicati on your Debian machine.
- Add the Duplicati repository:
wget -O - https://updates.duplicati.com/beta/duplicati-signing.gpg | sudo apt-key add -
echo "deb https://updates.duplicati.com/beta/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/duplicati.list
- Update package list and install Duplicati:
sudo apt update
sudo apt install duplicati
- Enable and start the Duplicati service:
sudo systemctl enable duplicati
sudo systemctl start duplicati
Duplicati’s web interface will now be available on http://localhost:8200
.
Step 2: Configure Backup for MariaDB
- Dump the MariaDB Database before backup to ensure consistency: Create a script
/opt/backup-mariadb.sh
to dump the database:
#!/bin/bash
mysqldump --user=root --password=your_password --all-databases > /var/backups/mariadb_backup.sql
Make it executable:
chmod +x /opt/backup-mariadb.sh
- Set up Duplicati:
- Open Duplicati at
http://localhost:8200
. - Click “Add Backup” > Configure a new backup.
- Choose “Local folder or cloud storage” > Select Amazon S3.
- Enter your S3 Access Key, Secret, and bucket details.
- For “Source Data,” choose the backup script output file
/var/backups/mariadb_backup.sql
. - Set a schedule for regular backups (e.g., daily at midnight).
- Save the backup configuration.
Step 3: Configure Backup for the Website
- Your website files are likely in
/var/www/html
(or similar). You can add these to Duplicati:
- Go back to Duplicati’s web interface.
- Add another backup configuration, targeting the website files in
/var/www/html
. - Select Amazon S3 again as the destination.
- Schedule as needed.
2. Install and Configure Duplicati on Windows File Server
Step 1: Install Duplicati
- Download Duplicati from the official website.
- Run the installer on your Windows file server.
Step 2: Configure Backup for File Server
- Open Duplicati from the Start menu and configure a new backup.
- Select the folders you wish to back up (e.g., shared folders on the file server).
- Choose Amazon S3 as the destination and input the Access Key ID, Secret, and S3 bucket name.
- Set your preferred backup schedule.
3. Install and Configure Duplicati on Windows Desktops
Step 1: Install Duplicati
- Follow the same installation steps as for the Windows file server.
- After installation, launch the Duplicati web interface.
Step 2: Configure Backup for Desktop Files
- Open Duplicati and create a new backup for important folders (e.g.,
Documents
,Desktop
). - As with previous setups, choose Amazon S3 as the destination.
- Set your preferred backup schedule and save the configuration.
4. Install and Configure Duplicati on macOS Desktops
Step 1: Install Duplicati
- Download the macOS version of Duplicati from the official website.
- Open the
.dmg
file and install Duplicati.
Step 2: Configure Backup for macOS Files
- Open Duplicati and configure the backup of important directories (e.g.,
/Users/your_user/Documents
). - As in the other cases, choose Amazon S3 as the destination and enter the appropriate credentials.
- Set a schedule for the backups.
5. Verifying and Monitoring Backups
Once the backups are configured:
- Test the Backups:
- For each backup configuration, manually run the backup once to ensure it works properly and data is successfully uploaded to Amazon S3.
- Monitor via Duplicati’s Web Interface:
- You can view backup statuses, logs, and errors from Duplicati’s web UI.
- Automate Monitoring with Email Notifications:
- Go to
Settings
in Duplicati, and set up email notifications for failed backups.
- Regular Maintenance:
- Ensure that you periodically verify backups by restoring data to ensure integrity.
6. Best Practices
- Encryption: Always enable Duplicati’s encryption for data being sent to Amazon S3 to ensure data security.
- Retention Policies: Configure Duplicati to manage your backup retention, automatically deleting old backups to reduce storage costs.
- Backup Testing: Periodically perform test restores to ensure your backups are working as expected.
Conclusion
With Duplicati configured, you now have a robust system to back up your MariaDB databases, websites, Windows file servers, Windows desktops, and macOS desktops to Amazon S3. By automating backups and using cloud storage, you ensure that your critical data is securely stored and easily recoverable in case of failure.