Create a folder in /opt and cd to it
$ sudo mkdir -p /opt/syncthing
$ cd /opt/syncthing
Get the latest arm version of syncthing from github (https://github.com/syncthing/syncthing/releases/) x marks the version number.
$ sudo wget https://github.com/syncthing/syncthing/releases/download/vx.xx.x/syncthing-linux-arm-vx.xx.x.tar.gz
sudo tar -xzvf syncthing-linux-arm-vx.xx.x.tar.gz
sudo rm syncthing-linux-arm-vx.xx.x.tar.gz
Move content one folder up
$ sudo mv syncthing-linux-arm-vx.xx.x/* .
$ sudo rm -r syncthing-linux-arm-vx.xx.x
link to it (not moving) so you can call it using 'syncthing'
$ sudo ln -s /opt/syncthing/syncthing /usr/bin/syncthing
Start syncthing
$ syncthing
Wait until you get something like:
INFO: Device 7NNIJMJ-RQ657WA-RI5YH6L-RQ657WA-RQ657WA-VGKSUYP-U6QBJNA-RQ657WA
write down this number or copy it if you SSH'd to your pi.
quit the operation using CTRL + C.
Change the config file so you can access the GUI from any PC within the network
$ nano ~/.config/syncthing/config.xml
Change
127.0.0.1:8384
to
0.0.0.0:8384
OPTIONAL: if you forward port 8384 (or any port you would like to use) on your router to you pi, you can access the GUI from anywhere in the world as long as you know you home(public) IP address.
Make sure you use https and enable authentication!
Start syncthing again
$ syncthing
on a PC in the same network, go to the GUI and disable automatic updates.
GUI -> Settings -> Disable Automatic updates
hit save and restart syncthing.
To enable syncthing on boot
cd to /etc/init.d/
$ cd /etc/init.d/
Download the script(Hint: its the script below)
$ sudo wget https://gist.githubusercontent.com/OIWitteveen/3452618e182ce9746343/raw/4cc25a607197f0d58ae8e416a986795cce9cd17e/syncthing
Change the directory line in the script to match the syncthing location
$ sudo nano /etc/init.d/syncthing
Change
DAEMON=/usr/local/bin/syncthing
to
DAEMON=/opt/syncthing/syncthing
exit and save (CTRL + X -> ENTER)
Make the script executable
$ sudo chmod +x /etc/init.d/syncthing
make the script start during boot
$ sudo update-rc.d syncthing defaults
Restart the the pi to apply changes
$ sudo reboot
If there's a new version of syncthing, use
$ sudo syncthing -upgrade
Then reboot the system.
$ sudo reboot
To remove syncthing use
$ sudo rm -r /opt/syncthing
$ sudo rm /usr/bin/syncthing
$ sudo rm -r /home/pi/.config/syncthing
$ sudo rm /etc/init.d/syncthing
optionally, delete any folder used with syncthing.