Personal tools
You are here: Home GNU / Linux Debian 4.0 Etch Install BitTorrent client BTG and its Web user interface wwwBTG on Debian 4.0 Etch
Document Actions
  • 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

by Pierre-Yves Landuré last modified 2008-09-18 18: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:


We download the sources archive:

/usr/bin/wget$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:


We build the library:


And we install it:

/usr/bin/make install

BTG building

We choose the BTG version we are willing to install:


We download the sources archive:

/usr/bin/wget$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:


And we install:

/usr/bin/make install


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 \

We download the daemon init.d script:

/usr/bin/wget \
/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:


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:


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 to BTG developpers.
  • Thanks to the writer of BTG Howto.


Posted by alex at 2008-06-23 17:47
Nice giude.

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



Posted by J at 2008-07-13 14: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/

/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

Posted by Leon at 2008-10-08 11: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

Posted by Pierre-Yves Landuré at 2008-10-08 11: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

Posted by Leon at 2008-10-08 14: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.



it is possible

Posted by Pierre-Yves Landuré at 2008-10-08 14: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.


Posted by Leon at 2008-10-08 15:03
Ok thank you!

url downloading?

Posted by Greg at 2008-10-22 18: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

Posted by lwolf at 2008-10-23 03:36
try installing php5-curl:

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

good luck


Posted by Spotloan JW at 2018-06-18 03:10
loan online <a href="">loan online</a> installment loans online <a href=>payday loan online</a>


Posted by Spotloan MM at 2018-06-28 02:59
loan online <a href="">loan online</a> loan online - payday loan online


Posted by Online Loan at 2018-10-10 02:41
bad credit loans direct lenders <a href="">credit loans</a> bad credit loans guaranteed approval <a href=>bad credit loans guaranteed approval</a>


Posted by Online Lenders at 2018-10-18 21:41
e payday loan <a href="">payday loans in las vegas nevada</a> poor credit loans <a href=>bad credit loans</a>


Posted by Marc at 2008-11-25 21:21
Thanks a lot !
works great whit my Debian Etch.

Is possible use the GTKmm for controlled Daemon ?

Thanks again for your work.


GTKmm ?

Posted by lwolf at 2008-11-26 04: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


Posted by Marc at 2008-11-26 17: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.


don't know

Posted by lwolf at 2008-11-26 19: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).


Posted by Marc at 2008-11-27 16: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?



poor english ?

Posted by Pierre-Yves Landuré at 2008-11-27 16: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).


Posted by Marc at 2008-11-27 17:17
hello Pierre-Yves Landure'

Thanks for reply.

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

Marc 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 :


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: