Rsync Installation and Setup
Most Linux distributions include rsync by default. This guide covers installation, verification, updating, and initial configuration to prepare your server for production rsync workflows.
Prerequisites
| Requirement | Description |
|---|---|
| Linux Server | Ubuntu, Debian, CentOS, AlmaLinux, or any major distribution |
| Privileges | sudo or root access |
| Internet Access | Required to install or update packages |
| SSH | Required for remote server synchronization |
Check if Rsync is Already Installed
Before installing, check whether rsync is already available on your system:
rsync --version
If installed, you'll see output like:
rsync version 3.2.7 protocol version 31
You can also verify the binary location:
which rsync
# /usr/bin/rsync
Installing Rsync
Ubuntu / Debian
sudo apt update
sudo apt install rsync -y
CentOS / AlmaLinux / Rocky Linux
sudo dnf install rsync -y
For older CentOS (7 and below):
sudo yum install rsync -y
Arch Linux
sudo pacman -S rsync
On most modern Linux distributions, rsync comes pre-installed. If rsync --version already works, you can skip the installation step.
Verifying the Installation
After installation, run these checks to confirm everything is working:
1. Check Version and Capabilities
rsync --version
Look for important capabilities in the output:
rsync version 3.2.7 protocol version 31
Copyright (C) 1996-2022 by Andrew Tridgell, Wayne Davison, and others.
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, symlinks, symtimes, hardlinks, hardlink-specials,
hardlink-symlinks, IPv6, atimes, batchfiles, inplace, append, ACLs,
xattrs, optional secluded-args, iconv, prealloc, stop-at, crtimes
2. Test a Simple Local Copy
rsync -av /etc/hostname /tmp/
Expected output:
sending incremental file list
hostname
sent 120 bytes received 35 bytes 310.00 bytes/sec
total size is 12 speedup is 0.08
3. Confirm Package Details
# Ubuntu / Debian
apt show rsync 2>/dev/null | grep -E "Version|Description"
# CentOS / AlmaLinux
rpm -qi rsync | grep -E "Version|Summary"
Rsync File Locations
Understanding where rsync lives on your system:
/usr/bin/rsync ← Main binary
/usr/share/man/man1/rsync.1 ← Man page (run: man rsync)
/usr/share/doc/rsync/ ← Documentation and examples
/etc/rsyncd.conf ← Daemon mode config (optional)
Updating Rsync
Keeping rsync up to date ensures compatibility with modern SSH versions, security patches, and performance improvements.
Upgrade Rsync Only (Ubuntu / Debian)
sudo apt update
sudo apt install --only-upgrade rsync -y
Upgrade Rsync Only (CentOS / AlmaLinux)
sudo dnf upgrade rsync -y
Verify Version After Upgrade
rsync --version | head -n 1
Major version changes may introduce new flags or modify default behavior. Always check the rsync changelog after upgrading on production servers.
Setting Up SSH for Remote Rsync
Rsync uses SSH as its default transport for remote transfers. Setting up key-based authentication eliminates password prompts and enables automation.
1. Generate an SSH Key Pair (if you don't have one)
ssh-keygen -t ed25519 -C "rsync-backup-key"
2. Copy the Public Key to the Remote Server
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@remote-server
3. Test the SSH Connection
ssh user@remote-server "echo 'SSH connection works'"
4. Test Rsync Over SSH
rsync -avz --dry-run /var/www/html/ user@remote-server:/var/www/html/
If your SSH server uses a non-standard port, specify it with the -e flag:
rsync -avz -e "ssh -p 2222" /source/ user@remote:/destination/
Removing or Reinstalling Rsync
Remove (Keep Configuration Files)
# Ubuntu / Debian
sudo apt remove rsync -y
# CentOS / AlmaLinux
sudo dnf remove rsync -y
Purge Completely (Remove Package + Config)
# Ubuntu / Debian only
sudo apt purge rsync -y
Reinstall from Scratch
# Ubuntu / Debian
sudo apt install rsync --reinstall -y
# CentOS / AlmaLinux
sudo dnf reinstall rsync -y
Troubleshooting Installation Issues
| Issue | Cause | Solution |
|---|---|---|
command not found | Rsync not installed | Install using your package manager |
Unable to locate package rsync | Outdated package index | Run sudo apt update first |
Permission denied | Missing sudo privileges | Prefix commands with sudo |
Broken packages | Interrupted upgrade | Run sudo apt --fix-broken install |
| No version change after upgrade | Already on latest version | Confirm with apt show rsync |
| SSH connection refused | SSH not installed or port blocked | Install openssh-server, check firewall rules |
Post-Installation Checklist
Run through this checklist after a fresh install to confirm readiness:
| Task | Command | |
|---|---|---|
| Rsync installed | rsync --version | |
| Binary accessible | which rsync | |
| Local copy works | rsync -av /etc/hostname /tmp/ | |
| SSH key configured | ssh user@remote "echo ok" | |
| Remote rsync works | rsync -avz --dry-run /test/ user@remote:/test/ | |
| Non-standard SSH port (if applicable) | Test with -e "ssh -p PORT" |
Quick Reference
# Install
sudo apt install rsync -y # Ubuntu/Debian
sudo dnf install rsync -y # CentOS/AlmaLinux
# Check version
rsync --version
# Update rsync only
sudo apt install --only-upgrade rsync -y
# Test local sync
rsync -av /etc/hostname /tmp/
# Test remote sync (dry-run)
rsync -avz --dry-run /var/www/ user@remote:/var/www/
# Check SSH compatibility
rsync --version | grep protocol
ssh -V
What's Next
With rsync installed and SSH configured, continue with:
- Rsync vs SCP — When to use rsync over other transfer tools
- Core Command Structure — Learn source/destination path rules
- Incremental Sync — Understand delta transfer in practice