I’ve been slowly trying to cut down on my online file storage footprint by switching to software and tools that I’m in full control over. For example, I was once a very heavy user of Dropbox and similar tools when it came to transferring files around between my computers, but that could leave my files exposed in the cloud, not to mention it was slow due to the time it took to communicate with the remote server.
This is where Resilio Sync comes into play. Once called, BitTorrent Sync, this software allows you to transfer files between devices on your network, without a middleman, in a peer-to-peer (P2P) fashion, like you would find with the popular BitTorrent protocol. The more devices, the faster the synchronization.
We’re going to see how to install and configure Resilio Sync on a Raspberry Pi to act as a synchronization node on your network for file storage and fast transfers.
To clear things up, you shouldn’t think of Resilio Sync as a backup solution that can be implemented on a Raspberry Pi. There are better solutions for that, for example, I’m using Minio on one of my Raspberry Pi devices for that. Instead, Resilio Sync is best designed for file synchronization, as in bi-directional movement of files between connected devices.
Before getting too involved, the assumption before starting this tutorial is that you have Raspbian already installed on a Raspberry Pi. If you need help with the Raspbian installation, check out my previous tutorial titled, Use Your Raspberry Pi as a Headless System without a Monitor. You’ll also need internet connectivity, so my tutorial titled, Automatically Apply a WiFi Network Configuration to a Raspberry Pi, might help.
Resilio Sync has come a long way since I had first started using it. Instead of having to jump through a lot of hoops to get it installed, we can follow just a few simple steps.
The first step is to register the Resilio repository. After having SSH’d into the Raspberry Pi, execute the following:
echo "deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free" | sudo tee /etc/apt/sources.list.d/resilio-sync.list
With the repository registered, you’ll need to add a public key so that you can use it. From the Terminal, execute the following:
wget -qO - https://linux-packages.resilio.com/resilio-sync/key.asc | sudo apt-key add -
Assuming you’re using a Raspberry Pi 3 like I am, you’ll now need to add the correct architecture and update the repository list with all the new information:
sudo dpkg --add-architecture armhf
sudo apt-get update
When we first registered the repository, it created a file for us with various information about Resilio, but it did not include information about the architecture. We need to alter the repository file to include this information.
Open the /etc/apt/sources.list.d/resilio-sync.list file on the Raspberry Pi and change, what should be the only line, to this:
deb [arch=armhf] http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free
Finally, we can install Resilio Sync on our Raspberry Pi by executing the following:
sudo apt-get update
sudo apt-get install resilio-sync
Now if you’re reading the instructions above and you feel like they look familiar, it is because I copied them almost exactly from the official documentation.
So what is the value in this tutorial then? Most of the value comes into play with the configuration of Resilio Sync on the Raspberry Pi.
By now Resilio Sync should be installed and is probably running as well. However, if you were to reboot your Raspberry Pi, the synchronization service likely won’t start back up. We actually have to enable it to autostart and we can do that through the following command:
sudo systemctl enable resilio-sync
Now when your Raspberry Pi restarts, the synchronization service will start. This does not mean that we’re in the clear yet. We need to configure the service, and if you’re like me, it needs to be configured in headless mode without a monitor.
By default, Resilio Sync serves a web interface on Linux that can be accessed at http://localhost:8888/gui, but it is only accessible from the local host, not a remote computer. The easy way to resolve this is through port mapping with an SSH tunnel. Assuming you’re using the default hostname on your Raspberry Pi, execute the following from your host computer:
ssh email@example.com -L 8888:raspberrypi.local:8888 -N
The above command will create a tunnel where all traffic on the host machine for port 8888 will be directed to port 8888 on the remote machine. This tunnel allows us to operate on our host machine as if we were directly on the Raspberry Pi.
From your web browser, open http://localhost:8888/gui and proceed to completing the configuration wizard. By the end of this, you’ll have a functional Resilio Sync node on your Raspberry Pi, at which point you can close the tunnel.
You just saw how to configure Resilio Sync, formally BitTorrent Sync, on a Raspberry Pi. This creates a potentially always up synchronization node for file transfers on your local network.
I personally paid for a family license of Resilio Sync. If you think this software could help you, make sure you understand the licensing on what you can do with the free version versus a paid version. I can speak from experience that this software is very fast and it cuts out the need to pay for monthly services.