Install rTorrent latest version on Debian
rTorrent is a great command line based BitTorrent client. It can be managed by a wide variety of frontends, including web, thanks to its SCGI interface.
This howto is tested on :
- Debian 5.0 Lenny
- Debian 6.0 Squeeze
This howto is tested with these versions of rTorrent:
- 0.9.2
Installation
Install the required softwares :
command apt-get install build-essential libssl-dev libcppunit-dev \
libsigc++-2.0-dev autogen automake libtool \ libcurl4-openssl-dev libncurses5-dev
XML-RPC for C install
The software require a recent version of XML-RPC for C library. Fetch the library sources using the sf-downloader script :
command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/sf-downloader' \
--quiet --no-check-certificate --output-document='/tmp/sf-downloader'
command chmod +x '/tmp/sf-downloader'
SOURCE="$(/tmp/sf-downloader --tgz xmlrpc-c xmlrpc-c-VERSION.tgz)"
Go to the new folder :
command pushd "${SOURCE}"
Compile the library :
./configure command make
Install the library :
command make install
Delete the downloaded files :
command popd command rm -r "${SOURCE}"
libTorrent install
Fetch the library stable version sources download URL, and get the version number from this URL :
SOURCE_URL="$(command wget --quiet --output-document=- \
'http://libtorrent.rakshasa.no/' \ | command grep --max-count=1 'libtorrent-.*.tar.gz' \ | command sed -e 's/^.*href="\([^"]*\)".*$/\1/')" VERSION="$(echo "${SOURCE_URL}" \ | command sed -e 's/.*libtorrent-\(.*\)\.tar\.gz/\1/')"
Download the sources archive :
command wget "${SOURCE_URL}" \ --output-document="/tmp/libtorrent-${VERSION}.tar.gz"
Decompress the archive :
command tar --directory "/tmp" -xzf "/tmp/libtorrent-${VERSION}.tar.gz"
Note: to install the development version use :
# VERSION='trunk'
# command git clone 'https://github.com/rakshasa/libtorrent' "/tmp/libtorrent-${VERSION}"
Go to the created folder :
command pushd "/tmp/libtorrent-${VERSION}"
Compile the library :
./autogen.sh ./configure command make
Install the library :
command make install
Delete the downloaded files :
command popd command rm -r "/tmp/libtorrent-${VERSION}" command rm "/tmp/libtorrent-${VERSION}.tar.gz"
rTorrent install
Fetch the software stable version sources download URL, and get the version number from this URL :
SOURCE_URL="$(command wget --quiet --output-document=- \
'http://libtorrent.rakshasa.no/' \ | command grep --max-count=1 'rtorrent-.*.tar.gz' \ | command sed -e 's/^.*href="\([^"]*\)".*$/\1/')" VERSION="$(echo "${SOURCE_URL}" \ | command sed -e 's/.*rtorrent-\(.*\)\.tar\.gz/\1/')"
Download the software sources :
command wget "${SOURCE_URL}" \ --output-document="/tmp/rtorrent-${VERSION}.tar.gz"
Decompress the archive :
command tar --directory "/tmp" -xzf "/tmp/rtorrent-${VERSION}.tar.gz"
Note: to install the development version use :
# VERSION='trunk'
# command git clone 'https://github.com/rakshasa/rtorrent' "/tmp/rtorrent-${VERSION}"
Go to the created folder :
command pushd "/tmp/rtorrent-${VERSION}"
Compile the software :
./autogen.sh
./configure --with-xmlrpc-c
command make
Install the software :
command make install
Delete the downloaded files :
command popd
command rm -r "/tmp/rtorrent-${VERSION}"
command rm "/tmp/rtorrent-${VERSION}.tar.gz"
Setup the rTorrent daemon
Install the daemon required software :
command apt-get install dtach
Create the folders used by the daemon :
command mkdir --parents "/var/lib/rtorrent/sessions" command mkdir --parents "/var/lib/rtorrent/torrents/doing" command mkdir --parents "/var/lib/rtorrent/torrents/watch" command mkdir --parents "/var/lib/rtorrent/torrents/done" command chown -R www-data:www-data "/var/lib/rtorrent"
Fetch the software configuration file :
command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/rtorrent.rc' \ --quiet --no-check-certificate --output-document='/etc/rtorrent.rc'
Install the init.d script :
command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/rtorrent.init-d' \ --quiet --no-check-certificate --output-document='/etc/init.d/rtorrent' command chmod +x '/etc/init.d/rtorrent'
Initialize the daemon log :
command touch "/var/log/rtorrent.log" command chown www-data:adm "/var/log/rtorrent.log"
Setup the log rotation :
command echo '# rtorrent logrotate config.
"/var/log/rtorrent.log" { weekly missingok rotate 10 compress delaycompress notifempty create sharedscripts postrotate sh -c "[ -x /etc/init.d/rtorrent ] && /etc/init.d/rtorrent restart" endscript }' > '/etc/logrotate.d/rtorrent'
Open the following TCP port range on the firewall :
49160-49300
Start the daemon :
/etc/init.d/rtorrent start
Enable daemon launch at startup :
command update-rc.d rtorrent defaults
Solving problems
If the rtorrent daemon does not start, try to remove the lock file :
command rm '/var/lib/rtorrent/sessions/rtorrent.lock'
Thanks
- Thanks to libTorrent an rTorrent (en) developers.