syncthing is a free and open-source continuous file synchronization. Syncthing provides secure, decentralized file sync without relying on cloud services
1. Prerequisites
2. Supported Operating Systems
This guide supports installation on:
3. Installation
RHEL/CentOS/Rocky Linux/AlmaLinux
# Install EPEL repository if needed
sudo dnf install -y epel-release
# Install syncthing
sudo dnf install -y syncthing
# Enable and start service
sudo systemctl enable --now syncthing
# Configure firewall
sudo firewall-cmd --permanent --add-port=8384/tcp
sudo firewall-cmd --reload
# Verify installation
syncthing --version
Debian/Ubuntu
# Update package index
sudo apt update
# Install syncthing
sudo apt install -y syncthing
# Enable and start service
sudo systemctl enable --now syncthing
# Configure firewall
sudo ufw allow 8384
# Verify installation
syncthing --version
Arch Linux
# Install syncthing
sudo pacman -S syncthing
# Enable and start service
sudo systemctl enable --now syncthing
# Verify installation
syncthing --version
Alpine Linux
# Install syncthing
apk add --no-cache syncthing
# Enable and start service
rc-update add syncthing default
rc-service syncthing start
# Verify installation
syncthing --version
openSUSE/SLES
# Install syncthing
sudo zypper install -y syncthing
# Enable and start service
sudo systemctl enable --now syncthing
# Configure firewall
sudo firewall-cmd --permanent --add-port=8384/tcp
sudo firewall-cmd --reload
# Verify installation
syncthing --version
macOS
# Using Homebrew
brew install syncthing
# Start service
brew services start syncthing
# Verify installation
syncthing --version
FreeBSD
# Using pkg
pkg install syncthing
# Enable in rc.conf
echo 'syncthing_enable="YES"' >> /etc/rc.conf
# Start service
service syncthing start
# Verify installation
syncthing --version
Windows
# Using Chocolatey
choco install syncthing
# Or using Scoop
scoop install syncthing
# Verify installation
syncthing --version
Initial Configuration
Basic Configuration
# Create configuration directory
sudo mkdir -p /etc/syncthing
# Set up basic configuration
# See official documentation for detailed configuration options
# Test configuration
syncthing --version
5. Service Management
systemd (RHEL, Debian, Ubuntu, Arch, openSUSE)
# Enable service
sudo systemctl enable syncthing
# Start service
sudo systemctl start syncthing
# Stop service
sudo systemctl stop syncthing
# Restart service
sudo systemctl restart syncthing
# Check status
sudo systemctl status syncthing
# View logs
sudo journalctl -u syncthing -f
OpenRC (Alpine Linux)
# Enable service
rc-update add syncthing default
# Start service
rc-service syncthing start
# Stop service
rc-service syncthing stop
# Restart service
rc-service syncthing restart
# Check status
rc-service syncthing status
rc.d (FreeBSD)
# Enable in /etc/rc.conf
echo 'syncthing_enable="YES"' >> /etc/rc.conf
# Start service
service syncthing start
# Stop service
service syncthing stop
# Restart service
service syncthing restart
# Check status
service syncthing status
launchd (macOS)
# Using Homebrew services
brew services start syncthing
brew services stop syncthing
brew services restart syncthing
# Check status
brew services list | grep syncthing
Windows Service Manager
# Start service
net start syncthing
# Stop service
net stop syncthing
# Using PowerShell
Start-Service syncthing
Stop-Service syncthing
Restart-Service syncthing
# Check status
Get-Service syncthing
Advanced Configuration
See the official documentation for advanced configuration options.
Reverse Proxy Setup
nginx Configuration
upstream syncthing_backend {
server 127.0.0.1:8384;
}
server {
listen 80;
server_name syncthing.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name syncthing.example.com;
ssl_certificate /etc/ssl/certs/syncthing.example.com.crt;
ssl_certificate_key /etc/ssl/private/syncthing.example.com.key;
location / {
proxy_pass http://syncthing_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Apache Configuration
<VirtualHost *:80>
ServerName syncthing.example.com
Redirect permanent / https://syncthing.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName syncthing.example.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/syncthing.example.com.crt
SSLCertificateKeyFile /etc/ssl/private/syncthing.example.com.key
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8384/
ProxyPassReverse / http://127.0.0.1:8384/
</VirtualHost>
HAProxy Configuration
frontend syncthing_frontend
bind *:80
bind *:443 ssl crt /etc/ssl/certs/syncthing.pem
redirect scheme https if !{ ssl_fc }
default_backend syncthing_backend
backend syncthing_backend
balance roundrobin
server syncthing1 127.0.0.1:8384 check
Security Configuration
Basic Security Setup
# Set appropriate permissions
sudo chown -R syncthing:syncthing /etc/syncthing
sudo chmod 750 /etc/syncthing
# Configure firewall
sudo firewall-cmd --permanent --add-port=8384/tcp
sudo firewall-cmd --reload
# Enable SELinux policies (if applicable)
sudo setsebool -P httpd_can_network_connect on
Database Setup
See official documentation for database configuration requirements.
Performance Optimization
System Tuning
# Basic system tuning
echo 'net.core.somaxconn = 65535' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_max_syn_backlog = 65535' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Monitoring
Basic Monitoring
# Check service status
sudo systemctl status syncthing
# View logs
sudo journalctl -u syncthing -f
# Monitor resource usage
top -p $(pgrep syncthing)
9. Backup and Restore
Backup Script
#!/bin/bash
# Basic backup script
BACKUP_DIR="/backup/syncthing"
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p "$BACKUP_DIR"
tar -czf "$BACKUP_DIR/syncthing-backup-$DATE.tar.gz" /etc/syncthing /var/lib/syncthing
echo "Backup completed: $BACKUP_DIR/syncthing-backup-$DATE.tar.gz"
Restore Procedure
# Stop service
sudo systemctl stop syncthing
# Restore from backup
tar -xzf /backup/syncthing/syncthing-backup-*.tar.gz -C /
# Start service
sudo systemctl start syncthing
6. Troubleshooting
Common Issues
1. Service won't start:
# Check logs
sudo journalctl -u syncthing -n 100
sudo tail -f /var/log/syncthing/syncthing.log
# Check configuration
syncthing --version
# Check permissions
ls -la /etc/syncthing
2. Connection issues:
# Check if service is listening
sudo ss -tlnp | grep 8384
# Test connectivity
telnet localhost 8384
# Check firewall
sudo firewall-cmd --list-all
3. Performance issues:
# Check resource usage
top -p $(pgrep syncthing)
# Check disk I/O
iotop -p $(pgrep syncthing)
# Check connections
ss -an | grep 8384
Integration Examples
Docker Compose Example
version: '3.8'
services:
syncthing:
image: syncthing:latest
ports:
- "8384:8384"
volumes:
- ./config:/etc/syncthing
- ./data:/var/lib/syncthing
restart: unless-stopped
Maintenance
Update Procedures
# RHEL/CentOS/Rocky/AlmaLinux
sudo dnf update syncthing
# Debian/Ubuntu
sudo apt update && sudo apt upgrade syncthing
# Arch Linux
sudo pacman -Syu syncthing
# Alpine Linux
apk update && apk upgrade syncthing
# openSUSE
sudo zypper update syncthing
# FreeBSD
pkg update && pkg upgrade syncthing
# Always backup before updates
tar -czf /backup/syncthing-pre-update-$(date +%Y%m%d).tar.gz /etc/syncthing
# Restart after updates
sudo systemctl restart syncthing
Regular Maintenance
# Log rotation
sudo logrotate -f /etc/logrotate.d/syncthing
# Clean old logs
find /var/log/syncthing -name "*.log" -mtime +30 -delete
# Check disk usage
du -sh /var/lib/syncthing
Additional Resources
---
Note: This guide is part of the HowToMgr collection. Always refer to official documentation for the most up-to-date information.