BitTorrent Sync was released last month and I’ve been playing around with it for the last couple of days. I currently have it syncing data between OwnCloud and my personal machine, effectively creating my own fully fledged DropBox replacement (more on that in another post!).
Today I am going to cover installing BitTorrent Sync into your copy of Debian (I am using Raspbian on my RasPi), so that when you restart the machine, it starts up with you. Hit the jump for the detailed instructions!
Update 18/5/13 – Thanks to BitTorrent forum user tuxpoldo for adding the Debian ARM packages so they can be installed through apt-get. Click here to go down that route, or do it manually below!
Update 1/09/2013 – Thanks for everyone who has posted a comment / asked for assistance on this post. This was really my first technical guide blog post, and has had an awful lot of hits over the last 3 months, so thanks again. I have updated the post to fix an issue with setting the init.d script to executable, rookie mistake!!
1. Download BitTorrent Sync
Get into your home directory on your OS and execute the command (this is the ARM version for the Raspberry Pi, use the correct architecture for your machine, go here), and take a look at the User Guide first, trust me!.
(EDIT: GreatMarko over at the BitTorrent Sync Forums just informed me of this link which has package installers for AMD / Intel based machines, will make this a lot easier for you guys but if you have a Raspberry Pi, stick around!)
wget http://btsync.s3-website-us-east-1.amazonaws.com/btsync_arm.tar.gz
Then run:
tar -zxf btsync_arm.tar.gz
2. Move the application and set permissions
You should now have a file called btsync. Now your going to need root access to your machine (we are installing this into the OS away from your home directory). I use the command sudo bash for this.
Now we need to create the directory to contain the application and its files. Run the below commands.
mkdir /etc/btsync
mv btsync /etc/btsync/
cd /etc/btsync/
chown root:root btsync
chmod 755 btsync
This makes the directory to contain the app, moves the program, sets the owner of the program to root and sets it to be executable.
3. Setup the btsync config
Bundled within the application is a config file, to get this out to change settings (this is the easiest way), run:
./btsync --dump-sample-config > sync.conf
This will have dumped a file called sync.conf in the same directory. Use your desired text editor to access and change some file settings (I use nano, which would be nano sync.conf).
Settings to change:
- “device_name” – anything you want
- “storage_path” – add // at the start of the line to comment out this line
- “login” – set a username OTHER THAN ADMIN
- “password” – choose a password – this is being stored in plain text so ensure you choose something you don’t usually use.
If you’re using nano hit Ctrl+O, Ctrl+X (save and quit) and then your good to go.
4. Create the init.d script
This is the script that you can use to start / stop the BitTorrent Sync application, and use it to boot up on start.
While still with root access, run the following:
nano /etc/init.d/btsync
This will open up a new file where you can write your script. You are going to need to copy the below EXACTLY into the window and save and quit.
#! /bin/sh
# /etc/init.d/btsync
#
# Start or Stop BT Sync
case "$1" in
start)
/etc/btsync/./btsync --config /etc/btsync/sync.conf
;;
stop)
pkill btsync
;;
*)
echo "Usage: /etc/init.d/btsync {start|stop}"
exit 1
;;
esac
exit 0
Next, set the script to executable. Run
chmod +x /etc/init.d/btsync
Once this has been done we need to set the the program to start on boot, using the following command:
update-rc.d btsync defaults
Once you have run the above you may see the below warnings, don’t worry about them!
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'btsync' missing LSB tags and overrides
You can start BitTorrent Sync by calling the following command:
/etc/init.d/btsync start
You are now done! To access your installation of BitTorrent Sync, point your browser at http://yourip:8888/gui. Enter the login details you saved in the config file and you are good to go. To use the features refer to the user guide!
If you have any comments, updates, annoyances with this please leave me a message below and I will try my best to help!