Security

Automatic off-site backups with Restic

Encrypted, deduplicated daily backups of your VPS to remote storage. · 6 min read

Follow the 3-2-1 rule: three copies, two media, one off-site.

apt -y install restic
export RESTIC_REPOSITORY=sftp:backup@backup.example.com:/srv/restic/server1
export RESTIC_PASSWORD='long-random-password'
restic init

Back up website files and a database dump:

mysqldump --all-databases > /root/db.sql
restic backup /var/www /etc /root/db.sql
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune

Put the commands in a script and run it daily with cron. Test a restore regularly:

restic restore latest --target /tmp/restore-test
Order a server built by real engineers or talk to our team — we are online 24/7. Support →

Security

All tutorials

Ready to launch your project?

Order a server built by real engineers or talk to our team — we are online 24/7.