How To Install Resilio Sync On Ubuntu 16.04 Using Vagrant

https://www.linuxbabe.com/ubuntu/install-resilio-sync-ubuntu-16-04-16-10

https://help.getsync.com/hc/en-us/articles/206178924

1. Register the Resilio repository:

$ echo "deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free" | sudo tee /etc/apt/sources.list.d/resilio-sync.list

2. Add public key with the following command:

$ wget -qO - https://linux-packages.resilio.com/resilio-sync/key.asc | sudo apt-key add -

 

3. Install Resilio sync

$ sudo apt-get update

$ sudo apt-get install resilio-sync

4. Enable auto start at boot time using the following command:

$ sudo systemctl enable resilio-sync

5. Start Resilio Sync, use systemctl command.

$ sudo systemctl start resilio-sync

Check its status.

$ systemctl status resilio-sync

sample output:

● resilio-sync.service - Resilio Sync service
   Loaded: loaded (/lib/systemd/system/resilio-sync.service; enabled; vendor pre
   Active: active (running) since Sun 2017-03-19 15:58:56 UTC; 27s ago
     Docs: http://help.getsync.com/
  Process: 32665 ExecStart=/usr/bin/rslsync --config /etc/resilio-sync/config.js
  Process: 32662 ExecStartPre=/bin/chown -R rslsync:rslsync /var/run/resilio-syn
  Process: 32657 ExecStartPre=/bin/mkdir -p /var/run/resilio-sync (code=exited,
 Main PID: 32669 (rslsync)
    Tasks: 7
   Memory: 868.0K
      CPU: 25ms
   CGroup: /system.slice/resilio-sync.service
           └─32669 /usr/bin/rslsync --config /etc/resilio-sync/config.json

Mar 19 15:58:56 vagrant systemd[1]: Starting Resilio Sync service...
Mar 19 15:58:56 vagrant systemd[1]: Started Resilio Sync service.
lines 1-16/16 (END)

Ctrl+c to get back to the command prompt.

Once running, The Resilio Sync daemon will listen on 127.0.0.1:8888 as specified in /etc/resilio-sync/config.json configuration file. You can use “0.0.0.0” IP to force Sync to listen on all available interfaces and be reachable in LAN.

6. Open/edit the configuration file:

$ sudo nano /etc/resilio-sync/config.json

Change the line:

"listen" : "127.0.0.1:8888"

to:

"listen" : "0.0.0.0:8888"

Ctrl+x, then ‘Y’ to save and exit.

7. Restart resilio sync:

$ sudo systemctl restart resilio-sync

7.1 When using Vagrant / Virtualbox:

Open Virtualbox, right-click on the running virtual machine, click ‘Settings’, select ‘Network’, click ‘Advanced’, click ‘Port Forwarding’, add new port forwarding rule by clicking the ‘+’ icon in top right of menu, the enter:

‘Host IP’: 127.0.0.1
‘Host Port’: 8888
‘Guest Port’: 8888

Click ‘OK’ save and exit.

8. Access Resilio Web UI

Now you can type the following in your web browser address bar to access the Resilio Sync Web UI.

127.0.0.1:8888

which will redirect to http://127.0.0.1:8888/gui/

8.1 Sync on Linux will prompt for login and password to protect unauthorized access to Sync UI. Note, that password is optional, and later you will be able to change login options.

8.2 Then choose a name to show when you send and receive folders [Please choose carefully as this cannot be changed later].

8.3 You will prompted for your username and password that you entered in the previous step.

You are now logged in and can add folders to sync.


Service can also be run with the following arguments: start, stop, restart:

$ sudo systemctl start resilio-sync

Guide to Linux, and Sync peculiarities
https://help.getsync.com/hc/en-us/articles/204762449-Guide-to-Linux


ERRORS & SOLUTIONS

https://www.linuxbabe.com/ubuntu/install-resilio-sync-ubuntu-16-04-16-10

1. You might encounter the following error message. That’s because Resilio Sync is running as rslsync user.

Don’t have permissions to write to selected 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.

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

2. Could not find a solution to “Database error” when trying to add a folder to sync. tried changing permissions on folders but this still did not work.

UPDATE:
When this occurs, the database is corrupt and resilio must be stopped and restarted again. If this still does not fix the problem, I removed Resilio and reinstalled.


To Uninstall Sync

https://help.getsync.com/hc/en-us/articles/204775029-How-to-uninstall-Sync

1. Remove all shares from sync

2. Stop the application

$ sudo systemctl stop resilio-sync 

3. Delete resilio-sync package completely

$ sudo apt-get remove resilio-sync 
$ sudo apt-get purge resilio-sync

Using Resilio Sync With TLS Certificate

https://www.linuxbabe.com/ubuntu/install-resilio-sync-ubuntu-16-04-16-10

The above link goes into more detail on how to obtain a certificate from LetsEncrypt however, I won’t be doing that. I will be using the same self-signed certificate that all web apps are using on this local development server.

Create a server block file under /etc/nginx/conf.d/

$ sudo nano /etc/nginx/conf.d/rslsync.conf

Change the content of this file to the following. You can use your ip address or replace the ip address with your real domain name.

server {
  listen 80;
  server_name 192.168.1.100;
  return 301 https://$server_name$request_uri;
}
server {
  listen 443 ssl http2;
  server_name 192.168.1.100;

  ssl on;
  ssl_certificate     /etc/ssl/certs/apache-selfsigned.crt;
  ssl_certificate_key /etc/ssl/private/apache-selfsigned.key;
  ssl_session_timeout 5m;
  ssl_ciphers               'AES128+EECDH:AES128+EDH:!aNULL';
  ssl_protocols              TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;

  access_log /var/log/nginx/rslsync.log;
  location / {
      proxy_pass http://127.0.0.1:8888;
  }

}

Ctrl+x, then ‘Y’ to save and exit.

Test Nginx configuration and reload.

$ sudo nginx -t

$ sudo systemctl reload nginx

Go to your Resilio Sync Web GUI again, you will find HTTP connection is automatically redirected to HTTPS secure connection.

ERROR:
Could not get http to redirect with the above code. Tried various edits but no go.

$ sudo nginx -t

output:

nginx: [warn] conflicting server name "192.168.1.70" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "192.168.1.70" on 0.0.0.0:443, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

since all web apps are using the same server name/ip address, not sure how to correct this internally. Would work if I were using domain names to redirect to this server as done by the above referenced link.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.