BTSync with Orange Pi

This is a work in progress…

BTSync (now known as Resilio Sync Home) is a fantastic tool for syncing files between devices.  Here’s my diary on installing it onto a little Orange Pi One running Armbian.

First download the Armbian image and copy it to an SD card using Win32 Disk Imager.  Install as recommended setting a root password and sudo user.  Once set up you can use Putty to access the device.

I’ve found it simplest to use windows to prep the USB drive.  Plug it in and use DISKPART – select the partition and use CLEAN.

Once cleaned format the drive NTFS.

Remove the drive and plug it into the Orange Pi.  Ensure it’s working using lsblk:

root@orangepione:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 3.7T 0 disk
├─sda1 8:1 0 128M 0 part
└─sda2 8:2 0 3.7T 0 part
mmcblk0 179:0 0 14.5G 0 disk
└─mmcblk0p1 179:1 0 14.3G 0 part /

With the disk formatted we can mount it. First create a folder in /mnt – I’ll use windrv (since we want to read it ultimately in Windows):

mkdir /mnt/windrv

Then mount it using mount:

mount -t ntfs-3g /dev/sda1 /mnt/windrv

If this was successful we can add it to /etc/rc.local (I was having problems with /etc/fstab – seems the drive may not be ready when fstab loads)

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

mount -t ntfs-3g /dev/sda2 /mnt/windrv

exit 0

Next we can install Samba for sharing folders:

apt-get install samba

This will take a little while. Once installed we need a user for BTSync, create one and give it a password:

root@orangepione:/dev# adduser btsync
Adding user `btsync' ...
Adding new group `btsync' (1001) ...
Adding new user `btsync' (1001) with group `btsync' ...
Creating home directory `/home/btsync' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for btsync
Enter the new value, or press ENTER for the default
        Full Name []: btsync user
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y

Create a folder to share in /mnt/windrv – I’ll use Video:

mkdir /mnt/windrv/Video

With the drive mounted and Samba installed we can now add a share to Samba. Edit /etc/samba/smb.conf and add to the bottom of the file:

[Video]
   comment = Video Share
   path = /mnt/windrv/Video
   available = yes
   browsable = yes
   guest ok = yes
   read only = yes
   write list = btsync
   create mask = 0755

This will create a share with guest read only and write access to btsync. Reload the Samba service:

service smbd restart

And then test in Windows in a file explorer to \\192.168.xxx.xxx\Video.

Now we need to install Resilio Sync. First add the repository to the list:
(info here: https://help.resilio.com/hc/en-us/articles/206178924-Installing-Sync-package-on-Linux)

vi /etc/apt/sources.list
deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free
~

Slightly different for arm64:

deb [arch=armhf] http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free

Then add the Resilio key so we can install packages – change to the tmp folder first as the key is not necessary once done:

cd /tmp
wget https://linux-packages.resilio.com/resilio-sync/key.asc
apt-key add key.asc

Install Resilio Sync:

apt update
apt install resilio-sync

Slightly different install for Arm64:

dpkg --add-architecture armhf
apt update
apt install resilio-sync libc6:armhf

Start Resilio Sync and set it so it autostarts:

systemctl start resilio-sync
systemctl enable resilio-sync

All should now be working. Check by browsing to http:\\OPSync:8888

Below is some extra stuff for an Orange Pi Zero and enabling the Access Point:

Info found here:
https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/

Below is even more on installing Plex:

Info found here:
https://www.htpcguides.com/install-plex-media-server-on-orange-pi-devices/

Found this for Pine64:
http://jez.me/article/plex-server-on-a-pine64-how-to

sudo su -
apt-get install apt-transport-https
wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | apt-key add -
echo "deb https://dev2day.de/pms/ jessie main" >/etc/apt/sources.list.d/pms.list
dpkg --add-architecture armhf
apt-get update
apt-get install binutils:armhf
apt-get install --no-install-recommends plexmediaserver-installer

Some stuff about OpenVPN client:
https://askubuntu.com/questions/229800/how-to-auto-start-openvpn-client-on-ubuntu-cli

Copy the *.ovpn and *.txt to /etc/openvpn – the text file is named in auth-user-pass *.txt as:

your_server_user_name
your_server_passowrd
Save and Close
sudo nano OpenVPNConfigFile.ovpn

sudo nano /etc/default/openvpn

Uncomment AUTOSTART=”all”
sudo service openvpn start

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s