Back to Home

Install and configure rtorrent + wtorrent bundles in Debian

rtorrent · wtorrent · debian · home server

Install and configure rtorrent + wtorrent bundles in Debian

    On habrahabr the problem of creating a home server has been repeatedly debated. Accordingly, using the search, you can easily find some good articles on this topic. There you will learn, in particular, why all this is needed.
    But, unfortunately, none of the articles presented on the Internet completely discloses the problem of installing the rtorrent + wtorrent bundle in the Debian system (or Ubuntu, which is almost the same). The main difficulty lies in several obvious and not very "pitfalls":

    - Debian contains some packages with outdated versions of libraries that are incompatible with the latest version of rtorrent / libtorrent;
    - the existing manuals and howto contain information only on how to install this bundle on the lighttpd server, which is not always convenient (for example, I have a couple of sites on my home server that are better run under Apache);
    - no manual takes into account all the subtleties of the installation.

    Given these circumstances, this manual was written in the style of “copy-paste”, which, I hope, will help you in the difficult task of taming rtorrent / wtorrent.

    We put the "clean" Debian 4.0. Next, in the console under the root, we put the necessary packages: We will conjure over Apache: We will put the rest from sors. First, install xmlrpc: Next c-ares: Next libcurl: Now you can build libtorrent and rtorrent:

    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 linux-kernel-headers \
    lynx m4 make mime-support ntp ntpdate openssl patch libapache2-mod-scgi\
    perl perl-modules php5 php5-cgi php5-common php5-sqlite pkg-config screen




    a2enmod suexec
    a2enmod scgi




    cd
    svn co xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/stable xmlrpc-c
    cd xmlrpc-c
    ./configure --disable-cplusplus
    make
    make install



    cd
    wget c-ares.haxx.se/c-ares-1.6.0.tar.gz
    tar xzf c-ares-1.6.0.tar.gz
    cd c-ares-1.6.0
    ./configure
    make
    make install




    cd
    wget curl.haxx.se/download/curl-7.19.3.tar.gz
    tar xzf curl-7.19.3.tar.gz
    cd curl-7.19.3
    ./configure --enable-ares
    make
    make install




    cd
    mkdir rtorrent
    cd rtorrent
    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


    Add the rt user and create all sorts of service folders: Create a startup script for rtorrent and add it to autoload: Create a configuration file for rtorrent: Write the following there: If you have a router, open ports 63963 and 63982 on the server with rtorrent on it. Next, edit the /etc/apache2/apache.conf file, add the following lines somewhere: Now install wtorrent. To do this, do the following: In the ./conf/home.conf.php file, write the following: Next, write the permissions for all the necessary folders and files: In order for everything to work, it is best to restart the server. If you want to access the web-interface from the local machine, just add the line

    useradd rt
    cd /home/rt
    mkdir ./torrents
    mkdir ./torrents/watch
    mkdir ./torrents/doing
    mkdir ./torrents/done
    mkdir ./.rtsession
    chown rt:rt /home/rt -R
    chmod 777 /home/rt/torrents -R




    cd
    wget re-hash.ru/pub/rtorrent.tgz
    tar xzf rtorrent.tgz
    cp rtorrent /etc/init.d
    chmod a+x /etc/init.d/rtorrent
    update-rc.d rtorrent defaults 25




    nano /home/rt/.rtorrent.rc



    scgi_port = localhost:5000
    min_peers = 40
    max_peers = 1000
    min_peers_seed = 10
    max_peers_seed = 50
    max_uploads = 15
    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
    port_range = 63963-63963
    port_random = no
    check_hash = yes
    use_udp_trackers = yes
    encryption = allow_incoming,try_outgoing,enable_retry
    dht = auto
    dht_port = 63982





    SCGIMount /RPC2 127.0.0.1:5000


    SuexecUserGroup rt rt
    ServerName torrent
    #ServerAlias www.torrent
    DocumentRoot /var/www/torrent/www
    CustomLog /var/www/torrent/access.log combined
    ErrorLog /var/www/torrent/error.log

    Options FollowSymLinks Includes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all

    #ScriptAlias /cgi-bin/ "/var/www/torrent/cgi-bin/"




    mkdir /var/www/torrent/www
    cd /var/www/torrent/www
    svn co svn://canbruixa.homelinux.net/repos/trunk/wtorrent/
    mv * ..
    cd ..
    rmdir wtorrent
    mkdir data
    nano ./conf/home.conf.php




    define( 'URL', 'http://torrent/' );
    define( 'BASE', 'http://torrent/' );
    define( 'DB_FILE', 'db/database.db');
    define( 'RT_HOST', 'localhost');
    define( 'RT_PORT', 80);
    define( 'RT_DIR', 'RPC2/');
    define( 'RT_AUTH', false);
    define( 'RT_USER', '');
    define( 'RT_PASSWD', '');
    define( 'NO_MULTICALL', true);
    define( 'DIR_TORRENTS', 'torrents/');
    define( 'DIR_EXEC', '/var/www/torrent/www');
    define( 'PERM_TORRENTS', 0777);
    define( 'DIR_DOWNLOAD', '/home/rt/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( 'DIR_IMG', 'home/img/' );
    define( 'SRC_INDEX', 'index.php' );
    define( 'SCRAMBLE', false);
    define( 'APP', 'wTorrent' );
    require_once( 'lib/inc/includes.inc.php' );
    autoload( 'lib/cls/', 'cls/', 'home/cls/' );
    ini_set( 'include_path', DIR_EXEC );
    ?>




    chown -R rt:rt /var/www/torrent/www
    chown -R www-data:www-data db torrents tpl_c
    chmod data 755
    touch ./db/database.db




    127.0.0.1 torrent

    to the / etc / hosts file. If you want to access the interface from another machine, add the above line to the hosts on it, replacing 127.0.0.1 with the IP of the machine with rtorrent.

    After rebooting, open the torrent / install.php URL in the browser and complete the installation. You can leave everything by default, except for the username and password, of course. After installation, do not forget to kill the file /var/www/torrent/www/install.php.

    If I forgot something, I will answer in the comments. I would be grateful for the constructive comments on this manual.

    Read Next