Install Syncthing on Ubuntu 16.04 using Debian Repository

Install Syncthing on Ubuntu 16.04 using Debian Repository

Tutorial that shows how to install Syncthing on Ubuntu 16.04 Desktop LTS Xenial Xerus

by Janeth Kent Date: 19-08-2016 sync syncthing ubuntu linux

Syncthing is a free continuous file synchronization tool that lets you synchronize your files across desktops, tablets, servers. It’s an open source alternative to the popular BitTorrent Sync (aka btsync) application. The creation, modification or deletion of files on one machine will automatically be replicated to your other devices. Syncthing does not upload your data to the cloud but exchange your data directly between your devices. All your data is encrypted when transmitting between your devices.

Install Syncthing on Ubuntu 16.04 via Official Deb Repository

Use curl to download the Syncthing GPG key then import the key to Ubuntu system with apt-key.

sudo apt-get install curl

curl -s https://syncthing.net/release-key.txt | sudo apt-key add -

-s option enables silent mode.

If you see OK in the terminal, that means the GPG key is successfully imported. Then add official Syncthing deb repository with the following command.

echo "deb http://apt.syncthing.net/ syncthing release" | sudo tee /etc/apt/sources.list.d/syncthing.list

Update local package index and install Syncthing on Ubuntu 16.04 LTS.

sudo apt-get update

sudo apt-get install syncthing

This deb repository also works on Debian or other Debian/Ubuntu-based Linux distros such as Linux Mint, Elementary OS.

Set Up Syncthing as a Systemd Service

The official Syncthing deb package ships with the needed systemd service file. Under /lib/systemd/system/ directory, you will find a [email protected] file. Enable syncthing to auto start when Ubuntu is booted up by running the below command. Replace username with your actual username.

sudo systemctl enable syncthing@username.service

The above command will create a symbolic link that points to the [email protected] file.

Created symlink from /etc/systemd/system/multi-user.target.wants/[email protected] to /lib/systemd/system/[email protected].

Now we can start the Syncthing service with the following command.

sudo systemctl start syncthing@username.service

Check status

systemctl status syncthing@username.service

Output:

[email protected] - Syncthing - Open Source Continuous File Synchronization for linuxbabe
   Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor preset: enabled)
   Active: active (running) since 六 2016-06-04 17:16:20 CST; 31s ago
     Docs: man:syncthing(1)
 Main PID: 5586 (syncthing)
   CGroup: /system.slice/system-syncthing.slice/[email protected]
    └─5586 /usr/bin/syncthing -no-browser -no-restart -logflags=0

We can see that Syncthing auto start is enabled and it’s running. Now in your Web browser’s address bar, type 127.0.0.1:8384 to access the Syncthing Web interface. You can add other Syncthing devices and share folders with them. The default syncing folder is ~/Sync

Ubuntu syncthing web interface

Configure Syncthing

We can now edit the configuration file that was created. Open the file in your text editor:

nano ~/.config/syncthing/config.xml

Look for a section that deals with the GUI. It should look like this:

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

The only change that we need to make is to replace the localhost address (127.0.0.1) with 0.0.0.0, which represents all network interfaces. This section will look like this when you are finished:

<gui enabled="true" tls="false">
    <address>0.0.0.0:8080</address>
</gui>

Save and close the file when you are finished. We will do more extensive configuration later on through the web interface.

 

Setting Up Security in the Web UI

We are finally ready to configure our instances through the web user interface.

Log into each of your servers' Syncthing interfaces by visiting their public IP addresses and port 8080:

http://server1_public_IP:8080
http://server2_public_IP:8080

You will see the main Syncthing screen:

Syncthing main screen

The first thing that we need to do is add some security to our interface. Go to the "Edit" menu in the upper right-hand corner and click on the "Settings" selection:

Syncthing settings

On the right side, we need to set up a username and password for the web interface. We also want to enable TLS encryption for our sessions so that our traffic cannot be intercepted in transit by checking the "HTTPS" box:

Syncthing security

When you are finished, click the "Save" button at the bottom.

You will see a message that prompts you to restart the service for the changes to take affect:

Syncthing restart

Click on the "Restart" button.

You will probably need to refresh the page for the changes to reload properly. When you do so, you will most likely encounter an SSL warning that looks like this:

Syncthing SSL warning

This is just letting you know that the entity that signed the SSL certificate is not in your browser's list of trusted certificate authorities. This is expected since the certificates are self-signed. It is safe to click on "Proceed anyway" to continue.

You will then get an authentication prompt for the username and password that you configured:

Syncthing username and password

Fill out the appropriate values and log in. Your interface is now more secure from outside traffic.

Complete these steps on both servers.

Connecting the Two Servers and Sharing Directories

In order to share content, Syncthing requires both ends of the connection to add the other server to their list of nodes. Then, both sides must also add a repository (directory) to synchronize.

To add a node, you will need the companion node's ID. You can get this ID by going to the "Edit" menu in the upper-right corner and selecting the "Show ID" option.

This will bring up an overlay with a long ID that you can copy. It will also give you a QR code in case you are configuring smart phone application. Copy the ID of the first node.

Syncthing copy ID

On the second server, click on the "Edit" menu and select "Add Node".

An overlay will appear with fields that you must configure to add the other server. In the "Node ID" field, paste the ID that you copied from the first server. In the "Node Name" field, select any descriptive name that you would like to use for your other server. Leave the "Addresses" as "dynamic":

Syncthing add node

When you are finished, click "Save" to add the new node.

Run through this same process in the reverse order so that both of the servers have the opposite server in their configuration. For the moment, ignore any requests to restart the service, because we will be making a few more additional changes first.

In the web interface, the nodes that you are connected to are shown on the right side. The repositories you are sharing are listed on the left. By default, a folder called Sync will be created in your home directory to act as the default repository. If the menu is compressed, click the name to expand the listing:

Syncthing default repo

Click on the "Edit" button to configure the repo. Towards the bottom, you will have the option to share this repository with any of the nodes that you have configured. Check the box associated with the opposite node and then click the "Save" button:

Syncthing share with node

Now, you can click on the "Restart" button to implement your changes:

Syncthing restart

Now, any changes made in the ~/Sync directory will be mirrored to the opposite server. By default, this will sync every 60 seconds, but this can be changed in the "Settings" menu.

You can add additional directories that you wish to mirror by choosing the "Add Repository" option from the "Edit" menu. The "Repository ID" must be the same on each of the servers for the directories to be associated.

Install Syncthing on Android

You can get Syncthing from Google Play store.

I hope this post helped you to install Syncthing on Ubuntu 16.04. Comments, questions or suggestions are always welcome. If you found this post useful, ? please share it with your friends on social media! Stay tuned for more Linux tutorials.

 
by Janeth Kent Date: 19-08-2016 sync syncthing ubuntu linux hits : 13924  
 
Janeth Kent

Janeth Kent

Licenciada en Bellas Artes y programadora por pasión. Cuando tengo un rato retoco fotos, edito vídeos y diseño cosas. El resto del tiempo escribo en MA-NO WEB DESIGN AND DEVELOPMENT.

 
 
 

Related Posts

Async/Await how they really work: an example

Promises give us an easier way to deal sequentially with asynchrony in our code. This is a welcome addition, given that our brains are not designed to deal efficiently with…

ArangoDB, install and configure the popular Database in ubuntu 16.04

Introduction to ArangoDb, open source, NoSQL, multi-model database BigData seems to be getting stronger every day and more and more NoSQL databases are coming out to the market, all trying to position…

How to Install Syncthing on Ubuntu 16.04

This tutorial shows how to install Syncthing on Ubuntu 16.04 Desktop LTS Xenial Xerus. Syncthing is a free continuous file synchronization tool that lets you synchronize your files across desktops, tablets,…

Syncronize Files Between Servers With RSYNC

Synchronize Files With rsync Synchronizing files from one server to another is quite awesome. You can use it for backups, for keeping web servers in sync, and much more. It's fast…

Install Bit Torrent Sync on Ubuntu

There are some great tools for syncing files over the internet available to us, but one stands out from the rest in regards of technology used and possible use cases. A…

How to use AdSense with Responsive Design

After some time publishing interesting information on your website, it is normal that you want to make a profit. One of the most widely used systems is Adsense, a Google…

Syncronize Files Between Two Ubuntu Servers Using Unison and Incron

File Synchronization Between Two Ubuntu Servers using Unison Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored…

Memcache: Installation and Usage on Ubuntu 12.10

About Memcache Memcache is a system that works to speed up virtual private servers by caching server information. The program allows you to allocate a specific amount of the server ram…

MySql: Setup Master Slave Replication in Ubuntu

About MySQL replication MySQL replication is a process that allows you to easily maintain multiple copies of a MySQL data by having them copied automatically from a master to a slave…