This tutorial shows you how to install and use the Restic Backup Utility on your computer.
What is the Restic Backup Utility?
Restic is a simple, feature-rich backup utility written in the Go programming language. Restic is a modern, secure and cross-platform software that can be used on most common operating systems. It offers features like the ability to review backups, automate the backup process, and more.
For more information on Restic, see the following resource:
How to install the Restic Backup utility
Restic is available in the major Linux distributions and you can install it with simple commands using various package managers.
Debian / Ubuntu
To install on Debian and other Debian-based distributions, use the apt command:
Manjaro / Arch Linux
In Manjaro and Arch distributions, use the pacman command:
CentOS / REHL
With the REHL distribution family, you can use the Copr repository or download the Restic binary.
Use wget to download the binary and move it to the bin directory:
[centos@centos8 ~]$ bzip2 -D restic_0.12.0_linux_amd64.bz2
[centos@centos8 ~]$ sudo mv restic_0.12.0_linux_amd64 restic && sudo mv reserved /usr/container
[centos@centos8 ~]$ sudo chmod a + x /usr/container/reserved
How to create a restic repository
To create Restic backups, we need to initialize a directory that will serve as a repository for Restic to store the files. A Restic repository can be local as well as on a remote server or service.
Let’s discuss how to initialize a local repository.
To initialize a local repository, use the Restic init command followed by – repo and the directory in which you want to create the repository.
It’s good to make sure you remember the password; You need it to access the files in the repository.
To create a remote repository on a server, use the SFTP protocol. Before doing this, make sure the server is configured with SSH and passwordless logon as Restic will fail if you are prompted for a password. To learn how to use a public key for SSH login, see the tutorial below:
How to Setup SSH without Passwords
Setup Passwordless Login to Servers via SSH
Once you’ve configured everything on your remote host, use the following command:
How to create Restic backups
Now that we’ve set up the repositories on local and remote hosts, we can move on to backing up some data. In Restic we refer to backups as snapshots.
To do a simple backup, use the following command:
The above command will automatically take a snapshot of the ~ / archives directory and add it to the repository that was created earlier. You will find that the snapshot value is in the form of hexadecimal characters, which makes it easier and faster to identify.
Restic is a fast tool that can process many files in a few minutes without draining computer resources. You can minimize the expense of the Restic backup process by skipping the – verbose option.
It is good to note that Restic is very efficient and will skip duplicate files before adding them to the repository.
When Restic encounters a backed up file, it scans the file to make sure that only the contents of the files are saved in the snapshot. It uses change detection mechanisms such as metadata to identify changes to a file.
How to add tags to snapshots
Restic also allows you to add tags or additional information to a snapshot. This makes it easy to identify a snapshot. To add a tag use the command as:
You can then reference a snapshot using the tags you specified.
Working with Repositories
To view the snapshots in a repository, use the command:
sudo restic Snapshots -r / srv / backup-repo
To remove a snapshot from a repository, use the forgotten command followed by the name or tag of the snapshot.
Use the command:
However, the Forget command still reserves the data referenced by the files stored in the remote snapshot. You can remove the unreferenced data with the prune command.
Restoring files from a saved snapshot is easy. Use the following command to restore a backup:
In this tutorial, we discussed how to install and use a Restic backup utility. This tutorial is an entry-level guide that will teach you how to perform basic backup and restore operations. To learn more about using the Restic backup tool, check out the documents in the resource provided below: