在 Debian 上安装 syncthing 服务
租用了不带桌面环境的服务器之后,用 syncthing 来同步文件是一个不错的选择。下面记录一下我在 Debian 上配置 syncthing 的过程。
安装 Syncthing 官方仓库版本,并设置开机自动运行
sudo mkdir -p /etc/apt/keyrings
sudo curl -L -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable-v2" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt-get update
sudo apt-get install syncthing
sudo systemctl enable --now syncthing@admin.service
查看服务状态
sudo systemctl status syncthing@admin.service
通过 systemctl 进行管理
# 停止
sudo systemctl stop syncthing@admin.service
# 启动
sudo systemctl start syncthing@admin.service
# 重启
sudo systemctl restart syncthing@admin.service
# 禁用开机自启
sudo systemctl disable syncthing@admin.service
通过浏览器进行配置
不需要手动给服务器开通特定端口号,只要确保能 ssh 上就行。然后在电脑上通过 PowerShell 运行
ssh -N -L 9090:127.0.0.1:8384 user@Debian服务器IP/域名
打开浏览器访问 127.0.0.1:9090,成功登录服务器上的 syncthing 管理页面。