安裝 syncthing 在 Raspiberry or Debian 上

1 第一步Update pi

sudo apt-get update && sudo apt-get -y upgrade && sudo apt -y full-upgrade

2 之後要安裝 apt-transport-https

sudo apt-get install -y apt-transport-https curl

3 Download Syncthing GPG keys

curl -s https://syncthing.net/release-key.txt | gpg --dearmor | sudo tee /usr/share/keyrings/syncthing-archive-keyring.gpg >/dev/null

4 加 key 到 repository 內

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

5 安裝 syncthing 前 update

sudo apt-get update

6 安裝 syncthing

sudo apt-get -y install syncthing

Syncthing 開始

1 找出 IP

hostname -I

2 第一次運作

syncthing

3 可以改成 0.0.0.0 IP 可以


Add System Service

1 產生個 syncthing service file

sudo nano /lib/systemd/system/syncthing.service

2 加進這些容

如 User=pi 不同請改名字

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
After=network.target

[Service]
User=pi
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
RestartSec=5
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

# Hardening
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

3 Enable Service

sudo systemctl enable syncthing

4 Start Service

sudo systemctl start syncthing

5 Check Serice Status

sudo systemctl status syncthing

6 如出現Active , 就無問題了。

Enjoy!!