How to Install BitTorrent Sync on a Linux Server

Previously, we have introduced you to BitTorrent Sync that allows you to sync your files from computer to computer using Bittorrent technology. If you have your own web server, you can use btsync as a backup tool to back up files from your computer to the web server. Here is how you can setup BitTorrent Sync on your server.

Note: This tutorial assumes that you have a Linux server and you have administrative rights to the server. If you are using a Windows server, this tutorial is not applicable.

1. Login to your remote server via SSH. At the Home directory (or any folder that is not accessible by the public), create a “btsync” folder.

mkdir btsync
cd btsync

Next, fetch the BitTorrent Sync installer from the web.

wget http://btsync.s3-website-us-east-1.amazonaws.com/btsync_x64.tar.gz

I am using the 64-bit version of the installer. You can choose the version most appropriate for your server.

Extract the tar file:

tar -xvzf btsync_x64.tar.gz

If you run a “ls” command, you should see the “btsync” and the “LICENSE.TXT” file.

btsync-extracted-files

Execute the btsync file.

./btsync

This will run BitTorrent Sync in the background.

btsync-running-background

Now, go to your browser and type in the address: “http://your-ip-address:8888

On an Apache server with multiple domains, you might need to add the following entry to the domain-specific vhost file:

<Location /gui/>
        ProxyPass http://127.0.0.1:8888/gui/
        ProxyPassReverse http://127.0.0.1:8888/gui/
        Redirect permanent /btsync /gui/
</Location>

Restart the Apache server and you will be able to access via the URL: “http://your-domain-name/gui/

btsync-web-gui

By default, the BTSync GUI is publicly available and anyone can access it. What you want to do is to add a password protection so only you can access it.

In remote server, create a “btsync.config” file. Make sure you place it in a location that is not accessible by the public.

nano btsync.config

Paste the following lines to the blank file:

{
    "webui":
    {    "listen" : "0.0.0.0:8888",
          "login" : "YOUR_LOGIN_USERNAME",
          "password" : "YOUR_LOGIN_PASSWORD"
    }
}

Replace “YOUR_LOGIN_USERNAME” and “YOUR_LOGIN_PASSWORD” with your username and password.

Save (ctrl + o) and exit the file (ctrl +x).

Next, add the config file to btsync:

./btsync --config /path/to/btsync.config

Note: you have to stop/kill the currently running process before you can add the config file. Once added, btsync will autostart by itself.

Now, refresh your browser and it will prompt you for the login credential.

With the web GUI, you will be able to add folder and the secret to start syncing the files from your computer to the server. Remember that you have to install the BitTorrent Sync client on your computer as well before you can sync the files.

Enjoy!