20140208 btsync on fedora - plembo/onemoretech GitHub Wiki

title: BTsync on Fedora link: https://onemoretech.wordpress.com/2014/02/08/btsync-on-fedora/ author: phil2nc description: post_id: 6967 created: 2014/02/08 17:03:29 created_gmt: 2014/02/08 22:03:29 comment_status: closed post_name: btsync-on-fedora status: publish post_type: post

BTsync on Fedora

Just a few quick notes on setting up the closed-source BitTorrent Sync (BTSync) for Fedora 19 Linux. This configuration will allow for the launching of a separate instance of BTSync for multiple users and leverages the multi user capabilities of systemd on Fedora 19. While my preference in handling my data is for open source products like rsync, it may turn out that none of them will find acceptance with my Windows users at home. Because of that I'm going to field test BTSync as a potential cross-plaform solution for backing up Windows user directories to our Fedora Linux backup server. A 32-bit setup is available for Windows, while there are 32 and 64-bit binaries for Linux. The Linux binaries are tarred and gzipped and consist of a single file, btsync. I unarchived btsync into /usr/local/bin on my Linux test machine. I then created a systemd init script, following this post in the Bittorrent user forum:

# /etc/systemd/system/[email protected]
[Unit]
Description=BitTorrent Sync for %i

[Service]
Type=simple
User=%i
ExecStart=/usr/local/bin/btsync --nodaemon --config %h/.btsync/sync.conf
WorkingDirectory=%h

[Install]
WantedBy=multi-user.target

For each user that will be running BTSync (for now just the "backup" system user), I also created a configuration file, $HOME/.btsync/sync.conf (the ~/.btsync directory needs to be manually created, a sample sync.conf can be created by invoking "btsync -- >sync.conf"):

# $HOME/.btsync/sync.conf
{
  "device_name": "zeus",
  "listening_port" : 0,     // 0 - randomize port
  "storage_path" : "/home/backup/.btsync",
  "check_for_updates" : true,
  "use_upnp" : true,       // use UPnP for port mapping
  "download_limit" : 0,
  "upload_limit" : 0,
  "webui" :
  {
    "listen" : "0.0.0.0:8888",
    "login" : "backup",
    "password" : "noneshallpass"
  }
}

Remember to change the listen port for the web ui to something unique if enabling multiple users on a system. For greater security you may also want to specify 127.0.0.1 as the host IP in the listen directive (e.g. "listen" : "127.0.0.1:8889"). Enable the service by issuing a

systemctl enable [email protected]

(substituting the real user name for "backup") and then start it with

systemctl start [email protected]

Use

systemctl status [email protected]

to check for errors. The btsync console should now be available at the url http://localhost:8888 (or whatever host and port specified in your configuration). POSTSCRIPT: Uninstalling BTSync All good things must come to an end, of course. So too did my testing of BTSync. Removing it would have been much easier if I'd just thought things through before I started. The main thing to remember is that as a multi-user targeted service, you should to disable it in systemd on a per user basis before ripping out your config and the binary. So...

systemctl stop btsync@backup

systemctl disable btsync@backup

After doing this for each user you should then whack the ~/.btsync configuration directory in each user's home and then delete the [email protected] under /etc/systemd/system, and btsync under /usr/local/bin.

Copyright 2004-2019 Phil Lembo