You are here: Home / Debian GNU/Linux / System / Software / Install the BitTorrent client BTG on Debian

Install the BitTorrent client BTG on Debian

by Pierre-Yves Landuré last modified Nov 11, 2017 09:30

BTG is a command line BitTorrent client which can work as a daemon. It can be controlled by various user interfaces, one of which is a PHP Web application. This howto help you to install the torrent client on Debian.

This howto is tested on :

  • Debian 5.0 Lenny
  • Debian 6.0 Squeeze

Installation

Install the required software :

command apt-get install wget build-essential libgnutls-dev \
libboost-iostreams-dev libboost-filesystem-dev \
libboost-date-time-dev libboost-thread-dev \
 libboost-program-options-dev libssl-dev \
pkg-config libexpat1-dev dialog libncurses5-dev \
 libboost-serialization-dev libboost-regex-dev \
autogen automake libtool

libTorrent Rasterbar installation

Fetch the latest libTorrent version supported by BTG :

MAX_VERSION="$(command wget 'http://btg.berlios.de/' \
--quiet --output-document=- \
| command grep --max-count=1 --after-context=3 'btg/btg-.*.tar.gz' \
| command tail -n 1 \
| command sed -e 's|^.*/\([^/]*\)</td>.*$|\1|' \
| command cut --delimiter=. --fields=1-2)"

Get the download URL of the library stable version, and compute the version number from this URL :

SOURCE_URL="$(command wget --quiet --output-document=- \
    'http://code.google.com/p/libtorrent/downloads/list' \
    | command grep --max-count=1 "${MAX_VERSION}.*.tar.gz" \
    | command sed -e 's|.*href="\([^"]*\)".*|http:\1|')"
VERSION="$(echo "${SOURCE_URL}" \
    | command sed -e 's/.*libtorrent-rasterbar-\(.*\).tar.gz.*/\1/g')"

Download the sources archive :

command wget "${SOURCE_URL}" \
    --output-document="/tmp/libtorrent-rasterbar-${VERSION}.tar.gz"

Decompress the archive :

command tar --directory "/tmp" -xzf "/tmp/libtorrent-rasterbar-${VERSION}.tar.gz"

Go to the created folder :

command pushd "/tmp/libtorrent-rasterbar-${VERSION}"

Compile the library :

./configure
command make

Install the library :

command make install

Delete the downloaded files :

command popd
command rm -r "/tmp/libtorrent-rasterbar-${VERSION}"
command rm "/tmp/libtorrent-rasterbar-${VERSION}.tar.gz"

BTG installation

Fetch the latest stable version sources using the sf-downloader script:

command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/sf-downloader' \
--quiet --no-check-certificate --output-document='/tmp/sf-downloader'
command chmod +x '/tmp/sf-downloader'
SOURCE="$(/tmp/sf-downloader --tgz "btg.berlios" btg-VERSION.tar.gz)"

Go to the created folder :

command pushd "${SOURCE}"

Correct the libgnutls dependency and the other dependency errors :

command sed -i -e 's/AM_PATH_LIBGNUTLS(/PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= /' \
 "${SOURCE}/configure.in"
command sed -i -e '/include <stdlib.h>/a\
#  include <stdio.h>' "${SOURCE}/bcore/os/fileop.cpp"
command sed -i -e '/include <fcntl.h>/a\
#include <stdio.h>' "${SOURCE}/bcore/os/socket.cpp"
command sed -i -e 's/gnutls_fingerprint(SHA_DIGEST/gnutls_fingerprint(GNUTLS_DIG_SHA1/' \
"${SOURCE}/bcore/os/gnutlsif.cpp"
command sed -i -e '/include "logif.h"/a\
#include <stdio.h>' "${SOURCE}/bcore/logger/logger.cpp"

Configure the compilation :

./autogen.sh
./configure --enable-www --enable-session-saving \
--enable-event-callback --enable-cli --enable-btg-config

Compile the tool :

command make

Install the tool :

command make install

Delete the downloaded files :

command popd
command rm -r "${SOURCE}"

Usage

Configure the tool :

command btg-config

Run the tool with its ncurse user interface :

command btgncli

Run the tool from command line :

command btgcli

Thanks