Outils personnels
Vous êtes ici : Accueil GNU / Linux Debian Installer BTG et son interface Web wwwBTG sur Debian 4.0 Etch
Actions sur le document
  • Send this page to somebody
  • Print this page
  • Add Bookmarklet

Install BitTorrent client BTG and its Web user interface wwwBTG on Debian 4.0 Etch

Par Pierre-Yves Landuré - Dernière modification 18/09/2008 20:32

BTG is a BitTorrent client that work as a daemon. It can be controlled by various interfaces, one of them is a Web interface written in PHP. It is a serious competitor to Torrentflux-B4rt, the BitTorrent client that i'm using for the moment. This article help you to install BTG on Debian 4.0 Etch.

First, we install BTG build dependencies:

/usr/bin/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

We also need to install a HTTP server with PHP 5 support. In order to do this, you can follow my guide Install Lighttpd and PHP 5 on Debian 4.0 Etch.

Building Rasterbar libtorrent

We choose the version we are willing to install:

VERSION=0.12

We download the sources archive:

/usr/bin/wget http://switch.dl.sourceforge.net/sourceforge/libtorrent/libtorrent-$VERSION.tar.gz \
--output-document=/tmp/libtorrent-$VERSION.tar.gz

We extract the sources:

/bin/tar --directory=/tmp -xzf /tmp/libtorrent-$VERSION.tar.gz

And we go to the created folder:

cd /tmp/libtorrent-$VERSION

We configure the sources:

./configure

We build the library:

/usr/bin/make

And we install it:

/usr/bin/make install

BTG building

We choose the BTG version we are willing to install:

VERSION=0.9.7

We download the sources archive:

/usr/bin/wget http://download.berlios.de/btg/btg-$VERSION.tar.gz \
--output-document=/tmp/btg-$VERSION.tar.gz

We extract the sources:

/bin/tar --directory=/tmp -xzf /tmp/btg-$VERSION.tar.gz

And we go to the created folder:

cd /tmp/btg-$VERSION

We configure BTG to be installed with Web UI, session saving, script callback on event, and command line interface:

./configure --enable-www --enable-session-saving --enable-event-callback --enable-cli

We build BTG:

/usr/bin/make

And we install:

/usr/bin/make install

Setup

First, we install the Web interface:

/bin/ln -s /usr/local/share/wwwbtg/htdocs/ /var/www/btg

Once this done, we install daemon configuration file:

/bin/mkdir /etc/btg
/usr/bin/wget http://howto.landure.fr/gnu-linux/debian-4-0-etch/installer-btg-et-son-interface-web-wwwbtg-sur-debian-4-0-etch/daemon.ini \
--output-document=/etc/btg/daemon.ini

We download the daemon init.d script:

/usr/bin/wget http://howto.landure.fr/gnu-linux/debian-4-0-etch/installer-btg-et-son-interface-web-wwwbtg-sur-debian-4-0-etch/btgdaemon \
--output-document=/etc/init.d/btgdaemon
/bin/chmod +x /etc/init.d/btgdaemon

We create the btg user that the daemon will run under:

/usr/sbin/adduser --home /var/lib/btg --no-create-home --disabled-login --disabled-password --system --group btg

We create the log file:

/usr/bin/touch /var/log/btg.log
/bin/chown -R btg:btg /var/log/btg.log

We create the BTG downloads directory:

/bin/mkdir /var/lib/btg
/usr/bin/touch /var/lib/btg/sessions.ini
/bin/chown -R btg:btg /var/lib/btg

User creation

Once every thing is ok, we create the users. In order to do this, choose the username you wan to use:

USERNAME=login

And use these command lines to create the user:

/bin/mkdir --parent /var/lib/btg/users/$USERNAME/temp
/bin/mkdir --parent /var/lib/btg/users/$USERNAME/work
/bin/mkdir --parent /var/lib/btg/users/$USERNAME/seed
/bin/mkdir --parent /var/lib/btg/users/$USERNAME/dest
/bin/chown -R btg:btg /var/lib/btg/users/$USERNAME
/usr/local/bin/btgpasswd --config /etc/btg/daemon.ini --create --add \
--temp /var/lib/btg/users/$USERNAME/temp \
--work /var/lib/btg/users/$USERNAME/work \
--seed /var/lib/btg/users/$USERNAME/seed \
--dest /var/lib/btg/users/$USERNAME/dest \
--password --username $USERNAME

Controlling BTG

To start BTG daemon, use:

/etc/init.d/btgdaemon start

To stop it, use:

/etc/init.d/btgdaemon stop

If you want BTG daemon to start when your computer start, use this command line:

/usr/sbin/update-rc.d btgdaemon defaults

Used ports

If you want to edit the ports used by btgdaemon for the BitTorrent download (9000 to 9100), you just need to modify the following line into the file /etc/btg/daemon.ini:

torrent-range=9000:9100

Using BTG

Once the daemon is started, you can access your BTG web interface by using this URL:

Note: If BTG does not fit your needs, I encourage you to try Torrentflux-B4rt that do the same thing, but in another way. In order to do this, I invite you to follow my guide Install Torrentflux-b4rt on Debian 4.0 Etch.

Thanks

  • Thanks to BTG developpers.
  • Thanks to the writer of BTG Howto.
Attachements

ldconfig

Posté par alex le 23/06/2008 19:47
Nice giude.

Don't forget to run:
sudo ldconfig
after make install for btg.

Alex

Thanks!

Posté par J le 13/07/2008 16:34
Great instructions! Works on Ubuntu as well - I installed it on Gutsy.

It's also useful to put the adduser commands into a shell script if your going to make a few, eg /etc/btg/adduser.sh

#!/bin/bash
USERNAME=$1
/bin/mkdir --parent /var/lib/btg/users/$USERNAME/temp
/bin/mkdir --parent /var/lib/btg/users/$USERNAME/work
/bin/mkdir --parent /var/lib/btg/users/$USERNAME/seed
/bin/mkdir --parent /var/lib/btg/users/$USERNAME/dest
/bin/chown -R btg:btg /var/lib/btg/users/$USERNAME
/usr/local/bin/btgpasswd --config /etc/btg/daemon.ini --create --add \
--temp /var/lib/btg/users/$USERNAME/temp \
--work /var/lib/btg/users/$USERNAME/work \
--seed /var/lib/btg/users/$USERNAME/seed \
--dest /var/lib/btg/users/$USERNAME/dest \
--password --username $USERNAME

change user or default rights

Posté par Leon le 08/10/2008 13:41
I have a question, when a download is completed, the file's owner is the btg user and default other users dont have rights to write. now i changed the $user/dest folder's rights, but if the download contains folders with files they are again owned by the btg user and other users dont have rights to write. is it possible to change this, so that other users also have rights to write?

owner ship

Posté par Pierre-Yves Landuré le 08/10/2008 13:54
being confronted to the same kind of problems, there is two solution:

- add the users that need to access the files to the "btg" group. (this is the clean way, but i don't know if it will work).

- Create a cron job to change ownership of btg files.


change user or default rights

Posté par Leon le 08/10/2008 16:10
to add someone else to the btg group won't work, because the group also has no write permissions.

the cron job is like you say not a clean way, but it will work.

Is it not possible to run the daemon under an other user? than the downloaded files will have an other owner.
if that is possible i can run the daemon under the same user as i use to access my files with.

thanks!

Leon

it is possible

Posté par Pierre-Yves Landuré le 08/10/2008 16:21
It is possible to change the user running btg why editing /etc/init.d/btg, or creating a /etc/default/btg... but it is a big security issue.

I think you should stick to the cron job.

Thanks

Posté par Leon le 08/10/2008 17:03
Ok thank you!

url downloading?

Posté par Greg le 22/10/2008 20:48
now that URL downloading is supported, how do you get that to work? i thought i had it working by adding "--enable-url" to the ./configure script, but when i try to add a file from url, i get
error: AJAX call failed, no XML DOM returned! Data: <br />
<b>Fatal error</b> undefined class constant 'CN_CURLSTATUS' in /usr/local/share/wwwbtg/htdocs/bcore/command/context_create_url.php on line 133

if i refresh the page manually it will start the download, and i can add another torrent and all is well, how do i prevent this message and allow for additional torrents after the 1 is loaded? also, amazing work on this site!

any ideas?

curl is missing

Posté par lwolf le 23/10/2008 05:36
try installing php5-curl:

sudo apt-get install php5-curl
/etc/init.d/lighttpd force-reload

good luck

gtkmm

Posté par Marc le 25/11/2008 23:21
Thanks a lot !
works great whit my Debian Etch.

Is possible use the GTKmm for controlled Daemon ?

Thanks again for your work.

Marc


GTKmm ?

Posté par lwolf le 26/11/2008 06:46
Yeah, it is probably possible, but this was not the goal of this guide. I don't have X on my servers XD.


Good luck

UI

Posté par Marc le 26/11/2008 19:28
Thanks for reply , and sorry for my bad english.

I'm a noob in Linux.
I was looking for a guide for how to install
IU on BTG, this client i think is very good!
Usually i use rtorrent from the shell
whit my server, not OVH :D but anyway have speed 100/100 :D
but I was intrigued to try BTG, and your guide was really well done.
even compliments.

If you know a link where explains how to install IU in BTG, i'm very grateful.

Excuse my Off Topic, and thanks again for your attention.

Marc



don't know

Posté par lwolf le 26/11/2008 21:11
But take a look at the BTG howto link in the thanks section.

Good luck

(ps: may be adding --enable-gui to the configure command line can do the trick... but i'm just guessing here).

--enable-gui

Posté par Marc le 27/11/2008 18:29
Hello Again !

I read the "how to" section and thanks for your suggestion.
but my english is poor :(

I can add the command:
./ configure --enable-gui

but i must install before gtkmm?


Thanks.


Marc


poor english ?

Posté par Pierre-Yves Landuré le 27/11/2008 18:47
By looking at your firstname, i guess that perhaps you are french.

This site is mainly french, so there is a french version of the btg gui... and on my own i'm a french guy :)

As for what you need to install BTG, i've no idea, since i don't use this software outside of a server, since i find transmission fine for my desktop needs.

Now i use wTorrent as webgui to rtorrent (but it is a pain to install).


IP

Posté par Marc le 27/11/2008 19:17
hello Pierre-Yves Landure'

Thanks for reply.

Yes , i'm not french , if u are admin of site , can see my IP !

Marc ....is Marco :)

Anyway thanks for great work (u explain very well )
if u want to explain how to install Wtorrent , this is a great step !
becouse i'm fans of rtorrent and seedbox !(i guess u know what this is )

i tested WWWbtg , and the speed is very poor ! (i have tested on FTN )


thanks again.

if u whant contact me :
underscore72@hotmail.it



BlogBang
Navigation
 

Réalisé avec Plone

Ce site respecte les normes suivantes :

Wikio