4
Feb/08
82

rtorrent with wtorrent on debian etch complete HOWTO

This howto will show you how to install rtorrent with wtorrent web interface on debian etch, with samba allowing us to grab the downloaded files from windoze boxes. It is intended as a complete guide from nothing to downloading torrents, so it’s ideal for that old box that you have sitting in the corner. If you want to use the box for multiple things then you should only use this for reference. We will be using the debian netinst CD, available from the debian mirrors. As this covers pretty much everything, including installing deb, you might want to jump to he meat of the configuration. This run through should also work with ubuntu, but I haven’t tried it.

Boot from the debian disk. I am using debian-40r1-i386-netinst.iso, as we don’t need all the junk that comes on the main debian disk.

Select your language

and your country

and then your keyboard layout

Let the network configure itself via DHCP

*NOTE* if this fails, then you must get it working before continuing, as the rest of the tutorial requires network access.

Choose a hostname

and a domain name

Configure your disks. I chose Guided – use entire disk, but you may want to do something else. If you don’t know what you are doing, I suggest using guided – use entire disk

*NOTE* this will hose your hard disk, so make sure that there is nothing you need on this machine before you do it.

Choose a root password

add a user I suggest adding the user rt. you dont have to, but it’ll make things easier later on if you use the same user as me:

Setup your apt mirror, choose one near your location.

Decide if youwant to take part in popularity contest.

Choose no software

install grub

All done, Boot into your new system!

Log in with the username root and the password that you picked earlier

OK, that’s part one done. Now the configuration.

First we are going to is update & setup ssh access to the box.

apt-get update

apt-get upgrade -y

if your kernel updates, you might get a screen like this:

if you do, say ok & after it finishes reboot with the command

reboot

and log in as root again before continuing.

Now install ssh

apt-get install ssh -y

and make the server start at boot every time

update-rc.d ssh defaults

now start the ssh server

/etc/init.d/ssh start

Now you should be able to connect to the server from a windows machine using putty or a linux machine using ssh

Windows:

putty [IP ADDRESS]

linux:

ssh [IP ADDRESS]

to find out what your IP is, type

ifconfig

mine is 192.168.10.22 in this screenshot.

Log in as root again via ssh:

Now you should be able to cut and paste stuff to the server, that makes this all alot easier.

We need to install some software now, paste these line into the new terminal window

apt-get install apache-common apache2-utils autoconf automake \

autotools-dev binutils build-essential bzip2 ca-certificates comerr-dev \

cpp cpp-4.1 dpkg-dev file g++ g++-4.1 gawk gcc gcc-4.1 libapache-mod-php5 \

libapr1 libaprutil1 libc6-dev libcurl3 libcurl3-openssl-dev libexpat1 \

libidn11 libidn11-dev libkadm55 libkrb5-dev libmagic1 libncurses5-dev \

libneon26 libpcre3 libpq4 libsigc++-2.0-dev libsqlite0 libsqlite3-0 \

libssl-dev libssp0 libstdc++6-4.1-dev libsvn1 libtool libxml2 lighttpd \

linux-kernel-headers lynx m4 make mime-support ntp ntpdate openssl patch \

perl perl-modules php5 php5-cgi php5-common php5-sqlite pkg-config screen \

sqlite subversion ucf zlib1g-dev

First lets get ntp sorted. Update: i’ve had some reports of this failing. Don’t worry if this fails on you, it just sets the time on your computer from the internet. I’ll look into why it doesn’t work for some of you when I have some time.

/etc/init.d/ntp stop

ntpdate pool.ntp.org

/etc/init.d/ntp start

Now we install xmlrpc-c

cd

svn co https://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/advanced xmlrpc-c

cd xmlrpc-c/

./configure --disable-cplusplus

make

make install

and now rtorrent

update: there seems to be an error with the 1040 version of rtorrent, so checkout the 1038 revision instead. To do this add the -r flag to the “svn up” command below so it becomes “svn up -r 1038″ (thanks gyczib)

cd

mkdir rtorrent-svn

cd rtorrent-svn

svn co svn://rakshasa.no/libtorrent/trunk

svn up

cd trunk

cd libtorrent

./autogen.sh

./configure

make

make install

cd ../rtorrent

./autogen.sh

./configure --with-xmlrpc-c

make

make install

Next install wtorrent

cd /var/www

rm -f index.html

svn co svn://canbruixa.homelinux.net/repos/trunk/wtorrent/

cd wtorrent

mv * ..

mv .* ..

cd ..

rmdir wtorrent

touch ./db/database.db

chown -R www-data:www-data db torrents tpl_c

OK, now we need to configure everything. We are going to download torrents into the /home/rt/torrents folder, and setup a watch folder in there too. Don’t worry to much about this yet, I’ll explain all later. the wget command grabs a preconfigured config file for rtorrent for you. You will need to edit it and change the ports that it uses, or simply forward the ports on your router to the server, see http://www.portforward.com to see how. The port range you need to forward is 63963 – 63982

cd /home/rt

mkdir ./torrents

mkdir ./torrents/watch

mkdir ./torrents/doing

mkdir ./torrents/done

mkdir ./.rtsession

enable sqlite in your php config:

echo "extension=sqlite.so" >> /etc/php5/cgi/php.ini

and enable the auth plugin for lighttpd

ln -s /etc/lighttpd/conf-available/10-auth.conf /etc/lighttpd/conf-enabled/10-auth.conf

Now download some config files from my server. Feel free to check through them before you use them, but they’ll get you up and running with the minimum of fuss.

cd

wget http://flipsidereality.com/blog/wp-content/uploads/rtorrent_imgs/rtorrent-howto.tar.bz2

tar xvfj rtorrent-howto.tar.bz2

cd rtorrent-howto-files

mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.dist

cp lighttpd.conf /etc/lighttpd

cp htdigest /etc/lighttpd

cp .rtorrent.rc /home/rt/

cp rtorrent /etc/init.d

chmod a+x /etc/init.d/rtorrent

update-rc.d rtorrent defaults 25

cp home.conf.php /var/www/conf/

It’s worth noting here that the supplied .rtorrent.rc may not be quite what you are after. It has infinite seeding turned on, and it doesn’t throttle your torrent traffic in any way. It is possible to do some pretty funky things with this file (you can shedule torrents to only run overnight for example). see http://libtorrent.rakshasa.no/attachment/ticket/682/rtorrent.rc for a different sample file with more options, or check the rtorrent man page, accessed by typing ‘man rtorrent’ from the terminal.

There are two commented lines in the supplied .rtorrent.rc file. If you remove the comment tags (delete the #’s from the beginning of the line) it’ll limit your upload speed to 50k (the top #) and automatically stop seeding files after 120% ration has been reached (bottom #). you can edit the file with nano, using the command ‘nano /home/rt/.rtorrent.rc’

Now add the rt user to the tty group and set permissions on ty’s home folder

usermod -aG tty rt

chown rt:rt /home/rt -R

chmod 777 /home/rt/torrents -R

Now restart lighttpd & start rtorrent,

/etc/init.d/lighttpd restart

/etc/init.d/rtorrent start

Now point your browser at the server’s ip; http://[IP HERE]/install.php and enter a username and password to use when accessing wtorrent, then click create. It’ll tell you it’s created the user.

Now point your browser at the root http://[IP HERE] and log in with the username and password that you just created

That’s it! you’ve done it.

Now we’ll set up samba so you can get at those torrents from a windows machine. You’ll also be able to start torrents automatically by dropping them into a watch folder.

Log in as root, and install samba:

apt-get install samba -y

enter anything for your workgroup name, we’re going to change it later anyway.

Next let’s add the tf user to samba.

smbpasswd rt

and create some shares:

cd /etc/samba

mv smb.conf smb.conf.dist

echo "[global]" >> smb.conf

echo "server string = RTORRENT" >> smb.conf

echo "workgroup=workgroup" >> smb.conf

echo "security=share" >> smb.conf

echo "[done]" >> smb.conf

echo "path = /home/rt/torrents/done" >> smb.conf

echo "read only = No" >> smb.conf

echo "guest ok = Yes" >> smb.conf

echo "[watch]" >> smb.conf

echo "path = /home/rt/torrents/watch" >> smb.conf

echo "read only = No" >> smb.conf

echo "guest ok = Yes" >> smb.conf

update-rc.d samba defaults

/etc/init.d/samba restart

Now if you browse to your server’s IP you can add torrents directly to the watch folder & they’ll turn up in the done folder when they are complete. rtorrent will also create shortcuts (symbolic liks) in the watch folder to let you know how they are getting on.

If you use firefox, I’d strongly reccomend using the FavLoc plugin. It allows you to right click on a .torrent and download it directly to your watch folder.

don’t forget to forward those ports, and read the comments at the bottom of this.

Appendix. – some extra geeky stuff.

This method relies on using the program screen to run the rtorrent program as a different user in the background. Unfortunately because we call screen as root through sudo (via the init.d script) in order to actually connect to the screen session you have to do some fiddling.

The vtty that is created when you run the init.d script has the wrong permissions, so you have to correct that. I use this script to access the rt program:


#!/bin/bash

chmod a+rw /dev/pts/`ls /dev/pts -l |grep "root tty" |grep -o [0-9]$`

su -c "screen -dr rtorrent" rt

Just create a file /sbin/rt with the above couple of lines in it and run

chmod a+x /sbin/rt

then simply type rt to access the rtorrent console. To disconnect, you must disconnect from the screen session by issuing CTRL+a ,then d. If you just quit then you’ll stop rtorrent from running. There is no real documentation on the commands for rtorrent, the best stuff is in the man file, which can be accessed by typing

man rtorrent

Files in the dowwnload

If you are just browsing and want to see the settings in the tar file, here they are:

.rtorrent.rc


scgi_port = localhost:5000

min_peers = 40

max_peers = 100

min_peers_seed = 10

max_peers_seed = 50

max_uploads = 15

#upload_rate = 50

directory = /home/rt/torrents/doing

session = /home/rt/.rtsession

schedule = watch_directory,5,5,load_start=/home/rt/torrents/watch/*.torrent

schedule = tied_directory,5,5,start_tied=

schedule = untied_directory,5,5,close_untied=

on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,/home/rt/torrents/done/ ;d.set_directory=/home/rt/torrents/done/"

on_start    = link1,"create_link=tied,,.started"

on_stop     = link1,"delete_link=tied,,.started"

on_finished = link1,"create_link=tied,,.finished"

on_erase    = link1,"delete_link=tied,,.finished"

schedule = low_diskspace,5,60,close_low_diskspace=100M

#schedule = ratio,60,60,"stop_on_ratio=120,200M,2000"

port_range = 63963-63981

port_random = no

check_hash = yes

use_udp_trackers = yes

encryption = allow_incoming,try_outgoing,enable_retry

dht = auto

dht_port = 63982

home.conf.php


< ?php

/*

This file is part of wTorrent.

wTorrent is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation; either version 3 of the License, or

(at your option) any later version.

wTorrent is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program.  If not, see .

Modified version of class done by David Marco Martinez

*/

// Base URL of application (where index.php is) 

define( 'URL', 'http://rt/' );

define( 'BASE', 'http://rt/' );

// SQLite database file (set folder permision 0777 or chmod to httpd server) (wTorrent will create database when running install.php)

define( 'DB_FILE', 'db/database.db');

// Host or IP to connect to rTorrent

define( 'RT_HOST',			 'localhost');

define( 'RT_PORT',			  80);

define( 'RT_DIR',				'RPC2/');

define( 'RT_AUTH',                               true);

define( 'RT_USER',                               'rt');

define( 'RT_PASSWD',                               'rt');

// where to use multicall or not

// if wTorrent makes your rtorrent crash, set this to true

define( 'NO_MULTICALL',			true);

// Directory in which to save uploaded .torrent files (set folder permision 0777 or chmod to httpd server)

define( 'DIR_TORRENTS', 	'torrents/');

// Full path to application directory (where index.php is)

define( 'DIR_EXEC',		'/var/www/');

// Permision to set for uploaded .torrent files (don't touch unless you know)

define( 'PERM_TORRENTS',	0777);

// Default location to save downloaded files (can be set for every uploaded .torrent on the ui) 

define( 'DIR_DOWNLOAD',	'/home/rt/doing');

// Don't touch any of the data below unless you know what you are doing

define( 'DIR_LANG',		'home/lang/' );

define( 'DIR_TPL',		'home/tpl/' );

define( 'DIR_TPL_COMPILE',	'tpl_c/' );

define( 'DIR_TPL_HTML',		'home/html/' );

define( 'DIR_BACKUP',		'backup/' );

define( 'DIR_UPLOAD', 		'torrents/');

define( 'TITLE',			'wTorrent' );

define( 'META_TITLE',		'rTorrent web interface' );

define( 'META_KEYWORDS',		'rtorrent xmlrpc interface php web html' );

define( 'META_DESCRIPTION',	'rtorrent web inrface using xmlrpc' );

define( 'DIR_CSS_DETALLS',		'home/css/detalls.css' );

define( 'DIR_CSS_ESTIL',		'home/css/estil.css' );

define( 'DIR_JS',		    'home/js/javasc.js' );

define( 'DIR_JSHADE',		    'home/js/shadedborder.js' );

define( 'DIR_JSPROTO',		    'home/js/prototype.js' );

define( 'DIR_SCRIPTACULOUS','home/js/scriptaculous/scriptaculous.js');

define( 'DIR_FAVICO',		'favicon.ico' );

//define( 'USER_RTORRENT',	'rtorrent');

define( 'DIR_IMG',		'home/img/' );

define( 'SRC_INDEX',		'index.php' );

define( 'SCRAMBLE',		false);

define( 'APP', 'wTorrent' );

// Librerias generales

require_once( 'lib/inc/includes.inc.php' );

// Autodeclaracion de clases

autoload( 'lib/cls/', 'cls/', 'home/cls/' );

// Definicion de rutas para UNIX

ini_set( 'include_path', DIR_EXEC );

?>

htdigest


rt:XML-RPC:d9eabf0352c8ffe3d0c42e253b9168f3

lighttpd.conf


# Debian lighttpd configuration file

# 

############ Options you really have to take care of ####################

## modules to load

# mod_access, mod_accesslog and mod_alias are loaded by default

# all other module should only be loaded if neccesary

# - saves some time

# - saves memory

server.modules              = ( 

            "mod_access",

            "mod_alias",

            "mod_accesslog",

			"mod_scgi",

			"mod_fastcgi",

#           "mod_rewrite", 

#           "mod_redirect", 

#           "mod_status", 

#           "mod_evhost",

#           "mod_compress",

#           "mod_usertrack",

#           "mod_rrdtool",

#           "mod_webdav",

#           "mod_expire",

#           "mod_flv_streaming",

#           "mod_evasive"

 )

## a static document-root, for virtual-hosting take look at the 

## server.virtual-* options

server.document-root       = "/var/www/"

## where to send error-messages to

server.errorlog            = "/var/log/lighttpd/error.log"

## files to check for if .../ is requested

index-file.names           = ( "index.php", "index.html", 

                               "index.htm", "default.htm" )

## Use the "Content-Type" extended attribute to obtain mime type if possible

# mimetype.use-xattr = "enable"

#### accesslog module

accesslog.filename         = "/var/log/lighttpd/access.log"

## deny access the file-extensions

#

# ~    is for backupfiles from vi, emacs, joe, ...

# .inc is often used for code includes which should in general not be part

#      of the document-root

url.access-deny            = ( "~", ".inc" )

######### Options that are good to be but not neccesary to be changed #######

## bind to port (default: 80)

# server.port               = 81

## bind to localhost only (default: all interfaces)

## server.bind                = "localhost"

## error-handler for status 404

#server.error-handler-404  = "/error-handler.html"

#server.error-handler-404  = "/error-handler.php"

## to help the rc.scripts

server.pid-file            = "/var/run/lighttpd.pid"

## 

## Format: .html

## -> ..../status-404.html for 'File not found'

#server.errorfile-prefix    = "/var/www/"

## virtual directory listings

dir-listing.encoding        = "utf-8"

server.dir-listing          = "enable"

## send unhandled HTTP-header headers to error-log

#debug.dump-unknown-headers  = "enable"

### only root can use these options

#

# chroot() to directory (default: no chroot() )

#server.chroot            = "/"

## change uid to  (default: don't care)

server.username            = "www-data"

## change uid to  (default: don't care)

server.groupname           = "www-data"

#### compress module

#compress.cache-dir          = "/var/tmp/lighttpd/cache/compress/"

#compress.filetype           = ("text/plain", "text/html")

#### status module

# status.status-url = "/server-status"

# status.config-url = "/server-config"

#### url handling modules (rewrite, redirect, access)

# url.rewrite                 = ( "^/$"             => "/server-status" )

# url.redirect                = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )

#

# define a pattern for the host url finding

# %% => % sign

# %0 => domain name + tld

# %1 => tld

# %2 => domain name without tld

# %3 => subdomain 1 name

# %4 => subdomain 2 name

#

# evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"

#### expire module

# expire.url                  = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")

#### rrdtool

# rrdtool.binary = "/usr/bin/rrdtool"

# rrdtool.db-name = "/var/www/lighttpd.rrd"

#### handle Debian Policy Manual, Section 11.5. urls

#### and by default allow them only from localhost

$HTTP["remoteip"] =~ "127.0.0.1" {

	alias.url += ( 

		"/doc/" => "/usr/share/doc/",

		"/images/" => "/usr/share/images/"

	)

	$HTTP["url"] =~ "^/doc/|^/images/" {

		dir-listing.activate = "enable"

	}

}

#### variable usage:

## variable name without "." is auto prefixed by "var." and becomes "var.bar"

#bar = 1

#var.mystring = "foo"

## integer add

#bar += 1

## string concat, with integer cast as string, result: "www.foo1.com"

#server.name = "www." + mystring + var.bar + ".com"

## array merge

#index-file.names = (foo + ".php") + index-file.names

#index-file.names += (foo + ".php")

#### external configuration files

## mimetype mapping

include_shell "/usr/share/lighttpd/create-mime.assign.pl"

## load enabled configuration files, 

## read /etc/lighttpd/conf-available/README first

include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

scgi.server = (

 "/RPC2" => # RT_DIR

  ( "127.0.0.1" =>

   (

    "host" => "127.0.0.1", # Ip where rtorrent is listening

    "port" => 5000, # Port specified in .rtorrent.rc

    "check-local" => "disable"

   )

  )

 )

 fastcgi.server = ( ".php" => (( 

                     "bin-path" => "/usr/bin/php-cgi",

                     "socket" => "/tmp/php.socket"

                 )))

auth.backend = "htdigest"

auth.backend.htdigest.userfile = "/etc/lighttpd/htdigest"

auth.require = ( "/RPC2" =>

 (

  "method" => "basic",

  "realm" => "XML-RPC",

  "require" => "valid-user"

 ),

 "/torrents" =>

 (

  "method" => "basic",

  "realm" => "XML-RPC",

  "require" => "valid-user"

 ),

 "/db" =>

 (

  "method" => "basic",

  "realm" => "XML-RPC",

  "require" => "valid-user"

 )

)

rtorrent (init.d script)


#!/bin/bash

### BEGIN INIT INFO

# Provides:       rtorrent

# Required-Start:  $network 

# Required-Stop:   $network 

# Default-Start:   2 3 4 5

# Default-Stop:    0 1 6

# Short-Description: Start rtorrent as a daemon

### END INIT INFO

#!/bin/sh

#############

######

#############

# This script depends on screen.

# For the stop function to work, you must set an

# explicit session directory using ABSOLUTE paths (no, ~ is not absolute) in your rtorrent.rc.

# If you typically just start rtorrent with just "rtorrent" on the

# command line, all you need to change is the "user" option.

# Attach to the screen session as your user with 

# "screen -dr rtorrent". Change "rtorrent" with srnname option.

# Licensed under the GPLv2 by lostnihilist: lostnihilist _at_ gmail _dot_ com

##############

######

##############

#######################

##Start Configuration##

#######################

# You can specify your configuration in a different file 

# (so that it is saved with upgrades, saved in your home directory,

# or whateve reason you want to)

# by commenting out/deleting the configuration lines and placing them

# in a text file (say /home/user/.rtorrent.init.conf) exactly as you would

# have written them here (you can leave the comments if you desire

# and then uncommenting the following line correcting the path/filename 

# for the one you used. note the space after the ".".

# . /etc/rtorrent.init.conf

#Do not put a space on either side of the equal signs e.g.

# user = user 

# will not work

# system user to run as

user="rt"

# the system group to run as, not implemented, see d_start for beginning implementation

# group=`id -ng "$user"`

# the full path to the filename where you store your rtorrent configuration

config="/home/${user}/.rtorrent.rc"

# set of options to run with

options=""

# default directory for screen, needs to be an absolute path

#base="/home/${user}"

base="/home/rt"

# name of screen session

srnname="rtorrent"

# file to log to (makes for easier debugging if something goes wrong)

logfile="/var/log/rtorrentInit.log"

#######################

###END CONFIGURATION###

#######################

PATH=/usr/bin:/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin

DESC="rtorrent"

NAME=rtorrent

DAEMON=$NAME

SCRIPTNAME=/etc/init.d/$NAME

checkcnfg() {

	exists=0

	for i in `echo "$PATH" | tr ':' '\n'` ; do

		if [ -f $i/$NAME ] ; then

			exists=1

			break

		fi

	done

	if [ $exists -eq 0 ] ; then

		echo "cannot find rtorrent binary in PATH $PATH" | tee -a "$logfile" >&2

		exit 3

	fi

	if ! [ -r "${config}" ] ; then 

		echo "cannot find readable config ${config}. check that it is there and permissions are appropriate" | tee -a "$logfile" >&2

		exit 3 

	fi 

	session=`getsession "$config"` 

	if ! [ -d "${session}" ] ; then

		echo "cannot find readable session directory ${session} from config ${config}. check permissions" | tee -a "$logfile" >&2

		exit 3

	fi

}

d_start() {

  [ -d "${base}" ] && cd "${base}"

  stty stop undef && stty start undef

  su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "screen -dm -S ${srnname} 2>&1 1>/dev/null" ${user} | tee -a "$logfile" >&2

  # this works for the screen command, but starting rtorrent below adopts screen session gid

  # even if it is not the screen session we started (e.g. running under an undesirable gid

  #su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "sg \"$group\" -c \"screen -fn -dm -S ${srnname} 2>&1 1>/dev/null\"" ${user} | tee -a "$logfile" >&2

  su -c "screen -S "${srnname}" -X screen rtorrent ${options} 2>&1 1>/dev/null" ${user} | tee -a "$logfile" >&2

}

d_stop() {

	session=`getsession "$config"`

	if ! [ -s ${session}/rtorrent.lock ] ; then

		return

	fi

	pid=`cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"`

	if ps -A | grep -sq ${pid}.*rtorrent ; then # make sure the pid doesn't belong to another process

		kill -s INT ${pid}

	fi

}

getsession() { 

	session=`awk '/^[[:space:]]*session[[:space:]]*=[[:space:]]*/{print($3)}' "$config"`

	echo $session

}

checkcnfg

case "$1" in

  start)

	echo -n "Starting $DESC: $NAME"

	d_start

	echo "."

	;;

  stop)

	echo -n "Stopping $DESC: $NAME"

	d_stop

	echo "."

	;;

  restart|force-reload)

	echo -n "Restarting $DESC: $NAME"

	d_stop

	sleep 1

	d_start

	echo "."

	;;

  *)

	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2

	exit 1

	;;

esac

exit 0
Comments (80) Trackbacks (2)
  1. ChamPro
    7:46 pm on February 4th, 2008

    Wow. This exactly what I’ve been trying to do with Ubuntu Gutsy Gibbon server. Thanks for the help. I’ve been stuck on actually getting wTorrent to work and I’m sure it has something to do with SQLite.

    Question though. Do you think there’s an advantage to using Debian Etch over Ubuntu Gutsy (other than Etch being newer).

    [Reply]

  2. C01eMaN^
    6:08 pm on February 10th, 2008

    good tutorial now ive got somewhere to point my dum ass friends when they ask stupid questions about my lovely setup lmao

    [Reply]

  3. Jason
    2:41 pm on February 12th, 2008

    Fantastic!

    Had to make one change to the install.php script, it kept saying that it tried to insert 4 fields into the tor_password table, but the table has 6 fields. I added ,0,0 to the end of the insert statement and all was well.

    Nice work.

    [Reply]

  4. wole
    3:46 pm on February 17th, 2008

    ChamPro:
    I have always used debian, so that’s where my tendencies lie. I am a sysadmin & i find that it’s better for servers. Ubuntu is what i recommend for desktop installations tho. They are essentially the same, it’s just that i have found etch to be more stable, and the netinst disk is nice and small to download.

    Jason:
    Updated the article to reflect your addition, and emailed Roger (wTorrent guy)

    [Reply]

  5. wole
    4:47 pm on February 17th, 2008

    Jason:
    The issue has been resolved with svn version 38.

    [Reply]

  6. max
    3:50 pm on February 20th, 2008

    Hi system debian install is done but in wtorrent im have mesage
    Error: could not connect to rtorrent in system
    ps -ax |grep rtorrent
    im see this
    2008 ? Ss 0:00 SCREEN -dm -S rtorrent

    wher is the problem any log ?

    [Reply]

  7. wole
    5:53 pm on February 20th, 2008

    Max:
    What is the output of the command:
    # netstat -np -l

    [Reply]

  8. max
    11:51 am on February 21st, 2008

    im see this

    max:~# netstat -np -l
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2087/lighttpd
    tcp6 0 0 :::22 :::* LISTEN 1958/sshd
    udp 0 0 0.0.0.0:68 0.0.0.0:* 1909/dhclient3
    udp 0 0 10.11.26.101:123 0.0.0.0:* 1979/ntpd
    udp 0 0 127.0.0.1:123 0.0.0.0:* 1979/ntpd
    udp 0 0 0.0.0.0:123 0.0.0.0:* 1979/ntpd
    udp6 0 0 fe80::203:ffff:fe99:123 :::* 1979/ntpd
    udp6 0 0 ::1:123 :::* 1979/ntpd
    udp6 0 0 :::123 :::* 1979/ntpd
    Active UNIX domain sockets (only servers)
    Proto RefCnt Flags Type State I-Node PID/Program name Path
    unix 2 [ ACC ] STREAM LISTENING 5219 2088/php-cgi /tmp/php.socket-0
    unix 2 [ ACC ] STREAM LISTENING 5224 2093/php-cgi /tmp/php.socket-1
    unix 2 [ ACC ] STREAM LISTENING 5227 2094/php-cgi /tmp/php.socket-2
    unix 2 [ ACC ] STREAM LISTENING 5232 2097/php-cgi /tmp/php.socket-3
    unix 2 [ ACC ] STREAM LISTENING 4646 1895/acpid /var/run/acpid.socket

    [Reply]

  9. wole
    8:05 pm on February 21st, 2008

    Max:
    OK, for some reason yoru rtorrent isn’t listening for XMLRPCs you should have a line like this:

    tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 14280/rtorrent

    and the command

    #cat /home/rt/.rtorrent.rc |grep 5000

    should give you the following:

    scgi_port = localhost:5000

    make sure that rtorrent is reading your .rtottrnt.rc file, and that it has “scgi_port = localhost:5000″ in it.

    Also see my addendum for some more info about screen and the way this setup (should) work.

    [Reply]

  10. ward
    2:50 am on March 1st, 2008

    wtorrent isn’t able to communicate with rtorrent as well. I tryed a reinstall of libtorrent and rtorrent and when I #make this is what it ends with.

    xmlrpc.cc: In function ‘rpc::target_type rpc::xmlrpc_to_target(xmlrpc_env*, xmlrpc_value*)’:
    xmlrpc.cc:213: error: jump to case label
    xmlrpc.cc:156: error: crosses initialization of ‘core::Download* download’
    xmlrpc.cc: In function ‘torrent::Object rpc::xmlrpc_to_object(xmlrpc_env*, xmlrpc_value*, int, rpc::target_type*)’:
    xmlrpc.cc:284: warning: dereferencing type-punned pointer will break strict-aliasing rules
    make[2]: *** [xmlrpc.o] Error 1
    make[2]: Leaving directory `/root/rtorrent-svn/trunk/rtorrent/src/rpc’
    make[1]: *** [install-recursive] Error 1
    make[1]: Leaving directory `/root/rtorrent-svn/trunk/rtorrent/src’
    make: *** [install-recursive] Error 1

    Any ideas? I’ve followed the whole tutorial to the T.

    Thanks

    [Reply]

  11. wole
    2:02 pm on March 1st, 2008

    @Ward:
    I used revision 1038 (2008-02-03 14:30:58) when I wrote this. Try using that revision. I have uploaded a copy for you:
    http://www.flipsidereality.com/blog/wp-content/uploads/rtorrent_imgs/rtorrent_r1038.tar.bz2

    Let me know if that works!

    W.

    [Reply]

  12. ong
    3:09 pm on March 1st, 2008

    Please modify your provided /etc/lighttpd/lighttpd.conf to also protect the torrents/ and db/ dirs:

    auth.require = ( “/RPC2″ =>
    (
    “method” => “basic”,
    “realm” => “XML-RPC”,
    “require” => “valid-user”
    ),
    “/torrents” =>
    (
    “method” => “basic”,
    “realm” => “XML-RPC”,
    “require” => “valid-user”
    ),
    “/db” =>
    (
    “method” => “basic”,
    “realm” => “XML-RPC”,
    “require” => “valid-user”
    )
    )

    And maybe add a note that your default .rtorrent.rc stops at ratio 1.2 and limits the speed to 50/50. Or just comment out the lines. Newbies tend to copy and paste :)

    [Reply]

  13. wole
    3:37 pm on March 1st, 2008

    @ong:
    I have updated the lighttpd.conf file. thanks for the info.
    The .rtorrent.rc file has the max_upload rate set to 50KB, and unlimited download. Here is a copy of the file, what would you change?:

    scgi_port = localhost:5000
    min_peers = 40
    max_peers = 100
    min_peers_seed = 10
    max_peers_seed = 50
    max_uploads = 15
    upload_rate = 50
    directory = /home/rt/torrents/doing
    session = /home/rt/.rtsession
    schedule = watch_directory,5,5,load_start=/home/rt/torrents/watch/*.torrent
    schedule = tied_directory,5,5,start_tied=
    schedule = untied_directory,5,5,close_untied=
    on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,/home/rt/torrents/done/ ;d.set_directory=/home/rt/torrents/done/"
    on_start    = link1,"create_link=tied,,.started"
    on_stop     = link1,"delete_link=tied,,.started"
    on_finished = link1,"create_link=tied,,.finished"
    on_erase    = link1,"delete_link=tied,,.finished"
    schedule = low_diskspace,5,60,close_low_diskspace=100M
    schedule = ratio,60,60,"stop_on_ratio=120,200M,2000"
    port_range = 63963-63981
    port_random = no
    check_hash = yes
    use_udp_trackers = yes
    encryption = allow_incoming,try_outgoing,enable_retry
    dht = auto
    dht_port = 63982
    

    [Reply]

  14. gyczib
    4:19 pm on March 1st, 2008

    Thanks for this superb HOWTO!

    What i found:
    -As Ward write The 1040 revision couldn’t compile with rc, but the 1038 does. So this works:
    $cd trunk
    $svn up -r 1038
    $cd libtorrent

    - HTML bug??: In this howto in code you write > instead of > (samba section)
    - In downloadable rtorrent-howto.tar.bz2 file at the end of lighttpd file there is ‘>’ instead of ‘>’

    [Reply]

  15. wole
    4:22 pm on March 1st, 2008

    @gyczib:
    er, use pre tags!
    i guess you mean

     > instead of =>

    edit:
    Oh, i see, it had

    &gt instead of >

    updated!

    [Reply]

  16. ward
    7:26 pm on March 1st, 2008

    I used your 1038 rtorrent compiled perfect ran into a bit a trouble with the lighttpd.conf though. Maybe it’s a problem between my american english keyboard and your english keyboard (are there even differences?) but where it reads

    “method” => “basic”
    it instead reads
    “method” =>; “basic”

    Just went through and deleted all the semi colons and lighttpd started up and now wtorrent is running smoothly. Great tutorial! Thanks!

    [Reply]

  17. wole
    7:40 pm on March 1st, 2008

    @ward
    Yeah, there were a couple of errors. they should have been

     => 

    instead of

     =>;

    I have fixed it. Thanks.

    [Reply]

  18. Rob
    2:22 am on March 2nd, 2008

    First let me say thank you for this how to I have found it very helpfull, however I am still having some problems.
    I have tried to adapt as much of this post as I could to make it work on Slax6. and as of right now the only that seems to be lacking is a connection between rtorrent and wtorrent i.e. “Error: could not connect to rtorrent”
    If rtorrent is started form /etc/rc.d/rc.rtorrentd I get no errors but netstat -np -l shows nothing listing on 5000, if I copy my rtorrent.conf to ~/.rtorrent.rc and start rtorrent from the cli netstat -np -l shows rtorrent listing on 5000 but wtorrent is still unable to connect. Do any of you all have an idea why a. wtorrent can’t connect or b. why rtorrent won’t open up a port when started from rc.rtorrentd? (note rc.rtorrentd is reading rtorrent.conf if I move the file to some where els it will kick back file not found) thanks for you help

    [Reply]

  19. ong
    11:55 am on March 2nd, 2008

    htdigest -c /etc/lighttpd/htdigest XML-RPC rt
    That creates a new htdigest file, much safer when you choose the password on your own, instead of using the one which is provided here. Don’t forget to edit /var/www/conf/home.conf.php:’RT_PASSWD’

    Regarding the .rtorrent.rc I’d comment out the ratio schedule and upload_rate

    [Reply]

  20. ong
    10:52 pm on March 2nd, 2008

    For all of you who can’t see the details in wtorrent: check /var/www/conf/sample.home.conf.php for new variables (look for ‘DIR_SCRIPTACULOUS’) and write them into /var/www/conf/home.conf.php. That most likely fixes http://canbruixa.homelinux.net/trac/ticket/41. Best way probably is to not include configuration files in the tar, but show the needed variables here in this howto.

    [Reply]

  21. wole
    11:14 pm on March 2nd, 2008

    @ong:
    Lines in rtorrent.rc commented, and sample.conf updated in tar file to include link to scriptaculous
    info about editing the rc file added to the tutorial.

    I have tried to keep the tutorial ‘command line only’ i.e. no nano or vi needed, as this has confused some newbies in the past.

    [Reply]

  22. Rosjha
    2:12 pm on March 26th, 2008

    Just a quick remark. Actually loading mod_auth in lighthttp.conf might increase the security to a level where it actually works :-)

    [Reply]

  23. Rosjha
    2:19 pm on March 26th, 2008

    Another remark. It is safer to use unix sockets instead of a tcpip port. My lighttpd conf files uses :
    scgi.server = (
    “/RPC2″ => #RT_DIR
    (”127.0.0.1″ =>
    (
    “socket” => “/tmp/rpc.socket”, # Socket specified in .rtorrentrc
    “check-local” => “disable”,
    “disable-time” => 0 # don’t disable scgi if connection fails
    )))

    And my .rtorrent.rc has :

    scgi_local = /tmp/rpc.socket

    [Reply]

  24. baabo
    4:03 pm on March 27th, 2008

    Thanks for the guide, got it working.
    I just needed to chance “min_peers = 40″ to “min_peers = 1″ to get torrentsrunning.
    What lines do i need to add to get downloads only run on night?

    [Reply]

  25. wole
    4:37 pm on March 27th, 2008

    @Rosjha:
    Thanks for the input, I’ll modify the files this weekend.

    @baabo:

    run the command “man rtorrent” for more info on the .rtorrent.rc file, or see the rtorrent wiki http://libtorrent.rakshasa.no/ but basically

    schedule = throttle_1,01:00:00,24:00:00,download_rate=0
    schedule = throttle_2,05:00:00,24:00:00,download_rate=25

    Every day “throttle_1″ gets triggered at 01:00 and sets the download rate to unlimited, while “throttle_2″ sets it to 25kb at 05:00. Using this the client may be made to perform a somewhat crude form of bandwidth scheduling.

    [Reply]

  26. Roberto
    9:35 pm on April 14th, 2008

    Thanks for your HOWTO! Just what I was looking for…

    It’s great, but I have the same problem as Max(”Error: could not connect to rtorrent”).

    Here’s my netstat -np -l output:

    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:34183 0.0.0.0:* LISTEN 2784/rpc.statd
    tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 27091/rtorrent
    tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 2662/mysqld
    tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN 2600/memcached
    tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2203/portmap
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 24757/lighttpd
    tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN 2732/inetd
    tcp 0 0 0.0.0.0:63963 0.0.0.0:* LISTEN 27091/rtorrent
    tcp6 0 0 :::22 :::* LISTEN 2742/sshd
    udp 0 0 0.0.0.0:32768 0.0.0.0:* 2784/rpc.statd
    udp 0 0 0.0.0.0:840 0.0.0.0:* 2784/rpc.statd
    udp 0 0 0.0.0.0:111 0.0.0.0:* 2203/portmap
    udp 0 0 192.168.1.10:123 0.0.0.0:* 2804/ntpd
    udp 0 0 127.0.0.1:123 0.0.0.0:* 2804/ntpd
    udp 0 0 0.0.0.0:123 0.0.0.0:* 2804/ntpd
    udp6 0 0 fe80::280:5aff:fe28:123 :::* 2804/ntpd
    udp6 0 0 ::1:123 :::* 2804/ntpd
    udp6 0 0 :::123 :::* 2804/ntpd
    Active UNIX domain sockets (only servers)
    Proto RefCnt Flags Type State I-Node PID/Program name Path
    unix 2 [ ACC ] STREAM LISTENING 8997 24820/php-cgi /tmp/php.socket-2
    unix 2 [ ACC ] STREAM LISTENING 8946 3137/php-cgi /tmp/php.socket-2
    unix 2 [ ACC ] STREAM LISTENING 8949 3138/php-cgi /tmp/php.socket-3
    unix 2 [ ACC ] STREAM LISTENING 9001 24836/php-cgi /tmp/php.socket-3
    unix 2 [ ACC ] STREAM LISTENING 7037 2916/ssh-agent /tmp/ssh-HsQERl2881/agent.2881
    unix 2 [ ACC ] STREAM LISTENING 7123 2969/gconfd-2 /tmp/orbit-roberto/linc-b99-0-2bba8b6d9bb49
    unix 2 [ ACC ] STREAM LISTENING 6557 2772/gdm /tmp/.gdm_socket
    unix 2 [ ACC ] STREAM LISTENING 7132 2965/firefox-bin /tmp/orbit-roberto/linc-b95-0-528a0dff9f3b1
    unix 2 [ ACC ] STREAM LISTENING 6623 2781/X /tmp/.X11-unix/X0
    unix 2 [ ACC ] STREAM LISTENING 8989 24776/php-cgi /tmp/php.socket-0
    unix 2 [ ACC ] STREAM LISTENING 6387 2662/mysqld /var/run/mysqld/mysqld.sock
    unix 2 [ ACC ] STREAM LISTENING 6251 2584/acpid /var/run/acpid.socket
    unix 2 [ ACC ] STREAM LISTENING 8993 24802/php-cgi /tmp/php.socket-1

    As you can see, rtorrent is listening to both 5000 and 63963 ports. In .rtorrent.rc :

    scgi_port = localhost:5000

    Could you please help?? Thanks in advance…

    [Reply]

  27. Gabor
    5:38 pm on April 28th, 2008

    Hello!

    I have the following problem on web interface when I try to log in:

    Warning: SQLiteDatabase::query() [function.SQLiteDatabase-query]: no such table: tor_passwd in /var/www/cls/rtorrent.cls.php on line 57

    Also when lighttpd starts, writes this:

    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0

    I was doing everything so, how written.

    [Reply]

  28. Superman
    2:11 am on May 2nd, 2008

    I’m getting a similar error to Gabor above. (Well at least it has to do with “cls”)

    Here’s the text from the browser:

    Warning: require_once(home/cls/ListT.cls.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/wtorrent/lib/inc/utils.inc.php(41) : eval()’d code on line 4

    Fatal error: require_once() [function.require]: Failed opening required ‘home/cls/ListT.cls.php’ (include_path=’/var/www/’) in /var/www/wtorrent/lib/inc/utils.inc.php(41) : eval()’d code on line 4

    I’m searching around to try to fix this, but maybe someone already has a solution?

    [Reply]

  29. Superman
    2:23 am on May 2nd, 2008

    Okay, solved my problem…well partly, I had to change the following line in home.conf.php:

    from:
    // Definicion de rutas para UNIX
    ini_set( ‘include_path’, DIR_EXEC );

    to:
    // Definicion de rutas para UNIX
    ini_set( ‘include_path’, ‘/var/www/wtorrent/’ );

    because I have my install in a subdirectory.

    Now the next problem I’m getting is that it cannot connect to rtorrent…

    [Reply]

  30. Superman
    4:19 am on May 2nd, 2008

    Okay, I found the correct location to change the home.conf.php instead of changing the line I mentioned earlier.

    It looks like this in the default sample.home.conf.php:

    // Full path to application directory (where index.php is)
    define( ‘DIR_EXEC’, ‘/var/www/localhost/htdocs/wtorrent/’);

    In the provided one it is changed to:

    // Full path to application directory (where index.php is)
    define( ‘DIR_EXEC’, ‘/var/www/’);

    I just changed that define to reflect my base directory…

    [Reply]

  31. Superman
    6:52 am on May 2nd, 2008

    I finally figured it out. I have lighttpd running on port 81, so I had to change:

    define( ‘RT_PORT’, 80);

    to:

    define( ‘RT_PORT’, 81);

    in conf/home.conf.php

    Now it works!! Thanks for the great tutorial!!

    [Reply]

  32. m0e
    8:44 pm on May 7th, 2008

    hi, what settings do i need to change so that i can have wtorrent running from a different folder in lighthttp like have it running from http://www.address.com/wtorrent/ or sumin along them lines?

    thanks

    m0e

    [Reply]

  33. m0e
    12:00 am on May 8th, 2008

    right ive tried to change the director that wtorrent runs from and now ive got this error

    Warning: SQLiteDatabase::query() [function.SQLiteDatabase-query]: no such table: tor_passwd in /var/www/wtorrent/cls/rtorrent.cls.php on line 67

    any ideas?

    thanks

    [Reply]

  34. Zunkel
    6:38 pm on May 10th, 2008

    Hi, very nice tutorial, but i have the same problem like Gabor:

    When i (re)start Lighttpd, i get this failure: “PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0″

    So, wTorrent dosnt work :(

    Have anyone a solution for this problem?

    THX and greetz, Zunkel

    [Reply]

  35. baabo
    4:12 pm on May 11th, 2008

    M0e: Chance name of the index.php to wtorrent.php or whatever you want.
    And then http://www.address.com/wtorrent.php

    [Reply]

  36. Forsakened
    11:34 pm on May 19th, 2008

    Whenever i point my browser towards the install.php it just asks for me to download it =/

    Where am i going wrong? :( :( please help

    [Reply]

  37. ghd
    10:20 pm on May 31st, 2008

    I can’t get the script to work to view the rtorrent screen session. it just returns “cannot open your terminal ‘/dev/tty1′ – please check. any ideas?

    [Reply]

  38. brunosso
    2:11 pm on June 4th, 2008

    i have a problem! the web gui is without strng, there is icons button, but all button are blank and the form also blank..help me

    [Reply]

  39. ghd
    12:45 am on June 5th, 2008

    @brunosso

    the new version of wtorrent supports localization, so you have to specify a language in the home.conf.php file for the labels to show up. check out a version to another folder and check sample.home.conf.php for the syntax

    can anyone help with the detach/reattach script?

    [Reply]

  40. Kim Nilsson
    10:12 am on June 6th, 2008

    Hiya

    I managed to install it all without using your suggested config files.
    I found this guide after I had it all set up.

    The error I got, after chaging my confs a bit, was the same as Superman.
    I had simply forgotten to adjust the RT_PORT when I changed the setting for lighttpd.

    I can now load torrents just fine.
    But when trying with the gentoo live dvd I get the internal error of:

    *** rTorrent 0.8.2/0.12.2 – MyHost:12482 ***
    [View: main]
    * livedvd-i686-installer-2008.0_beta2
    * 0.0 / 4092.3 MB Rate: 0.0 / 0.0 KB Uploaded: 0.0 MB [ 0%] –d –:– [T R: 0.00]
    * Tracker: [Couldn't connect to server]

    ***

    [Throttle 200/500 KB] [Rate 0.0/ 0.0 KB] [Port: 22661] [Local "Removed.my.home.ip"] [Bind 127.0.0.1] [U 0/50] [D 0/110] [H 0/32] [S 0/2/768

    With that “couldn’t connect” I am of course no getting any packets down.

    What could be wrong?
    Important to note is that this system is behind a VERY restrictive ISA firewall.
    I have opened ports 22630-22670 for both incoming and outgoing TCP.

    *******
    ahhhh, I found the error!
    I removed the settings for IP and now it works! :-)

    [Reply]

  41. Kim Nilsson
    10:12 am on June 6th, 2008

    Oh, I forgot to say I did all this on a Gentoo system, not Debian.

    [Reply]

  42. m0e
    3:15 pm on June 7th, 2008

    hey, could someone post a small guide on about updating to the newest versions of wtorrent and rtorrent please :)

    cheers

    [Reply]

  43. bulgarion
    1:58 pm on June 24th, 2008

    …for those who have the SQLite issue, just delete your conf/home.conf.php AND db/database.db, then point your browser to http:///install2.php, and configure from THERE your stuff. Doing this, the php script will create the SQLite tables, otherwise it won’t work :P
    Hope this helps, ciao!

    [Reply]

  44. sullan
    2:26 pm on July 7th, 2008

    Hello!

    Great tut an I really want this to work… but… Tried first but wrote my own username not rt.
    No success. Started over with rt as user but it stops at the same place; “PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0″
    Tried bulgarions tip but I’m failing anyway. Can’t log in. No such… something

    [Reply]

  45. Funaro
    10:03 pm on July 8th, 2008

    Thank you so much for the guide! My only question is how much would I have to change to set-up multiple installations for several users? I.E. where do I have to branch and perform steps for each individual user account?

    [Reply]

  46. Funaro
    10:09 pm on July 8th, 2008

    To elaborate, I mean what steps would I have to take to have instances of both rTorrent and wTorrent for two users

    [Reply]

  47. Martin
    2:54 pm on July 13th, 2008

    If anyone still wants to use wtorrent with Apache:
    1. you follow all of this tutorial but installing the lighttpd package
    2. install apache2 package and mod_scgi module: aptitude install apache2 libapache2-mod-scgi
    3. put this in your /etc/apache2/httpd.conf file:
    LoadModule mod_scgi /usr/lib/apache2/modules/mod_scgi.so
    SCGIMount /RPC2 127.0.0.1:5000
    4. reload Apache daemon: /etc/init.d/apache2 reload

    [Reply]

  48. Shadowtester
    4:36 am on July 19th, 2008

    I followed your instructions for the server install with rtorrent and wtorrent I was able to get rtorrent to work fine it will upload and download fine. The problem seems to be with getting wtorrent to connect to rtorrent I was able to get wtorrent to work with lighttp but would not connect I am using the latest version of libtorrent rtorrent and wtorrent from svn as of 7/15/08 I think the problem is with scgi. I was able to create an account with wtorrent and then login however I get the error unable to connect to rtorrent.

    [Reply]

  49. glock
    5:27 pm on August 2nd, 2008

    Great tutorial. However I’m on the same boat as those with SqLite issues:

    Warning: SQLiteDatabase::query() [function.SQLiteDatabase-query]: no such table: tor_passwd in /var/www/cls/rtorrent.cls.php on line 67

    “PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0″

    I’ve done as suggested and deleted both conf/home.conf.php AND db/database.db, ran install2.php to create a new database, but same result. Please help.

    [Reply]

  50. Alneven
    1:19 am on August 6th, 2008

    I have followed the tutorial, everything went great. rtorrent / libtorrent install from svn is great.

    But I have some problems:

    - if I put my IP into the browser it takes a lot of time to connect to the login window, and if I am in the system from wtorrent I have the following error: Error: could not connect to rtorrent

    - I have all my config files from the addon, provided here, and had the wtorrent install.php and install2.php

    rtorrent is running fine:
    ( 9:30:02) Using ‘epoll’ based polling.
    ( 9:30:02) XMLRPC initialized with 444 functions.
    ( 9:30:02) The SCGI socket is bound to a specific network device yet may still pose a security risk, consider using ’scgi_local’

    here are some quotas from the lighttpd log:
    2008-08-06 09:23:56: (mod_fastcgi.c.2534) FastCGI-stderr: XML-RPC: xmlrpcmsg::parseResponse: HTTP error, got response: HTTP/1.0 401 Unauthorized
    2008-08-06 09:25:57: (server.c.1162) NOTE: a request for /RPC2/ timed out after writing 151 bytes. We waited 360 seconds. If this a problem increase server.max-write-idle
    2008-08-06 09:25:57: (mod_scgi.c.2444) emergency exit: scgi: connection-fd: 12 fcgi-fd: -1

    and I dont know why but it’s strange that I need to have a user.conf.php and home.conf.php.

    Here is the error if I want to restart the lighttpd:

    /etc/init.d/lighttpd restart
    Stopping web server: lighttpd.
    Starting web server: lighttpd.
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0

    Do you have any idea how to solve this?
    Thank you in advance,
    A

    [Reply]

  51. Alneven
    7:45 am on August 6th, 2008

    and the problem is that I get now only the login window, and after nothing happen…

    [Reply]

  52. Alneven
    7:48 am on August 6th, 2008

    If I try to use an incorrect user id, I receive an error message, but with the right one nothing happen…

    [Reply]

  53. Alneven
    7:53 am on August 6th, 2008

    And after ~ 2-3 minutes I am logged in, and there is an error message: Error: could not connect to rtorrent

    netstat -np -l
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:63963 0.0.0.0:* LISTEN 19581/rtorrent
    tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 19581/rtorrent
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 20316/lighttpd

    [Reply]

  54. Alneven
    8:12 am on August 6th, 2008

    I have fix this, apt-get install util-linux
    Now I can login, it is quick but I have a design problem:
    http://noob.hu/07/0806/screen.jpg

    [Reply]

  55. Alneven
    10:21 am on August 6th, 2008

    The design is good at firefox 2 but under IE6 it’s fucked up :D
    But I don’t want to use IE, so it’s not a problem.

    Thanks for the great tutorial

    [Reply]

  56. Ståle
    6:36 pm on August 14th, 2008

    I to have followed the tutorial from fresh install to error @ restarting the lighttpd server, i get this error message;

    Starting web server: lighttpd.
    lunix:/var/www# PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0

    Such as some other people also have been experiencing, so it would be realy great if the author of this “howto” or even someone else with a bit of knowledge could have a look at the problem and mayby finding a solution to this sad problem.

    I am realy looking forward to start using rtorrent with wtorrent.

    - Ståle

    [Reply]

  57. devin
    8:44 pm on August 24th, 2008

    Awesome guide, but I’m having the same problem as Stale and others.
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0

    Anyone made any progress on this?

    Thanks!

    [Reply]

  58. jugs
    5:17 pm on August 25th, 2008

    @Alneven, Ståle, devin, others:

    The warning:
    PHP Warning: Module ‘SQLite’ already loaded in Unknown on line 0

    is a simple fix, simply remove the “extension=sqlite.so” from /etc/php5/cgi/php.ini

    [Reply]

  59. devin
    4:23 am on August 27th, 2008

    Thanks jugs, I did get the PHP issue sorted out. I’m getting something similar to Superman now:

    Warning: require_once(wt/cls/ListT.cls.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/lib/inc/utils.inc.php(41) : eval()’d code on line 4

    Fatal error: require_once() [function.require]: Failed opening required ‘wt/cls/ListT.cls.php’ (include_path=’/var/www/localhost/htdocs/wtorrent/’) in /var/www/lib/inc/utils.inc.php(41) : eval()’d code on line 4

    I’ve tried making changes that Superman suggested in home.conf.php, but even with the wTorrent files in /var/www/, I’m still still having issues with index.php not being able to open it’s required files. I’ll keep messing with it, but any help would be appreciated.

    [Reply]

  60. Travis
    4:22 am on August 28th, 2008

    After several attempts I finally got everything installed and I was able to get the login prompt through a browser. I made a password, but when I go to login again it just hangs and does absolutely nothing. Just says “Waiting for 192.168.1.102″ If anyone else had this problem please help me figure out what I’m doing wrong!!

    [Reply]

  61. Travis
    11:54 am on August 28th, 2008

    Probably should have said which login prompt… the wTorrent login prompt :P

    [Reply]

  62. devin
    12:04 am on August 31st, 2008

    Well, I’ve fixed my above problem – see http://www.wtorrent-project.org/trac/ticket/162 for details.

    I’m now having the same issues as Shadowtester, Alneven and Travis. wTorrent doesn’t seem to be able to talk to rTorrent. After entering username/password and logging in, it hangs for a few minutes, then I get this:

    Warning: disk_total_space() [function.disk-total-space]: No such file or directory in /var/www/cls/rtorrent.cls.php on line 342

    Error: could not connect to rtorrent

    I’ve confirmed that rTorrent is listening on the right port:

    # netstat -lnp

    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 30318/rtorrent
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 30334/lighttpd
    tcp 0 0 0.0.0.0:63963 0.0.0.0:* LISTEN 30318/rtorrent

    Anyone figured this one out? I’d love to get wTorrent working.

    [Reply]

  63. sarge
    11:01 pm on September 10th, 2008

    there seems to be a problem in your home.conf.php

    it says:
    define( ‘DIR_DOWNLOAD’, ‘/home/rt/doing’);

    however, the correct path is /home/rt/torrents/doing
    therefor config should look like:

    define( ‘DIR_DOWNLOAD’, ‘/home/rt/torrents/doing’);

    this should get rid of this error message:

    Warning: disk_total_space() [function.disk-total-space]: No such file or directory in /var/www/cls/rtorrent.cls.php on line 342

    [Reply]

  64. Tj
    7:09 pm on September 13th, 2008

    great guide but when i run make in trunk/rtorrent i get

    curl_stack.cc: In constructor ‘core::CurlStack::CurlStack()’:
    curl_stack.cc:58: error: ‘CURLMOPT_TIMERDATA’ was not declared in this scope

    according to http://libtorrent.rakshasa.no/ticket/1462 , i have to upgrade my libcurl, but i have 7.15.5-1etch1 , as the guide suggests, from etch. upgrading this would mean upgrading my whole system (too many programs) so i wont do that.

    [Reply]

  65. paul
    11:17 pm on September 27th, 2008

    I have read through all the comments and I have the problem of lighttpd error log:

    2008-09-28 00:31:36: (mod_fastcgi.c.2534) FastCGI-stderr: XML-RPC: xmlrpcmsg::parseResponse: HTTP error, got response: HTTP/1.0 401 Unauthorized

    I say above where someone said installing util-linux solved it, but I have the latest version and still have the issue. Does anyone know what to do?

    [Reply]

  66. xood
    3:00 am on October 7th, 2008

    Hi there.
    I’ve got a little problem.. rTorrent won’t connect to tracker. tcpdump show no packets transer to tracker at all. rTorrent GUI just ’says’ “Connecting to …”. I’ve waited approx. 10 minutes and nothing changes. iptables allows all incoming/outgoing connections. netstat shows rTorrent listens for udp/tcp port 6881. What may be wrong?

    [Reply]

  67. xood
    2:14 pm on October 7th, 2008

    It seems something wrong with last svn rTorrent/libTorrent, because rTorrent installed via aptitude works well. Any suggestions?

    [Reply]

  68. igwan
    11:28 am on October 8th, 2008

    xood, i had the same problem and i found a solution here -> http://libtorrent.rakshasa.no/ticket/1481

    [Reply]

  69. Karl
    2:57 pm on October 15th, 2008

    Great article, thanks.

    I dont suppose there’s any chance of you uploading wtorrent temporarily as their svn and download site is down?

    [Reply]

  70. igwan
    6:10 pm on October 20th, 2008

    yeah svn://canbruixa.homelinux.net/repos/trunk/wtorrent/ is down but just only because they moved it to svn://wtorrent-project.org/repos/trunk/wtorrent/

    [Reply]

  71. duhd
    9:12 am on December 3rd, 2008

    Hi !
    Truly great howto. I used it for Ubuntu 8.10 with custom kernel. However, since wtorrent is updated (i used r93) the attached config-files are not working properly. There is also (i don’t know from which version) a install.php that makes it easier to create the user.config.php (renamed from home.config.php). If you try to use the attached home.config.php as user.config.php you will get errors since some variables are no longer set in the config-file.
    Thanks again for a great howto.
    //duhd

    [Reply]

  72. hammer
    11:59 am on December 20th, 2008

    Hi,
    for those using an external usb harddrive for the torrents i have two an addition which was quite useful for me:

    change d_start in the init.d script locatet in: /etc/init.d/rtorrent

    —————
    d_start() {
    [ -d "${base}" ] && cd “${base}”
    #####
    #makes starting process sleep until the torrent folder is ready
    #why torrent folder and not mountpoint: mountpoint is existing before the usb harddrive is initiated
    while [ ! -e /path/to/torrentfolder/on/external/harddrive ]
    do
    sleep 1
    done
    #####
    stty stop undef && stty start undef
    su -c “screen -ls | grep -sq “\.${srnname}[[:space:]]” ” ${user} || su -c “screen -dm -S ${srnnam$
    # this works for the screen command, but starting rtorrent below adopts screen session gid
    # even if it is not the screen session we started (e.g. running under an undesirable gid
    #su -c “screen -ls | grep -sq “\.${srnname}[[:space:]]” ” ${user} || su -c “sg \”$group\” -c \”sc$
    su -c “screen -S “${srnname}” -X screen rtorrent ${options} 2>&1 1>/dev/null” ${user} | tee -a “$$
    }
    —————

    An other addition:
    I experienced problems when shutting down debian that stats and sessionfiles were not stored correctly due to rtorrent needing to much time to shutdown and resulting in hash-checks on every start-up.
    with this addition to the rtorrent init.d script in d_stop() the problem was gone:

    —————
    d_stop() {
    session=`getsession “$config”`
    if ! [ -s ${session}/rtorrent.lock ] ; then
    return
    fi
    pid=`cat ${session}/rtorrent.lock | awk -F: ‘{print($2)}’ | sed “s/[^0-9]//g”`
    if ps -A | grep -sq ${pid}.*rtorrent ; then # make sure the pid doesn’t belong to another p$
    kill -s INT ${pid}
    fi
    #####
    #makes the ending process sleep until rtorrent finished shutdown completely
    pidtest=`/bin/pidof “rtorrent”`
    while [ -n "$pidtest" ]
    do
    pidtest=`/bin/pidof “rtorrent”`
    sleep 1
    done
    #####

    }
    —————

    regards,
    hammer

    [Reply]

  73. Stefan
    1:38 pm on January 8th, 2009

    my changed rtorrent init skript (because of some rtorrent problems):

    http://pastebin.ch/820

    [Reply]

  74. Josu
    2:28 am on February 2nd, 2009

    I have all configured, but when I login to wtorretn y have this:

    Warning: disk_total_space() [function.disk-total-space]: No such file or directory in /var/www/cls/rtorrent.cls.php on line 310

    Warning: disk_free_space() [function.disk-free-space]: No such file or directory in /var/www/cls/rtorrent.cls.php on line 310
    0 b/
    Warning: disk_total_space() [function.disk-total-space]: No such file or directory in /var/www/cls/rtorrent.cls.php on line 314
    0 b
    Free:
    Warning: disk_free_space() [function.disk-free-space]: No such file or directory in /var/www/cls/rtorrent.cls.php on line 306
    0 b

    Some help?

    Thanks for all.

    [Reply]

  75. Jetset
    1:09 pm on February 16th, 2009

    Nice tutorial, I wish someone would put up a working. COMPLETELY working tutorial, for debian Lenny.. This tutorial has so many changes that it is hard for a person to follow. links dont work, bla bla bla.. to bad the author did not want to make it totally correct the first time with out all the other peoples changes.. Seems like a mess.. but it is a start, even if you have to be a computer wizzzzz.. to figure it out..

    Someone pleae make a working tutorial on how to set this all up in debian lenny, 64bit.. PLEASE..

    best to all!

    [Reply]

  76. Stefan
    11:32 am on February 21st, 2009

    i completely agree with jetset. i have upgraded to lenny. an now all torrents ar “closed”. if i restart them after about 2 seconds they get closed again automatically.

    also with lighthttp there are some errors: the following lines where not accepted in /etc/lighttpd/lighttpd.conf

    scgi.server = (
    “/RPC2″ => # RT_DIR
    ( “127.0.0.1″ =>
    (
    “host” => “127.0.0.1″, # Ip where rtorrent is listening
    “port” => 5000, # Port specified in .rtorrent.rc
    “check-local” => “disable”
    )
    )
    )

    fastcgi.server = ( “.php” => ((
    “bin-path” => “/usr/bin/php-cgi”,
    “socket” => “/tmp/php.socket”
    )))

    auth.backend = “htdigest”
    auth.backend.htdigest.userfile = “/etc/lighttpd/htdigest”
    auth.require = ( “/RPC2″ =>
    (
    “method” => “basic”,
    “realm” => “XML-RPC”,
    “require” => “valid-user”
    ),
    “/torrents” =>
    (
    “method” => “basic”,
    “realm” => “XML-RPC”,
    “require” => “valid-user”
    ),
    “/db” =>
    (
    “method” => “basic”,
    “realm” => “XML-RPC”,
    “require” => “valid-user”
    )
    )

    as well as line 2 in /usr/share/lighttpd/include-conf-enabled.pl

    for me it looks like, there have been some important changes in lighthttp. wtorrent is also not able to connect to rtorrent anymore.

    greets.

    [Reply]

  77. devin
    5:35 am on March 23rd, 2009

    @Jetset
    I’ve written an installation script for wTorrent/rTorrent: http://ubuntuforums.org/showthread.php?t=1064377
    It’s only been tested on Ubuntu, but I don’t see any reason it shouldn’t work on Debian. Maybe you can give it a try and let me know if it works for you.

    @Josu
    Take a look here: http://www.wtorrent-project.org/trac/ticket/114
    Your DIR_DOWNLOAD in conf/user.conf.php is probably incorrect or missing. It should be a writable folder that wTorrent can check the free space on.

    @Stefan
    The supplied .rtorrent.rc file has infinite seeding turned on. If you have lines similar to this in your .rtorrent.rc, try commenting them out, then restart rTorrent.

    schedule = tied_directory,5,5,start_tied=
    schedule = untied_directory,5,5,close_untied=

    [Reply]

  78. tonidub
    8:34 pm on June 7th, 2009

    i ned w torrent to daunload

    [Reply]

  79. serbitar
    5:11 am on June 12th, 2009

    @devin
    First off, many thanks on your work on the installation script. I tested your install script on a Debian 5.0 minimal install (i.e. nothing installed but the very core files) and it worked flawlessly. The upgrade script needs modified to remove libtorrent10 instead of libtorrent11 and you must do as you said by adding /usr/local/lib to your ld.so.conf. The uninstall script worked as well, save for not killing the rtorrent screen session. Either killing it or rebooting will remove that though.
    Only improvements I can see thus far are rather than hardcoding username and password for the install in to query the user, but hopefully people are smart enough to change this on their own.

    [Reply]

  80. Dexter
    9:49 am on June 26th, 2009

    Hi!

    I try to install on debian 5 (lenny) and polish language, but i have problem with finish installation.

    rtorrent:~# /etc/init.d/lightpd restart
    Stopping web server: lighttpd.
    Starting web server: lighttpd2009-06-26 10:51:07: (configfile.c.901) opening configfile /etc/lighttpd/conf-enabled/10-auth.conf failed: No such file or directory
    2009-06-26 10:51:07: (configfile.c.855) source: /usr/share/lighttpd/include-conf-enabled.pl line: 2 pos: 1 parser failed somehow near here: (EOL)
    2009-06-26 10:51:07: (configfile.c.855) source: /etc/lighttpd/lighttpd.conf line: 162 pos: 12 parser failed somehow near here: (EOL)
    failed!

    What is wrong?

    Maybe somebody make tutorial on debian 5.0?

    PS. Sorry for my weak english ;o)

    [Reply]

Leave a comment

Close
E-mail It
Socialized through Gregarious 42