Table of Contents
What you will read?
To install rsync on AlmaLinux, open your terminal and first make sure your system is up to date:
sudo dnf update -y
Next, check if rsync is already installed:
rsync --version
If you see version details, you’re good to go. Otherwise, install it with:
sudo dnf install rsync -y
Once the installation is complete, confirm it again:
rsync --version
You should now see the installed version along with copyright and protocol info.
Using rsync
Here’s a simple example of how to copy a directory from your local system to a remote server:
rsync -avz /path/to/local/dir/ user@remote_server:/path/to/remote/dir/
And if you want to sync from a remote server to your local system:
rsync -avz user@remote_server:/path/to/remote/dir/ /path/to/local/dir/
Add --delete if you want the destination to be an exact mirror:
rsync -avz --delete /source/ user@host:/destination/
For regular backups, you can create a simple shell script:
#!/bin/bash
rsync -avz --delete /home/user/data/ user@backup:/backup/data/
Make it executable:
chmod +x backup.sh
And schedule it with cron:
crontab -e
Example cron job to run it daily at midnight:
0 0 * * * /home/user/backup.sh
Firewall and Port Notes
rsync uses SSH by default. Make sure port 22 is open:
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
Or open a custom port if you’ve configured SSH differently:
sudo firewall-cmd --permanent --add-port=2222/tcp
sudo firewall-cmd --reload
To use rsync on a different SSH port:
rsync -avz -e "ssh -p 2222" /src/ user@host:/dst/
Troubleshooting
If you get command not found, double-check that rsync was installed properly.
If you’re syncing to/from remote servers and see connection issues, make sure:
-
SSH is enabled and the server is reachable.
-
The user has the correct permissions.
-
SELinux isn’t blocking access. You can check with:
sestatus
Temporarily disable SELinux (not recommended for production):
sudo setenforce 0
That’s it — you’re now ready to use rsync on AlmaLinux for fast, reliable file transfers.
