Install Bittorrent Sync on Debian / Ubuntu

Want to support HowtoForge? Become a subscriber!
 
Submitted by sjau (Contact Author) (Forums) on Mon, 2014-02-24 10:21. :: Debian

Install Bittorrent Sync on Debian / Ubuntu

Author: Stephan Jau
Revision: v1.0
Last Change: December 30, 2013

Introduction

BitTorrent Sync is a new piece of software by BitTorrent Inc. - the original creator of the BitTorrent protocol. While most might be familiar with BitTorrent, only a few know of BitTorrent Sync. Normal .torrent files are static and once created they can't be altered anymore. BitTorrent Sync however allows updates to the data and syncs them to the peers. BitTorrent Sync is also available cross-plattform (Linux, Android, Windows, Mac OSX, iOS) and it has two distinctive operation modes. You can have a many-to-many synchronization meaning that every node can alter the content and have it synced to the other devices. Or you can have a one-to-many synchronization meaning that only the Master Node can alter data and this is then synced to all other nodes. Especially the one-to-many synchronization is of interested if you want to create backups and store them at multiple sites - using the power of BitTorrent swarms (meaning each nodes starts providing updates to other nodes as soon as they are received).

While BitTorrent Sync can be found at http://www.bittorrent.com/sync, user tuxpoldo provides nice packaged versions of BitTorrent Sync for Debian / Ubuntu. Those versions come as server versions and desktop version.

 

0. Install Windows / Mac OS X / Android / iOS Version

For Windows andn OS X ust download the installer files from http://www.bittorrent.com/sync/downloads

For Android or iOS just download BitTorrent Sync from according market (Google Play or iTunes Store).

 

1. Install BitTorrent Sync on Debian / Ubuntu Desktop

First we need to add the repository to the sources.list. Run the following commands as root.

apt-key adv --keyserver keys.gnupg.net --recv-keys 6BF18B15
CODENAME=$(lsb_release -cs | sed -n '/lucid\|precise\|quantal\|raring\|saucy\|trusty\|squeeze\|wheezy\|jessie\|sid/p')
echo "" >> /etc/apt/sources.list
echo "#### BitTorrent Sync - see: http://forum.bittorrent.com/topic/19560-debian-and-ubuntu-desktop-packages-for-bittorrent-sync/" >> /etc/apt/sources.list
echo "## Run this command: apt-key adv --keyserver keys.gnupg.net --recv-keys 6BF18B15" >> /etc/apt/sources.list
echo "deb http://debian.yeasoft.net/btsync ${CODENAME:-sid} main" >> /etc/apt/sources.list
echo "deb-src http://debian.yeasoft.net/btsync ${CODENAME:-sid} main" >> /etc/apt/sources.list
unset CODENAME
apt-get update
apt-get -y install btsync-user

This will fetch the GPG keys for the custom repository, it will then amend your sources list by the new repositories (you can disable the src repository if you want) and finally it installs the desktop version of BitTorrent Sync as provided by tuxpoldo.

After that log out and log back in or run the following command in the terminal (as normal user, not as root

btsync start

Now you should have a BitTorrent Sync icon in your system tray with which you can control it. This will also be auto-started at user login. To get more info about this package have a read here: http://forum.bittorrent.com/topic/19560-debian-and-ubuntu-desktop-packages-for-bittorrent-sync/

 

2. Install BitTorrent Sync on Debian / Ubuntu Server

First we need to add the repository to the sources.list. Run the following commands as root.

apt-key adv --keyserver keys.gnupg.net --recv-keys 6BF18B15
CODENAME=$(lsb_release -cs | sed -n '/lucid\|precise\|quantal\|raring\|saucy\|trusty\|squeeze\|wheezy\|jessie\|sid/p')
echo "" >> /etc/apt/sources.list
echo "#### BitTorrent Sync - see: http://forum.bittorrent.com/topic/18974-debian-and-ubuntu-server-packages-for-bittorrent-sync-121-1/" >> /etc/apt/sources.list
echo "## Run this command: apt-key adv --keyserver keys.gnupg.net --recv-keys 6BF18B15" >> /etc/apt/sources.list
echo "deb http://debian.yeasoft.net/btsync ${CODENAME:-sid} main" >> /etc/apt/sources.list
echo "deb-src http://debian.yeasoft.net/btsync ${CODENAME:-sid} main" >> /etc/apt/sources.list
unset CODENAME
apt-get update
apt-get -y install btsync

This will fetch the GPG keys for the custom repository, it will then amend your sources list by the new repositories (you can disable the src repository if you want) and finally it installs the server version of BitTorrent Sync as provided by tuxpoldo.

You will then be asked if you want to define a default BitTorrent Sync instance or not. The difference is that with the default instance you run BitTorrent Sync only lets you run BitTorrent Sync as root or btsync user. However if you have for example an existing Samba installation or something else that you want to use to sync data, you might not want to run it as default instance.

If you choose to install as default instance then just accept all the default options except for UPNP. I think that should be enabled in either case.

If you choose not to run a default instance then you need to manually create the user config file. There are samples in the /etc/btsync/sample folder but I'd like to provide an own below. Run as root (and maybe alter the file name):

touch /etc/btsync/samba.conf

Now edit that file and put the following content into it. Be sure to alter the UID, GID, UMASK, storage_path and password to your needs:

//!/usr/lib/btsync/btsync-daemon --config
//
// (c) 2013 YeaSoft Int'l - Leo Moll
//
// This btsync configuration file shows how to configure a btsync
// instance running under specific user credentials and/or how
// to supply additional configuration parameters.
//
// Configuration parameters not parsed by btsync but by the daemon
// init script can be supplied as comments in the configuration file.
//
// The following parameters are supported:
//
// DAEMON_UID:      A uid for supplying the user under which
//                  the btsync daemon should run
//
// DAEMON_GID:      A gid for supplying the group under which
//                  the btsync daemon should run. If omitted
//                  the daemon will run under the primary group
//                  of the user
//
// DAEMON_UMASK:    The umask (up to 4 octal digits) for the
//                  btsync daemon. If omitted the default umask
//                  is used.
//
// DAEMON_DEBUG:    The debug mask (4 hex digits) for the btsync
//                  daemon. If omitted the init script will not
//                  touch potential settings defined manually.
//                  If set to 0000, a potential settings file
//                  will be deleted. Full detail is set by
//                  specifying FFFF
//
// The parameter definition must use an equal sign ("="):
//
// DAEMON_UID=samba
// DAMONE_GID=samba
// DAEMON_UMASK=0022
//
// This example will launch the instance running under the credentials
// of the user "samba" using 0022 as umask
// The internal data of the btsync daemon will be written in
// /home/samba/.btsync
//
{
        "device_name": "SMB btsync Server",
        "listening_port" : 0,
        "storage_path" : "/home/samba/.btsync",
        "check_for_updates" : false,
        "use_upnp" : true,
        "download_limit" : 0,
        "upload_limit" : 0, 
        "webui" :
        {
                "listen" : "0.0.0.0:8888",
                "login" : "admin",
                "password" : "Password"
        }
}

Of course you can also alter other things like port and stuff. Just be sure the storage_path folder exists. That's the place where BitTorrent Sync will store info on shared folders and stuff.

Now you can restart BitTorrent Sync with this the following command as root.

service restart btsync

You can now browse to the BitTorrent Sync machine (by IP or Domain) on the specified port and you'll be prompted for the username and password as provided in the config file. You also can run multiple BitTorrent Sync servers, just make another config file in that folder.

To get more info about this package have a read here: http://forum.bittorrent.com/topic/18974-debian-and-ubuntu-server-packages-for-bittorrent-sync-121-1/

 

3. Useful Links

The usage of BitTorrent Sync is pretty much self-explanatory. However I still link to some of the most useful manuals:
Getting Started on Desktop
Getting Started on Mobile
Mobile Manual and Mobile Backup
FAQ


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by ioconnor (not registered) on Mon, 2014-02-24 12:32.
Long term user of btsync here...

Nice write up. Minus a few unimportant mistakes. Like "moste" is usually spelled "most". I'll bookmark this article.

 On an aside. There are a few concerns. The people behind bittorrent sync ignore or hide from known issues. The most important is how the product does not scale up to handle 100s of GBs. So if you are trying to keep in sync a modern day hard disk full of say pictures you will notice your computer is no longer your computer. Instead it is locked out chugging away forever checking looking to see if a file needs to be synced. This is obviously a design flaw but it's been like this since day 1 and the folk behind btsync ignore it.


 

Submitted by Peter (not registered) on Wed, 2014-02-26 09:55.

Agreed - you make some valid points there. 

However, where I feel that it really does shine is as a backup system for "people who don't do backups". I have a couple of users who have effectively ignored all the semi-automated backup solutions I've put in place, so I then setup btsync to monitor their desktops and "My Documents" folders. Shortly after they make a change it's backed up, transparently. End of problem and everyone's happy.

Submitted by sjau (registered user) on Wed, 2014-02-26 09:24.

From what I read in the docs btsync is only limited by the power (cpu/ram/diskspace) that's available on your clients. This far I only sync several folder ranging from 2GB to 40 GB and haven't noticed a problem with those.

 Also, it's still in Beta stage IIRC.