Linux Mint 安装 Syncthing
Syncthig 是非常理想的分布式数据同步工具,在 Linux 系统的安装也非常简单。本文记录在 Linux Mint 18.3 (Sylvia) 上安装 Syncthing 的过程。
下载安装包
官网下载对应架构的版本 https://syncthing.net
安装
将 syncthing 二进制文件复制到当前用户的 ~/bin
目录,没有该目录自行创建。例如,当前用户为 herald
,则家目录为 /home/herald
,在该目录创建一个 bin
目录,把 syncthing 二进制文件放进去即可。
之所以不把 synthing 放到 /usr/bin
等公共目录,是因为 syncthing 要以普通用户身份运行,版本升级时会出现权限不足无法升级的问题。
配置(用户级别)系统服务
用户级别系统服务,当且仅当用户登录系统后该服务才会启动,用户注销登录服务会立即停止。
syncthing 软件包中针对各种系统启动器提供了服务配置文件,这里以 systemd
为例。
将压缩包中的 /etc/linux-systemd/user/syncthing.service
文件复制到 /home/herald/.config/systemd/user
目录。
修改 syncthing.service
配置文件,将 ExecStart=/bin/syncthing
修改为 ExecStart=/home/herald/bin/syncthing
,如下:
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
[Service]
ExecStart=/home/herald/bin/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
[Install]
WantedBy=default.target
设置开机启动
$ systemctl --user enable syncthing.service
$ systemctl --user start syncthing.service
配置(系统级别)系统服务
将软件包中 etc/linux-systemd/system/[email protected]
文件重命名并复制到 /lib/systemd/system/[email protected]
,文件名中 @
与 .
之间为指定运行 syncthing
服务的用户。
配置文件中默认 syncthing
二进制程序文件位于 /user/local/bin/
,可根据实际位置修改。
设置开机启动
~ $ systemctl enable syncth[email protected]
~ $ systemctl start [email protected]
会员讨论区