FlipsideReality Once upon a time, in a land far far away…

4Feb/0885

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
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Comments (85) Trackbacks (6)
  1. and the problem is that I get now only the login window, and after nothing happen…

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

  3. 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

  4. 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

  5. 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

  6. 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

  7. 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!

  8. @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

  9. 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.

  10. 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!!

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

  12. 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.

  13. 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

  14. 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.

  15. 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?

  16. 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?

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

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

  19. Great article, thanks.

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

  20. 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

  21. 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

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

    http://pastebin.ch/820

  23. 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.

  24. 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!

  25. 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.

  26. @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=

  27. i ned w torrent to daunload

  28. @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.

  29. 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)

  30. I try install rTorrent and wTorrent in Buffalo NAS LinkStation Live seem LS’s base OS lacking a lot of supporting package, file for ./configure and make …proceedure, apt-get also didn’t work. Anyone try yet? or any other way for installation. Plss help.

  31. Having the same error as dexter and can’t seem to sort it atm.

    source: /etc/lighttpd/lighttpd.conf line: 162 pos: 12 parser failed somehow near here:

  32. easy to use is MC (apt-get install mc) as a commander
    and set putty -> window -> translation on UTF-8.

  33. I gave up on this guide. It’s a good start for the Debian stuff, but ran into issues in the wtorrent setup. So I started over using this guide (ended up with Debian Lenny 5.0.4) …
    http://www.wtorrent-project.org/trac/wiki/DebianInstall

    … which has some errors too … needed these updates …

    change install command to …
    apt-get install apache2.2-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 libapache2-mod-php5 libapr1 libaprutil1 libc6-dev libcurl3 libcurl3-openssl-dev curl php5-curl libexpat1 libidn11 libidn11-dev libkadm55 libkrb5-dev libmagic1 libncurses5-dev libneon26 libpcre3 libpq5 libsigc++-2.0-dev libsqlite0 libsqlite3-0 libssl-dev libssp0-dev libstdc++6-4.1-dev libsvn1 libtool libxml2 lighttpd linux-libc-dev 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

    the install will fail with a conflict between apache2 and lighttpd …
    Starting web server: lighttpd2010-02-23 10:23:54: (network.c.300) can’t bind to port: 80 Address already in use

    to resolve …

    vi /etc/apache2/ports.config
    – change …
    NameVirtualHost *:80
    Listen 80
    – to …
    NameVirtualHost *:8080
    Listen 8080

    vi /etc/apache2/sites-available/default

    – change first line …

    – to …

    – then restart apache
    /etc/init.d/apache2 restart

    – then rerun the full apt-get install list

    – if the above doesn’t work, find out what is listening to port 80 …
    apt-get install lsof

    lsof -i :80

    – when you get to the libtorrent and rtorrent install, change …
    wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.11.9.tar.gz
    – to ..
    svn co svn://rakshasa.no/libtorrent/trunk/libtorrent libtorrent

    – and …
    wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.7.9.tar.gz
    – to ..
    svn co svn://rakshasa.no/libtorrent/trunk/rtorrent rtorrent

    – if, when starting rtorrent, you get …
    rtorrent: error while loading shared libraries: libtorrent.so.10: cannot open shared object file: No such file or directory

    – Edit ld config file …
    vi /etc/ld.so.conf

    – add this line to the end of file …
    include /usr/local/lib

    – then reset
    ldconfig

    – after editing sample.user.conf.php and restarting lighttpd you get this error …
    Starting web server: lighttpd2010-02-23 13:19:44: (configfile.c.901) opening configfile /etc/lighttpd/conf-enabled/10-auth.conf failed: No such file or directory

    – try this …
    cd /etc/lighttpd/conf-available/

    cp 05-auth.conf 10-auth.conf

    Hope this helps!

  34. First of all i would like to thank Wole for this useful howto!!!

    Next, @ghd and to everyone has found issues on connecting to the screen session
    > 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?

    Basically i found some issues (message: can’t open your terminal /dev/pts/x)
    when trying to connect to rtorrent screen session via ssh using a different login other than rtorrent user and root.
    Since i disabled root login via ssh I edited /sbin/rt script in order to let other users to connect to rtorrent screen session (as a result i always connect remotely using putty and never with wtorrent… much better!). Anyway this is the /sbin/rt:
    #!/bin/bash
    su -c ‘chmod a+rw /dev/pts/`ls /dev/pts -l | grep “root tty” | grep -o [0-9]$`’ root
    su -c “screen -R” rt

    Basically I wrapped the first cmd into a su root session. Then I must provide both root and rtorrent user password.

    Hope this helps!


Leave a comment