Personal Backups with Duplicati on Linux
This tutorial is for performing personal backups to local USB hard drives, having encryption, deduplication and compression.
Download the latest version from https://www.duplicati.com/download
The software requires several libraries to work, mostly mono libraries. The easiest way to install the software is to let it fail the installation through dpkg and then install the missing packages with apt-get:
sudo dpkg -i duplicati_18.104.22.168-1_all.deb
sudo apt-get --fix-broken install
Note that the installation of the package fails on the first instance, then we use apt to install the dependencies.
Start the daemon:
sudo systemctl start duplicati.service
And if you wish for it to start automatically with the OS use:
sudo systemctl enable duplicati.service
To check that the service is running:
netstat -ltn | grep 8200
And you should receive a response like this one:
After these steps you should be able to run the browser and access the local web service at http://localhost:8200
Create a Backup Job
Go to "Add backup" to configure a new backup job:
Set a name for the job and a passphrase for encryption. You will need the passphrase to restore files, so pick a strong password and make sure you don't forget it:
Set the destination: the directory where you are going to store the backup files:
Select the source files to backup. I will pick just the Desktop folder for this example:
Specify filters and exclusions if necessary:
Configure a schedule, or disable automatic backups if you prefer to run them manually:
I like to use manual backups when using USB drive destinations, and scheduled if I have a server to send backups through SSH or a Cloud based destination.
Specify the versions to keep, and the Upload volume size (size of each partial file):
Finally you should see the job created in a summary like this:
Run the Backup
In the last seen summary, under Home, click "run now" to start the backup job. A progress bar will be seen by the top of the screen.
After finishing the backup, you can see in the destination folder, a set of files called something like:
duplicati-20171206T143926Z.dlist.zip.aes duplicati-bdfad38a0b1f34b5db56c1de166260cd8.dblock.zip.aes duplicati-i00d8dff418a749aa9d67d0c54b0e4149.dindex.zip.aes
The size of the blocks will be the one specified in the Upload volume size option. The files are compressed, and encrypted using the previously set passphrase.
Once finished, you will see in the summary the last backup taken and the size:
In this case it is only 1MB because I took a test folder.
To restore files, simply access the web administration in http://localhost:8200, go to the "Restore" menu and select the backup job name. Then select the files to restore and click "continue":
Select the restore files or folders and the restoration options:
The restoration will start running, showing a progress bar on the top of the user interface.
Fixate the backup destination
If you use a USB drive to perform the backups, it is a good idea to specify in the /etc/fstab the UUID of the drive, so that it always mount automatically in the /mnt/backup directory (or the directory of your choosing).
To do so, connect your drive and check for the UUID:
... /dev/sdb1: UUID="4d608d85-e138-4546-9f22-4d78bef0b6a7" TYPE="ext4" PARTUUID="983a72cb-01" ...
And copy the UUID to include an entry in the /etc/fstab file:
... UUID=4d608d85-e138-4546-9f22-4d78bef0b6a7 /mnt/backup ext4 defaults 0 0 ...
Remote Access to the GUI
By default, Duplicati listens on localhost only, and it's meant to be that way. However it includes the possibility to add a password and to be accessible from the network:
This setting is not recommended, as Duplicati has no SSL capabilities yet. What I would recommend if you need to use the backup GUI remotely, is using an SSH tunnel.
To accomplish this, first enable SSH server in case you don't have it yet, the easiest way is running:
Once you have the SSH server running on the Duplicati host. Go to the computer from where you want to connect to the GUI and set the tunnel
Let's consider that:
- Duplicati backups and its GUI are running in the remote host 192.168.0.150 (that we call the server).
- The GUI on the server is listening on port 8200.
- jorge is a valid user name in the server.
- I will access the GUI from a host on the local port 12345.
Then to open an SSH tunnel I run on the client:
ssh -f [email protected] -L 12345:localhost:8200 -N
With netstat it can be checked that the port is open for localhost:
netstat -ltn | grep :12345
tcp 0 0 127.0.0.1:12345 0.0.0.0:* LISTEN tcp6 0 0 ::1:12345 :::* LISTEN
And now I can access the remote GUI by accessing http://127.0.0.1:12345 from the client browser
Finally if you want to close the connection to the SSH tunnel you may kill the ssh process. First identify the PID:
ps x | grep "[s]sh -f"
26348 ? Ss 0:00 ssh -f [email protected] -L 12345:localhost:8200 -N
And kill it:
kill -9 26348
Or you can do it all in one:
kill -9 $(ps x | grep "[s]sh -f" | cut -d" " -f1)
Other Backup Repository Options
If you prefer to store your backups on a remote server rather than on a local hard drive, Duplicati has several options. Standard protocols such as:
- OpenStack Object Storage / Swift
- SFTP (SSH)
And a wider list of proprietary protocols, such as:
- Amazon Cloud Drive
- Amazon S3
- B2 Cloud Storage
- Google Cloud Storage
- Google Drive
- Microsoft One Drive
- Microsoft One Drive for Business
- Microsoft Sharepoint
- OpenStack Simple Storage
- Rackspace CloudFiles
For FTP, SFTP, WebDAV is as simple as setting the server hostname or IP address, adding credentials and then using the whole previous process. As a result, I don't believe it is of any value describing them.
However, as I find it useful for personal matters having a cloud based backup, I will describe the configuration for Dropbox, which uses the same procedure as for Google Drive and Microsoft OneDrive.
Let's create a new backup job and set the destination to Dropbox. All the configurations are exactly the same except for the destination that should be set like this:
Once you set up "Dropbox" from the drop-down menu, and configured the destination folder, click on the OAuth link to set the authentication.
A pop-up will emerge for you to login to Dropbox (or Google Drive or OneDrive depending on your choosing):
After logging in you will be prompted to allow Duplicati app to your cloud storage:
After finishing the last process, the AuthID field will be automatically filled in:
Click on "Test Connection". When testing the connection you will be asked to create the folder in the case it does not exist:
And finally it will give you a notification that the connection is successful:
If you access your Dropbox account you will see the files, in the same format that we have seen before, under the defined folder:
Duplicati is a multi-platform, feature-rich, easy to use backup solution for personal computers. It supports a wide variety of backup repositories what makes it a very versatile tool that can adapt to most personal needs.