Clone
Table of Contents
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
一、中继/发现服务搭建(基于openEuler)
- 环境准备
- 部署中继服务器
#解压重命名文件夹
tar -zxvf strelaysrv-linux-amd64-v1.29.6.tar.gz -C /opt
mv /opt/strelaysrv-linux-amd64-v1.29.6/ /opt/strelaysrv
#创建启动文件:vim /etc/systemd/system/strelaysrv.service
[Unit]
Description=Syncthing Relay Server
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/strelaysrv/strelaysrv -pools=""
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
#启动服务并设置开机自启动
systemctl daemon-reload
systemctl enable strelaysrv
systemctl start strelaysrv
#查看状态,可查看中继URL
systemctl status strelaysrv
- 部署发现服务器
#解压重命名文件夹
tar -zxvf stdiscosrv-linux-amd64-v1.29.5.tar.gz -C /opt
mv /opt/stdiscosrv-linux-amd64-v1.29.5/ /opt/stdiscosrv
#创建启动文件:vim /etc/systemd/system/stdiscosrv.service
[Unit]
Description=Syncthing Discovery Server
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/stdiscosrv/stdiscosrv --listen=:9443 --db-dir="/opt/stdiscosrv/" --db-flush-interval=5m
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
#启动服务并设置开机自启动
systemctl daemon-reload
systemctl enable stdiscosrv
systemctl start stdiscosrv
#查看状态,可查看设备ID
systemctl status stdiscosrv
二、客户端部署
- Linux 下载链接
#创建启动用户
sudo useradd -r -s /bin/false -U -m -d /usr/share/st st
sudo usermod -a -G st $(whoami)
#下载安装包并解压
tar -zxvf tar -zxvf syncthing-linux-amd64-v1.29.6.tar.gz -C /opt
mv /opt/syncthing-linux-amd64-v1.29.6 /opt/syncthing
sudo chown -R st:st /opt/syncthing
#创建启动文件:vim /etc/systemd/system/syncthing.service
[Unit]
Description=Syncthing Client
After=network.target
[Service]
Type=simple
User=st
Group=st
ExecStart=/opt/syncthing/syncthing serve
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
#启动服务并设置开机自启动
systemctl daemon-reload
systemctl enable syncthing
systemctl start syncthing
#查看状态
systemctl status syncthing
完成后,登录http://127.0.0.1:8384页面配置网页认证密码、发现服务器、中继服务器、对端设备、同步文件夹等。
- Windows客户端以服务方式安装
- 下载nssm工具:下载链接,解压缩后将nssm.exe放入
C:\Windows\system32
目录下 - 下载syncthing windows版本:下载链接,解压缩后放在自己需要安装的目录中
- 打开终端安装服务,在图形界面中设置程序路径等
PS D:\Program Files\syncthing>nssm install syncthing
#服务参数参考
Path:D:\Program Files\syncthing\syncthing.exe
Startup directory:D:\Program Files\syncthing
Arguments:serve
- 最后,在任务管理器的服务中,找到syncthing服务,启动即可
完成后,登录http://127.0.0.1:8384页面配置网页认证密码、发现服务器、中继服务器、对端设备、同步文件夹等。
这是一个侧边栏演示页面
此页面没有任何版权保护,欢迎转载学习。