In this tutorial, we'll learn how to automate backups on AlmaLinux 10 using Rsnapshot.
Data loss is a nightmare no one wants to experience. Whether we’re running a production server, managing development machines, or hosting client websites, regular backups are essential. In this guide, we’ll walk through automating backups using Rsnapshot on AlmaLinux 10 — a modern and stable alternative to CentOS.
What is Rsnapshot?
Rsnapshot is a powerful backup tool based on rsync and SSH. It enables automated, scheduled backups of local and remote systems using incremental snapshots, consuming minimal disk space by leveraging hard links for unchanged files. It’s fast, efficient, and ideal for daily or hourly backups.
Prerequisites
Before starting, make sure our new Ubuntu server is ready. The following components should be installed and configured:
- A AlmaLinux 10 installed dedicated server or KVM VPS.
- A root user or normal user with administrative privileges.
Automating Backups on AlmaLinux 10 Using Rsnapshot: A Reliable Step-by-Step Guide
Step 1: Update the System
Before starting, we ensure our AlmaLinux system is up to date. This avoids compatibility issues with packages.
sudo dnf update -y
sudo dnf install epel-release -y
We install EPEL because Rsnapshot is available in this repository.
Step 2: Install Rsnapshot
Next, install Rsnapshot using the EPEL repository.
sudo dnf install rsnapshot -y
After installation, verify the version:
rsnapshot -V
This confirms that Rsnapshot is correctly installed.
Step 3: Understand Rsnapshot's Directory Structure
Rsnapshot stores backups in directories like:
/backup/daily.0/
/backup/daily.1/
/backup/weekly.0/
These directories represent different intervals (hourly, daily, weekly). New snapshots link unchanged files, saving space while retaining historical data.
Step 4: Configure Rsnapshot
The default config file is located at:
/etc/rsnapshot.conf
Before editing, make a backup of the original config:
sudo cp /etc/rsnapshot.conf /etc/rsnapshot.conf.bak
Now edit the configuration:
sudo nano /etc/rsnapshot.conf
Key settings to update:
1. Snapshot Root
Change the default to a custom backup directory:
snapshot_root /backup/
Make sure this directory exists:
sudo mkdir -p /backup/
2. Retention Policy
Uncomment and define how many backups we want to keep:
retain daily 7
retain weekly 4
retain monthly 3
This example keeps:
- 7 daily backups
- 4 weekly backups
- 3 monthly backups
3. Backup Targets
At the bottom of the config file, define the backup sources:
For local backups:
backup /etc/ localhost/
backup /home/ localhost/
For remote backups:
backup root@192.168.1.100:/etc/ remote-server/
Make sure key-based SSH login is set up if backing up over SSH.
Step 5: Test the Configuration
Run a dry-run test to check for errors in the config file:
sudo rsnapshot configtest
If output is:
Syntax OK
You're good to go.
Now test a real backup manually:
sudo rsnapshot daily
Check that /backup/daily.0/ is populated with the appropriate directories.
Step 6: Automate Backups with Cron
To automate the process, edit the cron job file:
sudo crontab -e
Add the following lines based on your schedule:
0 3 * * * /usr/bin/rsnapshot daily
0 4 * * 0 /usr/bin/rsnapshot weekly
0 5 1 * * /usr/bin/rsnapshot monthly
This will run:
- Daily at 3 AM
- Weekly on Sunday at 4 AM
- Monthly on the 1st at 5 AM
Make sure the time aligns with server load and usage patterns.
Step 7: Secure and Monitor Backups
Set Proper Permissions:
Ensure only root can access the backups:
sudo chown -R root:root /backup/
sudo chmod -R 700 /backup/
Optional: Email Notification (Advanced)
Use mailx or sendmail to notify on failures or successes. You can combine this with cron to log results and alert your admin email.
Final Thoughts
Automating backups with Rsnapshot on AlmaLinux 10 gives us peace of mind and a solid disaster recovery plan. Its use of hard links ensures efficient storage, and the straightforward configuration makes it ideal for long-term deployments. As we scale systems or add more clients, Rsnapshot can easily adapt — backing up both local and remote data with minimal overhead.
Let’s make data loss a thing of the past by setting up a simple, robust, and automated backup process today.
If you'd like a step-by-step guide for restoring backups or setting up remote key-based SSH for Rsnapshot, feel free to request — we’ll expand this guide to cover full backup lifecycle management.
Check out our low cost dedicated server.