Install Syncthing under windows and ubuntu

Syncthing

A tool that can be used to synchronize files between different devices.

Install under window

There is a client version, which is maintained by the community. I downloaded it and tried it, but I did not follow the latest version. It seems that there are bug s in other articles, and the boss also gave other solutions.
That is to say, a bat file is started automatically at boot, and the command line tool provided by Syncthing is started.

Go to the official website for the next package https://syncthing.net/downloads/

Then win + r Enter shell:startup , and create a new bat file in it (you can create a new txt file first, enter the following content, and then change the txt suffix to bat)
Three places need to be modified

  1. D:\software\syncthing-windows-amd64-v1.22.0\syncthing.exe

program directory.

  1. -config="C:\Users\admin\AppData\Local\Syncthing"

Syncthing's configuration directory. You have to run the syncthing.exe of the installation package before it will appear, and the following one is the same

  1. -data="C:\Users\admin\AppData\Local\Syncthing\index-v0.14.0.db"
@ECHO OFF
%1 start mshta vbscript:createobject("wscript.shell").run("""%~0"" ::",0)(window.close)&&exit
start /b D:\software\syncthing-windows-amd64-v1.22.0\syncthing.exe -config="C:\Users\admin\AppData\Local\Syncthing" -data="C:\Users\admin\AppData\Local\Syncthing\index-v0.14.0.db" -no-browser

After the program runs, access http://127.0.0.1:8384/ Can enter the management page

Reference link
https://blog.csdn.net/rockage/article/details/121079720

Install under ubuntu

Synchronization service requires a 24-hour online server. I use Tencent Cloud, the system is Ubuntu Server 20.04 LTS

# Add the release PGP keys:
sudo curl -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg

# Add the "stable" channel to your APT sources:
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list

# Update and install syncthing:
sudo apt-get update
sudo apt-get install syncthing

# check version
syncthing --version

The above is installed, but there will be a problem. The webui of this thing cannot be accessed with the public network ip of the server. It can only be accessed with http://127.0.0.1:8384/ access. It should be solved with the reverse proxy of nginx. I was too lazy to configure it for a long time, and then I found another way.

The following source reference link 1
Since Ubuntu 18.04+, the syncthing service can be managed by creating a systemd configuration file. The official also provides configuration files: etc/linux-systemd
First create a file
sudo vim /etc/systemd/system/syncthing@.service
Then enter the following

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target

[Service]
User=%i
ExecStart=/usr/bin/syncthing -no-browser -gui-address="0.0.0.0:8384" -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

[Install]
WantedBy=multi-user.target

In this way, you can use the ip given by Tencent Cloud to access, of course, the firewall has to open 8384.
Note: And you must open port 22000, otherwise you can't add remote devices (I was trapped for a long time)
Then you can configure systemd

# Update systemd services
sudo systemctl daemon-reload

# Start the syncthing service
sudo systemctl start syncthing@$USER
# Turn on auto-start
sudo systemctl enable syncthing@$USER

# View service status
systemctl status syncthing@$USER

Reference link

  1. https://computingforgeeks.com/how-to-install-and-use-syncthing-on-ubuntu/
  2. https://apt.syncthing.net/

The following links briefly describe how to use it:
https://zhuanlan.zhihu.com/p/69267020

Tags: Linux Windows Ubuntu

Posted by acabrera on Thu, 03 Nov 2022 01:12:47 +0300