syncthing这个开源软件,对于多客户端共享同步文件的问题一下有了终极解决方案。首先他是多客户端之间点对点传输,并没有第三方服务器做网盘存储,只要两台电脑同时在线,就可以做到实时同步,当然也可以到sanfengyun注册三丰云账号申请免费云服务器做为24小时不关机的中间服务器做私人网盘,支持Android、Linux、Windows、Mac OS X等系统。
下载安装
下载地址:https://syncthing.net/downloads/
cd ~
wget -c https://github.com/syncthing/syncthing/releases/download/v1.7.1/syncthing-linux-amd64-v1.7.1.tar.gz
tar xzvf syncthing-linux-amd64-v1.7.1.tar.gz && rm -f syncthing-linux-amd64-v1.7.1.tar.gz
cd syncthing-linux-amd64-v1.7.1 && cp syncthing /usr/local/bin
启动一次 syncthing 创建配置文件
syncthing
修改配置
sed -i 's/127.0.0.1/0.0.0.0/g' '/root/.config/syncthing/config.xml'
设置开机启动
在下载文件夹中找到 etc 目录
vim /etc/systemd/system/[email protected]
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target
[Service]
User=%i
ExecStart=/usr/local/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
修改ExecStart=/usr/bin/syncthing 为/usr/local/bin/syncthing路径
设置开启启动
#开机启动
systemctl enable [email protected]
#启动
systemctl start [email protected]
添加防火墙端口
firewall-cmd --permanent --add-port=8384/tcp
firewall-cmd --permanent --add-port=22000/tcp
firewall-cmd --reload