Learn to set up and use the restic back-up device over a community, for straightforward information again up and restore.
The best way to again up Linux directories over a community with restic
Jack Wallen walks you thru the method of putting in and utilizing the restic backup device over a community, for straightforward information backup and restore.
There are such a lot of choices when you could again up your information. That is very true when utilizing the Linux platform. You’ll be able to go together with a full-blown GUI software or a easy command line device (or something in between). One such command line device (that has an excessive amount of potential) is restic . Restic is a quick, safe back-up software that may deal with native or community again ups with velocity and ease. With this device, you’ll be able to create bash scripts or cron jobs to fit your Linux backup wants.
I need to stroll you thru the set up of restic, the creation of a distant repository, and backing up information over your community. I will exhibit on the Ubuntu Server 18.04 platform.
SEE: System replace coverage template obtain (Tech Professional Analysis)
What you want
To efficiently make this work, you want the next:
A Ubuntu Server 18.04 occasion. One other Linux server (or desktop) that homes the info to be backed up. SSH key authentication configured between the 2 machines (See: The best way to arrange ssh key authentication). A consumer with sudo privileges.
With these bits in hand, let’s get to work.
Putting in restic
As a result of restic could be present in the usual Ubuntu repositories, set up could be taken care of with a single command:
sudo apt-get set up restic -y
As soon as the set up completes, you are able to proceed.
Making a repository
The subsequent step is to create a repository. First, we’d like a vacation spot listing on our distant server. Log into that server and create the brand new listing with the command:
sudo mkdir /srv/restic-repo
Ensure to change the permissions for that listing as wanted. Say, for instance, the consumer jack will deal with the backups. For that, you need to change the possession with the command:
sudo chown jack.jack /srv/restic-repo
You may be higher off creating a bunch that may use the backups, add all the required customers to that group, and alter the group possession of the listing with the command:
sudo chgrp -R /srv/restic-repo GROUP
The place GROUP is the title of the group you created.
Subsequent we have to initialize the repository. From the shopper machine, situation the command:
restic -r sftp:USER@SERVER_IP:/srv/restic-repo init
The place USER is the distant username and SERVER_IP is the IP tackle of the distant server. You may be prompted for the SSH key password, after which prompted to create (and confirm) a password for the repository. As soon as that command completes, you are able to again up.
As an example now we have the listing ~/information on the shopper machine, and we need to again it as much as the distant repository we simply created. The command to do that is:
restic backup information -r sftp:USER@SERVER_IP:/srv/restic-repo
The place USER is the distant consumer and SERVER_IP is the IP tackle of the distant server.
Restic will ship the backup to the distant server and report again the outcomes (Determine A).
Determine A: The outcomes of our distant backup.
Restoring from a backup
Now that you just backed as much as the distant repository, how do you restore that information again to your native machine? Straightforward. On the native shopper, situation the command:
restic restore newest –target ~/data-restore -r sftp:USER@SERVER_IP:/srv/restic-repo
The place USER is the distant consumer and SERVER_IP is the distant server IP tackle.
The above command will restore the info from the distant repository in a newly created ~/data-restore listing (restic will create this for you).
Congratulations, you backed up and restored your information listing to a distant restic repository. You must now have all the data you could use restic in helpful and artistic methods.
Open Supply Weekly E-newsletter
You do not need to miss our ideas, tutorials, and commentary on the Linux OS and open supply purposes.
Join at this time
Join at this time
Picture: Jack Wallen