BTSync on AWS EC2

Objective: Allow Ubuntu to start BTSync on reboot.
 

Server

  1. create an EC2 instance, with appropriate storage space.
    • Ubuntu LTS 64bit (currently 14.04)
  2. download the BTSync client
  3. dump the btsync.conf
    1. ./btsync –dump-sample-config > btsync.conf
  4. edit the btsyn.conf for your settings.
  5. sudo su
  6. create /etc/init.d/btsync file
    • See below
  7. chmod 755 /etc/init.d/btsync
  8. update-rc.d btsync defaults
  9. service btsync start
  10. test the connection against other boxes.

Web GUI

  1. Since we’re on EC2, and security is paramount.
  2. Establish a port tunnel
    1. sudo ssh -i ~/.ssh/EC2KEY.pem -L 8888:127.0.0.1:8888 ubuntu@serverHostNameOrIP
  3. Connect to the system via: http://127.0.0.1:8888/gui
  4. Verify that all is working on the server end.

 

Client(s)

  1. Connect w/the shared keys.
  2. Verify that the system is working.
  3. Put a file into the shared folder. Notice that the file should go up to the server.

 

On the Server EC2 instance.

create the file /etc/init.d/btsync
 

#!/bin/bash
# /etc/init.d/btsync
# @see: http://askubuntu.com/a/352240 source
if (( $EUID != 0 )); then
    echo "Please run as root"
    exit
fi
# Carry out specific functions when asked to by the system
case "$1" in
start)
    /USERACCOUNT/.btsync/btsync --config /USERACCOUNT/.btsync/btsync.conf
    ;;
stop)
    killall btsync
    ;;
*)
    echo "Usage: /etc/init.d/btsync {start|stop}"
    exit 1
    ;;
esac
exit 0

 
Update 2014-08-23

  • changed the init.d script to bash, and added root check.
  • Noticed that BTsync does not work well over a VPN connection.

Leave a Reply

Your email address will not be published.