setup syncthing [raspberrypi,windows,android,ubuntu,debian]

https://github.com/syncthing/syncthing/wiki/Community-Contributions

setup syncthing on raspberrypi:
mkdir ~/PiSync
sudo mkdir -p /opt/syncthing
cd /opt/syncthing

get the latest version of syncthing for linux-arm:
https://github.com/syncthing/syncthing/releases/
when i wrote this tutorial it was:
sudo wget https://github.com/syncthing/syncthing/releases/download/v0.11.26/syncthing-linux-arm-v0.11.26.tar.gz
sudo tar -xzvf syncthing-linux-arm-v*
sudo rm syncthing-linux-arm-v*.tar.gz
#to copy content from next folder into the one you are in
sudo mv syncthing-linux-arm-v*/* .
sudo rm -r syncthing-linux-arm-v*
#link it so you can just start it with syncthing
sudo ln -s /opt/syncthing/syncthing /usr/bin/syncthing

wget -O - https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb http://apt.syncthing.net/ syncthing release" | sudo tee -a /etc/apt/sources.list.d/syncthing-release.list
sudo apt-get update
sudo apt-get install syncthing -y

start syncthing once:
syncthing
wait until it says something like:
INFO: Device 7NNIJMJ-RQ657WA-RI5YH6L-RQ657WA-RQ657WA-VGKSUYP-U6QBJNA-RQ657WA
copy the device id from terminal-output to a file for later use
quit with ctrl+c

edit the config.xml so you can reach it from another pc:
nano ~/.config/syncthing/config.xml
change it from

<gui enabled="true" tls="false">
    <address>127.0.0.1:8384</address>
</gui>

to:

<gui enabled="true" tls="true">
    <address>RPI-IP:8384</address>
</gui>

(repplace RPI-IP with the ip address of the raspberrypi. for example 192.168.1.5)
exit and save it

start syncthing:
syncthing

connect to your pi in your pc browser: RPI-IP:8384
in your browser click on->i know the risk->add exception
click on the top right on the settings button and choose ->settings
deactivate: globale auffindung
deactivate: automatische updates
click on the bottom on save
click on restart
press on “add directory”
choose directory id: mysync
choose directory path: /home/pi/PiSync/
click on the bottom on save
click on restart
quit with ctrl+c

create a syncthing-start-script:
cd /etc/init.d/
sudo wget https://gist.githubusercontent.com/arudmin/5a13e9105814c3f568ec/raw/dbe7ee6db610ef928c2341db1ae93e588f3c4b60/syncthing

edit the syncthing-start-script(maybe change syncthing username also):
sudo nano /etc/init.d/syncthing
change the line:

DAEMON=/usr/local/bin/syncthing

to:

DAEMON=/usr/bin/syncthing

/opt/syncthing/syncthing

exit and save it

make the script executeable and some other stuff:
sudo chmod +x /etc/init.d/syncthing
sudo update-rc.d syncthing defaults
sudo reboot

if there is a new version of syncthing for linux-arm you can upgrade:
sudo syncthing -upgrade
sudo reboot

disable syncthing:
sudo mv /etc/init.d/syncthing /home/pi/syncthing
sudo reboot

remove syncthing on raspberrypi:
sudo rm -r /opt/syncthing
sudo rm /usr/bin/syncthing
sudo rm -r /home/pi/.config/syncthing
sudo rm -r PiSync
sudo rm -r Sync
sudo rm /etc/init.d/syncthing

setup syncthing on windows 32 / 64 bit:
create a new folder C:\Users\freddy\WinSync
make a desktop shortcut for C:\Users\freddy\WinSync
get the latest version of syncthing for windows-386:
https://github.com/syncthing/syncthing/releases/
when i wrote this tutorial it was:
download for 32bit https://github.com/syncthing/syncthing/releases/download/v0.11.26/syncthing-windows-386-v0.11.26.zip
download for 64bit https://github.com/syncthing/syncthing/releases/download/v0.11.26/syncthing-windows-amd64-v0.11.26.zip
put the file into C:\Users\freddy\Documents
unzip it (maybe use 7zip)
open the folder and start the file inside
wait until it says “http setup”
connect in your browser to http://127.0.0.1:8384/
click on the top right on the settings button and choose ->settings
deactivate: globale auffindung
deactivate: automatische updates
click on the bottom on save
click on restart
press on “add directory”
choose directory id: mysync
choose directory path: C:\Users\freddy\WinSync
click on the bottom on save
click on restart
click on the bottom right on the settings-icon->show id
copy the device id to a file for later use
put all files you like to sync into C:\Users\freddy\WinSync
exit the syncthing window

start syncthing on boot with windows:
get the latest version of syncthingtray:
https://github.com/iss0/SyncthingTray/releases
when i wrote this tutorial it was:
download for 32bit https://github.com/iss0/SyncthingTray/releases/download/v0.3.1/SyncthingTray_v0.3.1_x86.zip
download for 64bit https://github.com/iss0/SyncthingTray/releases/download/v0.3.1/SyncthingTray_v0.3.1_x64.zip
put the file into C:\Users\freddy\Documents
unzip it with 7zip
then run the SyncthingTray.exe inside
change the path to your syncthing.exe
activate start on boot
activate minimize on start
press on start (hope it works)
press on exit
reboot your pc (and check if it autostarts)

remove syncthing on windows:
delete the folders
C:\Users\freddy\WinSync
C:\Users\freddy\Documents\syncthing-windows-..
C:\Users\freddy\AppData\Local\SyncthingTray
C:\Users\freddy\AppData\Local\Syncthing

setup syncthing on android:
get the latest syncthing apk from playstore cause fdroid seams not to get always the latest version:
https://play.google.com/store/apps/details?id=com.nutomic.syncthingandroid&hl=en
https://f-droid.org/repository/browse/?fdid=com.nutomic.syncthingandroid
when i wrote this tutorial it was:
https://f-droid.org/repo/com.nutomic.syncthingandroid_72.apk
open the app
click on the top left corner->settings>syncthing options->deactivate “global finding”->accept restart
click on the top left corner and remember the device id for later use
make a new directory /storage/emulated/0/AndroidSync on your phone
press on “add directory” on the top right
choose directory id: mysync
choose directory path: /storage/emulated/0/AndroidSync
click on the bottom right on create
accept restart

setup syncthing on ubuntu:
based on http://apt.syncthing.net
mkdir ~/UbuntuSync
leftclick in /home/freddy/ on UbuntuSync and select “create link”
drag and drop the link to your desktop
sudo apt-get install curl -y
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb http://apt.syncthing.net/ syncthing release" | sudo tee /etc/apt/sources.list.d/syncthing-release.list
sudo apt-get update
sudo apt-get install syncthing -y

deactivate firewall in ubuntu-mate for syncthing to find a device after that you can reactivate the firewall

start syncthing from terminal:
open terminal with (Ctrl + Alt +T)
syncthing

Now syncthing should run first time and create a key
if it opens the webinterface:
press on “add directory”
choose directory id: mysync
choose directory path: /home/freddy/UbuntuSync/
click on the bottom on save
click on restart
click on the top right on the settings-icon->show id
copy the device id to a file for later use

syncthing gui and starter:
based on:
http://www.webupd8.org/2014/09/syncthing-gui-gtk3-python-gui-ubuntu-ppa.html
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install syncthing-gtk

to remove the gui:
sudo apt-get purge syncthing-gtk
sudo add-apt-repository --remove ppa:nilarimogard/webupd8
sudo apt-get update

backup the syncthing folder in ubuntu(cause syncthing is still in development):
mkdir ~/Dokumente/backups/
tar -zcf "/home/freddy/Dokumente/backups/archive-UbuntuSync-$(date +"%H-%M-%S_%d-%m-%Y").tgz" /home/freddy/UbuntuSync/

remove syncthing on ubuntu:
sudo apt-get --purge autoremove syncthing -y
sudo rm -r /home/freddy/UbuntuSync
sudo rm -r /home/freddy/Sync
sudo rm -r /home/freddy/.config/syncthing

setup syncthing on debian:
based on http://apt.syncthing.net
mkdir ~/DebianSync
sudo apt-get install curl -y
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb http://apt.syncthing.net/ syncthing release" | sudo tee /etc/apt/sources.list.d/syncthing-release.list
sudo apt-get update
sudo apt-get install syncthing -y

enable syncthing in ufw (firewall):
based on:
https://docs.syncthing.net/users/firewall.html

start gufw and add the two rules for in:
Port 22000/TCP (or the actual listening port if you have changed the Sync Protocol Listen Address setting.)
Port 21027/UDP (for discovery broadcasts on IPv4 and multicasts on IPv6)

start syncthing from terminal:
syncthing

Now syncthing should run first time and create a key
if it opens the webinterface:
press on “add directory”
choose directory id: mysync
choose directory path: /home/freddy/DebianSync/
click on the bottom on save
click on the top right on the settings-icon->show id
copy the device id to a file for later use

Create a launcher:

sudo apt-get install --no-install-recommends gnome-panel -y
cd ~/Bilder
wget https://syncthing.net/images/logo-horizontal.svg
gnome-desktop-item-edit ~/.local/share/applications --create-new

name:syncthing
command:/usr/bin/syncthing
commend:Client for file syncronisation
Icon:/home/freddy/Bilder/logo-horizontal.svg

syncthing gui and starter [debian]:
cd ~
git clone https://github.com/syncthing/syncthing-gtk.git
cd ~/syncthing-gtk && ./setup.py build # will build the package underneath 'build/'
cd ~/syncthing-gtk && sudo ./setup.py install # will install the package

install dependencies:
sudo pip install python-dateutil
sudo apt-get install gir1.2-rsvg-2.0

change the starter:
sudo nano /usr/local/share/applications/syncthing-gtk.desktop
and change it from
/usr/bin/syncthing-gtk
to
/usr/local/bin/syncthing-gtk

syncthing gui and starter [ubuntu]:
based on:
http://www.webupd8.org/2014/09/syncthing-gui-gtk3-python-gui-ubuntu-ppa.html
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install syncthing-gtk

remove syncthing gui:
sudo apt-get purge syncthing-gtk
sudo add-apt-repository --remove ppa:nilarimogard/webupd8
sudo apt-get update

backup the syncthing folder in debian(cause syncthing is still in development):
create a launcher for syncthing backup:
touch ~/.sync_backup.sh
chmod +x ~/.sync_backup.sh
nano ~/.sync_backup.sh

#!/bin/bash
tar -zcf "/home/freddy/Dokumente/backups/archive-DebianSync-$(date +"%H-%M-%S_%d-%m-%Y").tgz" /home/freddy/DebianSync/

test it with:
~/.sync_backup.sh

create the launcher:
gnome-desktop-item-edit ~/.local/share/applications --create-new
name:sync-backup
command:/home/freddy/.sync_backup.sh
commend:backup the sync folder

remove syncthing on Debian:

cd
sudo apt-get --purge autoremove syncthing -y
sudo rm -r ~/DebianSync
sudo rm -r ~/Sync
sudo rm -r ~/.config/syncthing
sudo rm ~/.local/share/applications/syncthing.desktop
sudo rm ~/.local/share/applications/sync-backup.desktop
sudo rm ~/.sync_backup.sh

AFTER you have installed syncthing on every device you can add the other devices to every device:
For every device do:

open http://127.0.0.1:8384/ in a browser of the device
wait a minute or so (so every device in the network has already spoken to it)
click on the bottom right on "add device"
doubleclick into "device id" and choose one of the things that are avaliable
now compare to which of the "device ids" you wrote down it fits and give it a devicename
activate the directory "mysync"
save it
accept restart

(do that again until every device is added for this device)

sometimes it is necessary to trigger a full rescan if some folder get stuck or keep having problems
for a full rescan just delete the index directory:
Windows: %AppData%/Syncthing/index
Unix: ~/.config/syncthing/index
OS X: ~/Library/Application Support/Syncthing/index

https://github.com/syncthing/syncthing/wiki/Getting-Started
http://syncthing.net/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s