Manually Installing Resilio Sync (rslSync) on the Raspberry Pi: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
No edit summary
Line 4: Line 4:
== Create Folder for BitTorrent Sync ==
== Create Folder for BitTorrent Sync ==
<pre>
<pre>
sudo mkdir -p /opt/btsync/bin
sudo mkdir -p /opt/resilio/bin
sudo mkdir /opt/btsync/app_files
sudo mkdir /opt/resilio/app_files
cd /opt/btsync/bin
cd /opt/resilio/bin
sudo wget  https://download-cdn.getsyncapp.com/stable/linux-arm/BitTorrent-Sync_arm.tar.gz -O btsync_arm.tar.gz
sudo wget  https://download-cdn.getsync.com/stable/linux-arm/resilio-sync_arm.tar.gz
sudo tar -xvf btsync_arm.tar.gz
sudo tar -xvf resilio-sync_arm.tar.gz
sudo rm -f btsync_arm.tar.gz
sudo rm -f resilio-sync_arm.tar.gz
</pre>
</pre>


Line 15: Line 15:


<pre>
<pre>
sudo vi /etc/init.d/btsync
sudo vi /etc/init.d/resilio
</pre>
</pre>


Line 22: Line 22:
<pre>
<pre>
#! /bin/sh
#! /bin/sh
# /etc/init.d/btsync
# /etc/init.d/resilio
#
#


Line 28: Line 28:
case "$1" in
case "$1" in
start)
start)
     /opt/btsync/bin/btsync --config /opt/btsync/bin/btsync.conf
     /opt/resilio/bin/resilio --config /opt/resilio/bin/resilio.conf
     ;;
     ;;
stop)
stop)
     killall btsync
     killall resilio
     ;;
     ;;
*)
*)
     echo "Usage: /etc/init.d/btsync {start|stop}"
     echo "Usage: /etc/init.d/resilio {start|stop}"
     exit 1
     exit 1
     ;;
     ;;
Line 44: Line 44:
Set appropriate permissions for the new file and set defaults for service.
Set appropriate permissions for the new file and set defaults for service.
<pre>
<pre>
sudo chmod 755 /etc/init.d/btsync
sudo chmod 755 /etc/init.d/resilio
sudo update-rc.d btsync defaults
sudo update-rc.d resilio defaults
</pre>
</pre>


Line 52: Line 52:


<pre>
<pre>
sudo vi /opt/btsync/bin/btsync.conf
sudo vi /opt/resilio/bin/resilio.conf
</pre>
</pre>


Line 67: Line 67:
   otherwise user-defined directory will be used
   otherwise user-defined directory will be used
*/
*/
   "storage_path" : "/opt/btsync/app_files",
   "storage_path" : "/opt/resilio/app_files",


// uncomment next line if you want to set location of pid file
// uncomment next line if you want to set location of pid file
// "pid_file" : "/var/run/btsync/btsync.pid",
  "pid_file" : "/var/run/resilio.pid",


   "check_for_updates" : true,
   "check_for_updates" : true,
Line 103: Line 103:
//  use --generate-secret in command line to create new secret
//  use --generate-secret in command line to create new secret
       "secret" : "MY_SECRET_1",          // * required field
       "secret" : "MY_SECRET_1",          // * required field
       "dir" : "/opt/btsync/sync_test",    // * required field
       "dir" : "/opt/resilio/sync_test",    // * required field


//  use relay server when direct connection fails
//  use relay server when direct connection fails
Line 131: Line 131:


= Mount a USB Hard Disk =
= Mount a USB Hard Disk =
There is not much space if just using the inbuilt SD card as storage so have a look at [[Mount_USB_Device]] to connect a USB hard disk to your rPi btSync.
There is not much space if just using the inbuilt SD card as storage so have a look at [[Mount_USB_Device]] to connect a USB hard disk to your rPi.


[[Category : BtSync]] [[Category : Raspberry Pi]] [[Category : Linux]]
[[Category : resilio]] [[Category : Raspberry Pi]] [[Category : Linux]]

Revision as of 00:21, 15 September 2016

raspbian on the Raspberry Pi

Once raspbian has been installed or imaged it is very simple to setup Bittorrent Sync. Normally I would create an image but as this is so simple I will just include the instructions.

Create Folder for BitTorrent Sync

sudo mkdir -p /opt/resilio/bin
sudo mkdir /opt/resilio/app_files
cd /opt/resilio/bin
sudo wget  https://download-cdn.getsync.com/stable/linux-arm/resilio-sync_arm.tar.gz
sudo tar -xvf resilio-sync_arm.tar.gz
sudo rm -f resilio-sync_arm.tar.gz

Create a Service

sudo vi /etc/init.d/resilio

Copy the following contents into the file.

#! /bin/sh
# /etc/init.d/resilio
#

# Carry out specific functions when asked to by the system
case "$1" in
start)
    /opt/resilio/bin/resilio --config /opt/resilio/bin/resilio.conf
    ;;
stop)
    killall resilio
    ;;
*)
    echo "Usage: /etc/init.d/resilio {start|stop}"
    exit 1
    ;;
esac

exit 0

Set appropriate permissions for the new file and set defaults for service.

sudo chmod 755 /etc/init.d/resilio
sudo update-rc.d resilio defaults

Configuration File

Create a configuration file with your required settings. Pay special attention to the login and password fields as the default login is username and the default password is password. Also pay attention to the listening value as I have used port 80 which is the default port for HTTP.

sudo vi /opt/resilio/bin/resilio.conf


Add the following contents to the new file.

{
  "device_name": "My BitTorrent Sync",
  "listening_port" : 0,                       // 0 - randomize port

/* storage_path dir contains auxilliary app files
   if no storage_path field: .sync dir created in the directory
   where binary is located.
   otherwise user-defined directory will be used
*/
  "storage_path" : "/opt/resilio/app_files",

// uncomment next line if you want to set location of pid file
   "pid_file" : "/var/run/resilio.pid",

  "check_for_updates" : true,
  "use_upnp" : true,                              // use UPnP for port mapping


/* limits in kB/s
   0 - no limit
*/
  "download_limit" : 0,
  "upload_limit" : 0,

/* remove "listen" field to disable WebUI
   remove "login" and "password" fields to disable credentials check
*/
  "webui" :
  {
    "listen" : "0.0.0.0:80",
    "login" : "username",
    "password" : "password"
  }

/* !!! if you set shared folders in config file WebUI will be DISABLED !!!
   shared directories specified in config file
   override the folders previously added from WebUI.
*/
/*
  ,
  "shared_folders" :
  [
    {
//  use --generate-secret in command line to create new secret
      "secret" : "MY_SECRET_1",           // * required field
      "dir" : "/opt/resilio/sync_test",    // * required field

//  use relay server when direct connection fails
      "use_relay_server" : true,
      "use_tracker" : true,
      "use_dht" : false,
      "search_lan" : true,
//  enable sync trash to store files deleted on remote devices
      "use_sync_trash" : true,
      "sync_trash_ttl" : 365,      // Default is 30 days.
//  specify hosts to attempt connection without additional search
      "known_hosts" :
      [
        "192.168.1.2:44444"
      ]
    }
  ]
*/

// Advanced preferences can be added to config file.
// Info is available in BitTorrent Sync User Guide.

// http://btsync.s3-website-us-east-1.amazonaws.com/BitTorrentSyncUserGuide.pdf

}

Mount a USB Hard Disk

There is not much space if just using the inbuilt SD card as storage so have a look at Mount_USB_Device to connect a USB hard disk to your rPi.