Now Reading: How to install and configure rsnapshot in Linux

Loading
svg
Open

How to install and configure rsnapshot in Linux

January 6, 20244 min read

When working with big data, it is important to consider how to back it up. There are two types of backup plans; A normal backup is one that backs up the entire data. The second method is incremental backup which keeps only additional data since the last backup. The drawback of the first plan is that it consumes a lot of memory as the files are stored multiple times with new additions. On the other hand, incremental backup first backs up the entire data; Then the additional portion since the last backup is backed up.

rsnapshot is an rsync-based, incremental backup utility that helps with local and remote file system backups. The main advantage of using rsnapshot is that it saves disk space as much as possible.

How to install and configure rsnapshot in Linux

You can install and configure rsnapshot in any Debian-based distribution using the mentioned procedure. We are running the command in Ubuntu 22.04:

how to install rsnapshot in linux

to get started rsnapshot Installation, first of all, we need to update all the packages of the system. Then, you can download rsnapshot tools using the appropriate package manager.

Update Ubuntu 22.04 system by executing the mentioned command:

The method of installation of rsnapshot utility on Debian-based Linux distributions is very simple and just one command away which is mentioned below:

sudo apart to install rsnapshot

To install rsnapshot on RHEL/CentOS/Fedora, execute the given command:

sudo install yum rsnapshot

How to configure rsnapshot in Linux

All rsnapshot configuration settings are stored /etc/rsnapshot.conf file. Open this file using any editor i.e. Vim or Nano and you will see /var/cache/rsnapshot/ The path to where all snapshots will be saved.

backup directories

Before backing up anything, you must know what actual files, directories, or data you want to backup.

If you're running it on your local machine, backing up the data is very easy. When you open the /etc/rsnapshot.conf file, you will see that some directories are already on the way to be stored by default:

backup ,Home, local host,

backup ,etc, local host,

backup ,usr,local, local host,

Let's say we need to backup it document Director, that line will be added as follows:

backup ,Home,document localhost,

Maintain Backup Interval

As we read above, RSnapshot is an incremental backup, it helps in maintaining older snapshots whether they are hourly, daily weekly or monthly. You can do this by specifying a specific number of snapshots that should be taken in the interval.

In the /etc/rsnapshot.conf file, go to Backup level/interval Section, and type the following to maintain the snapshot:

maintain hourly 5

maintain daily 6

maintain weekly 7

keeps monthly 10

You can set it as per your snapshot requirements.

backup remote machine

To backup a remote machine, there must be a password-less SSH connection with the remote machine. To establish password-less SSH communication with a remote machine, read the procedure below.

To generate the ssh-key, execute the following command in the terminal:

To copy the generated public key to a remote machine, use the outlined syntax:

ssh-copy-id <User name,ip address,

For example:

ssh-copy-id sam,192.168.13.14

After performing the above steps, the password-less SSH connection will be established.

To backup remote machines, you need to specify the server location (directory) in the /etc/rsnapshot.conf file:

backup <User name,ip address,,<remote_machine_data_path, <client_machine_backup_path,

For example:

i'm a backup,192.168.13.14:,Home,Sam,document ,Was,cash,rsnapshot

Once you have specified the server directory, run the following rsnapshot command to set the backup interval:

Scheduling Automation Tasks with Cron

To schedule the automation backup plan, you need to specify the time with certain intervals, i.e. hourly, daily, weekly or monthly; you need to open /etc/cron.d/rsnapshot File using any editor.

sudo ,etc,cron.d,rsnapshot

When you open this file, uncomment the above syntax, and set your schedule to perform an automatic backup:

In the first row, rsnapshot will perform the backup every day at 06:00 AM, and in the second row, the backup process will be performed at 08:00 PM every first day of the month.

test rsnapshot configuration

Once all the configurations are done, execute the given commands to check if they are error-free. If you get a response syntax is fineThis means there is nothing wrong with the settings:

sudo rsnapshot configtest

You can also check the backup interval by running the given rsnapshot command:

sudo rsnapshot <Interval,

Change to hourly, daily, weekly, or monthly, depending on what you want to test.

conclusion

RSnapshot is an incremental backup that helps to backup data once and then back up additional files or directories since the last backup. rsnapshot configuration is stored in /etc/rsnapshot/conf File where you can edit the settings. In this guideline several examples are mentioned for configuring the rsnapshot file and how we can backup the directories. We have also tested the configuration file and found no errors.

How do you vote?

0 People voted this article. 0 Upvotes - 0 Downvotes.
svg

What do you think?

Show comments / Leave a comment

Leave a reply

Loading
svg