下载
https://syncthing.net/downloads/
mkdir syncthing
cd syncthing/
wget https://github.com/syncthing/syncthing/releases/download/v1.19.1/syncthing-linux-amd64-v1.19.1.tar.gz
安装
解压并安装
tar -xvf syncthing-linux-amd64-v1.19.1.tar.gz
cd syncthing-linux-amd64-v1.19.1/
cp syncthing /usr/local/bin/
配置启动文件
cd etc/linux-systemd/system/
cp syncthing@.service syncthing@.service.bk
vim syncthing@.service
按i
键进入编辑模式,然后把第10行修改一下
原始:
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=4
[Service]
User=%i
ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0
Restart=on-failure
RestartSec=1
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
# Hardening
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
即把ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0
这一行里面的/usr/bin/syncthing
改为/usr/local/bin/syncthing
然后按wq
保存并退出
cp syncthing@.service /etc/systemd/system
先启动一次,生成默认配置文件
syncthing
修改Syncthing配置文件
cd /root/.config/syncthing/
cp config.xml config.xml.bk1
vim config.xml
把监听地址127.0.0.1:8384
改为0.0.0.0:8384
即可
启动Syncthing
systemctl enable syncthing@root.service
systemctl start syncthing@root.service
防火墙放行三个端口
22000|21027/udp
8384/tcp
然后打开http://ip:8384/
就可以详细配置了
参考:
https://docs.syncthing.net/users/config.html
https://docs.syncthing.net/users/autostart.html#using-systemd