Install duplicity and gnupg2
Configure yourself a GPG key to encrypt the data with. Note the key ID/hash to use in the duplicity-backup.service
.
Remember to backup your private key separately so it is not lost when you need your backups, and so you can recover your files.
Create yourself a place to put your backups
Create an app key as per but look out for this issue with slashes in the application key.
Create yourself a URL configuration much like in the linked articles in a file called ~/.duplicity-destination-url.txt
. This is simply a file that contains a single line which is the destination url for duplicity.
Place the files duplicity-backup.service
and duplicity-backup.timer
under /etc/systemd/system/
.
Remember you must change your username in duplicity-backup.service
to your username, as well as maybe change the 1000
in XDG_RUNTIME_DIR=/run/user/1000
to your uid. You can find your uid by running id -u
.
You must also change your GPG key to the ID of the key you created above.
Note in duplicity-backup.timer
you can replace the line OnCalendar=daily
with OnCalendar=weekly
depending on what you want your backup schedule to be.
You may also not want to backup your Documents directory and backup other directories. You can find guidance in the duplicity manpage.
Now start and enable the timer.
$ sudo systemctl enable duplicity-backup.timer
$ sudo syststemctl start duplicity-backup.timer
You can also manually run the service to test it by running:
$ sudo systemctl start duplicity-backup.service
and see the output by running:
$ sudo systemctl status duplicity-backup.service
- SystemD recognises the two
.service
and.timer
files as a pair because of their file name.