Install Resilio Sync (BTSync) on Ubuntu 18.04, 18.10 Desktop/Server

This tutorial will be showing you how to install Resilio Sync (formerly BitTorrent Sync) on Ubuntu 18.04 and 18.10. Resilio Sync is a free, fast, peer-to-peer file sharing and syncing tool released by Resilio, Inc, available for Linux, FreeBSD, Mac, Windows, Android, iOS, Amazon Kindle Fire and NAS devices.

Unlike Dropbox or NextCloud, Resilio Sync does not require a central server to store files. Instead, you just need to install Resilio Sync on end devices to sync files via the BitTorrent protocol, so you will not be bound by the storage limit of a server.

Installing Resilio Sync on Ubuntu 18.04 and Ubuntu 18.10 From Official Repository

Resilio Sync has a repository for Ubuntu. First, we need to import Resilio Sync’s public key so that the package manager can verify the Resilio Sync package. Open up a terminal window and run the following command to download the public key.

wget http://linux-packages.resilio.com/resilio-sync/key.asc

Then import the public key with apt-key.

sudo apt-key add key.asc

Next, run the following commands to add the Resilio Sync repository. (The add-apt-repository command is provided by the software-properties-common package.)

sudo apt install software-properties-common

sudo add-apt-repository "deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free"

resilio sync ubuntu 18.04

Ubuntu 18.04 and 18.10 will automatically update package index, so you don’t have to manually run sudo apt update. Now install the Resilio Sync package with the following command.

sudo apt install resilio-sync

Once installed, Resilio Sync will be automatically started. You can check its status with:

systemctl status resilio-sync

resilio sync linux web

Hint: Press Q to gain back control of the terminal after running the above command.

If it’s not running, you can start it with:

sudo systemctl start resilio-sync

By default, Resilio Sync won’t start at boot time. You can enable auto start with:

sudo systemctl enable resilio-sync

Resilio Sync runs as the rslsync user and the Web UI listens on 127.0.0.1:8888 as specified in /etc/resilio-sync/config.json configuration file.

Setting Up the Resilio Sync Web UI

The Linux version of Resilio Sync doesn’t provide with a desktop client. Instead, you need to configure things via a web interface. Type in the following in your web browser address bar to access the Resilio Sync Web UI.

127.0.0.1:8888

If you install Resilio Sync on a remote Linux server, you need to set up a reverse proxy with Nginx or Apache in order to access the web UI. See the later part of this article.

You will be asked to set a username and password to secure the Web UI.

Then choose a name for your device and click Get started.

resilio sync reverse proxy

And enter the username and password you just created.

resilio sync listening port

Once logged in, you can share a folder on your computer to other devices or receive a folder from another device.

Sharing Folders with Other Devices

To share a folder on your computer, click the + button at the upper left corner and select standard folder.

resilio sync standard folder ubuntu

 

Then select a folder on your computer.

resilio sync Can't open the destination folder.

You might encounter the following error message.

Can't open the destination folder.

Or

Don't have permissions to write to selected folder.

That’s because Resilio Sync is running as rslsync user, who doesn’t have permission to access that folder.

Let’s say you selected your home folder /home/your-username/ as the shared folder. To fix the above error, all you need to do is to grant permissions on your home folder to the rslsync user with the following command.

sudo setfacl -R -m "u:rslsync:rwx" /home/your-username

The above command won’t change the owner of the shared folder. The owner has the same permissions as usual. What it does is to grant read, write and execute permissions to one more user, namely rslsync. Note that -R (recursive) flag must come before -m (modify) flag, which is immediately followed by the access control list entry (u:rslsync:rwx).

If you see this error:

sudo: setfacl: command not found

Then install the acl package and re-run the above setfacl command.

sudo apt install acl

Now you should be able to add your home folder as the shared folder.

After the folder is added, you can share this folder via a link, secret key or QR code.

resilio sync nginx reverse proxy

If the share folder is huge, it will take some time for Resilio Sync to index the content.

Receiving Folders From Other Devices

To receive a folder from another device, click the + button at the upper left corner and select “Enter a key or link”.

resilio sync https

Then enter the key or link.resilio sync receive folder

Using Resilio Sync on Ubuntu 18.04, 18.10 Server

You can install Resilio Sync on Ubuntu 18.04 and 18.10 server from repository mentioned above. If your server is sitting in the cloud, then you need to set up reverse proxy in order to access the Web UI because the Web UI listens on local host only. Once the reverse proxy is configured, you can access the Web UI via a domain name.

Setting Up Resilio Sync Reverse Proxy with Nginx

Nginx becomes more and more popular these days as a web server and reverse proxy. Install Nginx on Ubuntu 18.04, 18.10 server with the following command.

sudo apt install nginx

Start Nginx and enable auto start.

sudo systemctl start nginx

sudo systemctl enable nginx

Now create a virtual host file for Resilio Sync.

sudo nano /etc/nginx/conf.d/resilio-sync.conf

Copy and paste the following lines in to the file. Replace resilio.example.com with your real domain name. You should also add a DNS A record for this sub-domain.

server {
  listen 80;
  server_name resilio.example.com;

  access_log /var/log/nginx/resilio_access.log;
  error_log /var/log/nginx/resilio_error.log;
  location / {
     proxy_pass http://127.0.0.1:8888;
     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

Save and close this file. Then test Nginx configuations.

sudo nginx -t

If the test is successful, reload Nginx.

sudo systemctl reload nginx

Now in your browser’s address bar type in resilio.example.com and you should be able to access the Web GUI.

Setting Up Resilio Sync Reverse Proxy with Apache

Apache is well-known web server that can also be used as a reverse proxy. If you prefer Apache to Nginx, install it on Ubuntu 18.04, 18.10 server with:

sudo apt install apache2

Start Apache and enable auto start.

sudo systemctl start apache2

sudo systemctl enable apache2

To use Apache as a reverse proxy, we need to enable the proxy modules and the header module.

sudo a2enmod proxy proxy_http headers proxy_wstunnel

Now create a virtual host file for Resilio Sync.

sudo nano /etc/apache2/sites-available/resilio-sync.conf

Copy and paste the following lines in to the file. Replace resilio.example.com with your real domain name. You should also add a DNS A record for this sub-domain.

<VirtualHost *:80>
   ServerName resilio.example.com
   ErrorDocument 404 /404.html

   ProxyPass / http://localhost:8888/
   ProxyPassReverse / http://localhost:8888/

   ErrorLog ${APACHE_LOG_DIR}/resilio_error.log
   CustomLog ${APACHE_LOG_DIR}/resilio_access.log combined

</VirtualHost>

Save and close the file. Then enable this virtual host.

sudo a2ensite resilio-sync.conf

Restart Apache

sudo systemctl restart apache2

Now you can access the Web UI via resilio.example.com.

Secure the Resilio Sync Web GUI with HTTPS

To encrypt the HTTP traffic when you visit Resilio Sync web UI via a domain name, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Ubuntu 18.04, 18.10 server.

sudo apt install certbot

If you use Nginx, then you also need to install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Next, run the following command to obtain and install TLS certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d resilio.example.com

If you use Apache, install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

And run this command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d resilio.example.com

Where

  • --nginx: Use the nginx plugin.
  • --apache: Use the Apache plugin.
  • --agree-tos: Agree to terms of service.
  • --redirect: Force HTTPS by 301 redirect.
  • --hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
  • --staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

The certificate should now be obtained and automatically installed.

resilio sync ssl

And you can access Resilio Sync Web UI via HTTPS (https://resilio.example.com).

Open Resilio Sync Port in Firewall

In addition to the Web UI port, Resilio Sync also needs to listen on the public interface to connect to peers. The listening port is different for each device. You can find it in Resilio Sync Web UI by going to Preference -> Advanced.

resilio sync listening port ufw

If you enabled UFW firewall on your Ubuntu server, then you need to open this port. For example, my port is 22251, so I run the following command to open it.

sudo ufw allow 22251

Resilio Sync iOS App

I use Resilio Sync to sync files between my Ubuntu desktop, Ubuntu server and iPhone. Some say that the iOS app is a complete disaster, but I found it working very well. By default, Selective Sync is enabled in the iOS app. That means individual files will be synced only when you choose to. If you disable Selective Sync, all files will be synced immediately.

How to Configure Selective Sync

In the Web UI, Resilio Sync tells you that selective sync is a pro feature for Linux users, but actually we can configure selective sync from the command line. Every sync folder has a hidden .sync folder created by Resilio Sync. In this hidden folder, there’s a file named IgnoreList, which is a UTF-8 encoded .txt file that helps you specify single files, paths and rules for ignoring during the synchronization job. It supports “?” and “*” wildcard symbols.

For example, I need to sync a folder between computer A and B in read and write mode. Computer B contains a file that I don’t want to be synced to computer A. Here’s the steps that I did to ignore that file.

  1. I add the folder in computer A’s Resilio Sync web UI.
  2. Now computer A has a .sync hidden folder.
  3. I add the name of that file in IgnoreList on computer A, so it will refuse to receive that file from Computer B.
  4. Share the folder with computer B in read and write mode.
  5. Once the synchronization is finished, I can add the name of that file in Computer B’s IgnoreList, so computer B won’t share that file with other computers if a new computer joins the synchronization.

Conclusion

I hope this tutorial helped you install Resilio Sync on Ubuntu 18.04 and Ubuntu 18.10. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 5 Average: 5]

2 Responses to “Install Resilio Sync (BTSync) on Ubuntu 18.04, 18.10 Desktop/Server

  • Lorell Hathcock
    1 month ago

    Excellent tutorial! I followed the instructions and it worked correctly the first time. I used Ubuntu 18.04 and Nginx.

    Easy peasy!

  • Lorell Hathcock
    1 month ago

    Question: How do I configure Nginx in this case to allow for the web server to serve other sites? By following the instructions above, Resilio Sync is the one and only web server on the server.

    I would like to have Resilio Sync served in a subfolder and other subfolders (including the main folder) served normally. Like this:

    https://my.host.com/ – normal
    https://my.host.com/Resilio – Resilio Sync UI
    https://my.host.com/other_folders – other folders.

    As it is now with the above configuration, Resilio behaves as follows:

    https://my.host.com/ – redirects to https://my.host.com/gui and that is the Resilio Sync UI.

    I am also asking this question on the Nginx and Resilio forums.

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • If my answer helped you, please consider supporting this site. Thanks :)