到官网下载对应的安装包:
Releases · syncthing/syncthing
然后到服务器上运行
wget https://github.com/syncthing/syncthing/releases/download/v1.30.0/syncthing-linux-arm64-v1.30.0.tar.gz
然后解压该命令:
tar -zxvf syncthing-linux-arm64-v1.30.0.tar.gz
得到一个解压后的目录,进行重命名为syncthing(可选)
mv syncthing-linux-arm64-v1.30.0 syncthing
进入syncthing目录
cd ./syncthing/
拷贝syncthing二进制文件到/usr/bin
cp ./syncthing /usr/bin
输入运行
syncthing
找到配置文件位置:
编辑配置文件:
vim /root/.local/state/syncthing/config.xml
修改127.0.0.1为0.0.0.0,然后保存
再次启动syncthing
浏览器访问服务器ip:8384即可进行该访问页面的GUI密码设置
在使用 Syncthing 时,除了 8384 端口(用于 Web UI),你还需要确保以下端口开放:
- 22000:用于同步数据的主要端口。
- 21027(UDP):用于局域网发现和连接。
开机自启:
创建服务文件:
vim /etc/systemd/system/syncthing.service
然后输入下面内容,这里是配置的是root用户运行,且运行目录如果跟着我做就是和我一样,不然就是你自己解压后存放的syncthing文件:
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=https://docs.syncthing.net/
After=network.target
[Service]
User=root
ExecStart=/usr/bin/syncthing -no-browser
[Install]
WantedBy=multi-user.target
然后保存退出后,执行以下命令启用服务:
sudo systemctl daemon-reload
sudo systemctl enable syncthing
sudo systemctl start syncthing
查看服务状态:
sudo systemctl status syncthing
再次打开前端页面,ip:8384即可!