windows上很好安装,就不赘述了

  1. 添加 GPG 密钥
sudo apt update
sudo apt install curl gnupg2 -y
curl -s https://syncthing.net/release-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/syncthing-archive-keyring.gpg
  1. 添加 Syncthing 仓库

稳定版 (Stable):

echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list

候选发布版 (Candidate - 不推荐用于生产环境):

echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing candidate" | sudo tee /etc/apt/sources.list.d/syncthing.list
  1. 更新 APT 缓存并安装 Syncthing
sudo apt update
sudo apt install syncthing -y
  1. 创建 syncthinguser
sudo adduser syncthinguser

会提示设置密码、全名等信息,全部回车即可

切换到新创建的用户账户:su - syncthinguser

退出 syncthinguser 账户,回到管理账户:exit

给同步文件夹赋权限:

sudo chown -R syncthinguser:syncthinguser /mnt/data/syncthing
sudo find /mnt/data/syncthing -type d -exec chmod 755 {} +
sudo find /mnt/data/syncthing -type f -exec chmod 644 {} +
  1. 启用并启动 Syncthing 服务
sudo systemctl enable syncthing@syncthinguser.service
sudo systemctl start syncthing@syncthinguser.service

检查 Syncthing 状态:

sudo systemctl status syncthing@syncthinguser.service
  1. 配置防火墙
sudo ufw allow 8384/tcp
sudo ufw allow 22000/tcp
sudo ufw allow 21027/udp
sudo ufw reload
  1. 访问 Syncthing Web UI

可以通过反向代理从外部访问,但是我觉得没必要,安全考虑,这里使用 mabaxterm 访问浏览器 firefox-esr (firefox 的延长支持版)

sudo apt update
sudo apt install firefox-esr -y
firefox-esr http://127.0.0.1:8384