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 btsync restart

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/

 

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

Share this page:

5 Comment(s)