How to Install and Configure rsnapshot on Ubuntu Server 22.04

Backing up data regularly is crucial to avoid data loss due to system failures. rsnapshot, a wrapper around the rsync tool, simplifies incremental backups of local and remote file systems, using hard links to save disk space.

Prerequisites

  • A running Ubuntu Server 22.04 instance
  • A user with sudo privileges
  • An external drive (optional for added backup reliability)

 

Step 1: Install rsnapshot

To install rsnapshot on Ubuntu, run the following command:

sudo apt-get install rsnapshot -y

On Fedora-based distributions, use:

sudo dnf install rsnapshot -y

For Arch Linux users:

sudo pacman -S rsnapshot

Make sure rsync is installed as well. You can install it with:

# For Ubuntu:

sudo apt-get install rsync -y

# For Fedora:

sudo dnf install rsync -y

# For Arch:

sudo pacman -S rsync

 

Step 2: Configure rsnapshot

Open the rsnapshot configuration file to begin the setup:

sudo nano /etc/rsnapshot.conf

Update the snapshot directory by modifying the snapshot_root line:

snapshot_root /backup

This assumes your backups will be stored in the /backup directory. If you want to store backups on an external drive, make sure it is mounted there. Additionally, disable root directory creation by uncommenting the following line:

no_create_root 1

Also, ensure the correct path to the rsync binary is set:

cmd_rsync /usr/bin/rsync

 

Step 3: Set Retention Policies

In the BACKUP LEVELS / INTERVALS section, define how many backups to keep:

retain alpha 6

retain beta 7

retain gamma 4

You can replace alpha, beta, and gamma with more meaningful names like daily, weekly, and monthly for clarity.

 

Step 4: Define Backup Directories

Configure the directories to be backed up under the #LOCALHOST section:

backup /home/ localhost/

backup /etc/ localhost/

backup /usr/local/ localhost/

These paths can be customized based on your needs. Keep the localhost/ identifier unchanged, as it signifies the local system.

 

Step 5: Test and Verify the Configuration

Before launching your first backup, it’s essential to verify the configuration by running:

sudo rsnapshot configtest

If everything checks out, you’re ready to use rsnapshot to automate and safeguard your system backups.

 

Conclusion

By setting up rsnapshot on Ubuntu Server 22.04, you can efficiently manage incremental backups while minimizing disk space usage. Regular backups are critical, and with rsnapshot, the process becomes streamlined and reliable.

You can download new version of ubuntu from —–Download Ubuntu 24.10

 

Click here for more articles…………

Click below and ‘share’ this article!