How to Install and Configure: ruTorrent, rTorrent, Libtorrent, XMLRPC, Screen (Ubuntu)

Add your username to /etc/sudoers.


root password.

 nano /etc/sudoers


john         ALL=(ALL) ALL


1. Create new user “rtorrent”.

sudo adduser --home /opt/rtorrent rtorrent


2. Update Everything and install some needed dependencies.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install subversion build-essential automake libtool libcppunit-dev libcurl3-dev
sudo apt-get install libsigc++-2.0-dev libcppunit-dev unzip unrar-free curl libncurses-dev 
sudo apt-get install apache2 apache2-utils php5 php5-cli php5-curl php-xml-rss php5-xmlrpc
sudo apt-get install php5-sqlite sqlite libapache2-mod-php5 libapache2-mod-xsendfile libssl-dev


3. Enable the SCGI module.

sudo apt-get install libapache2-mod-scgi
sudo ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load
sudo /etc/init.d/apache2 restart


4. Install XMLRPC.

cd $HOME
sudo mkdir install
cd install
sudo svn checkout xmlrpc-c
cd xmlrpc-c
sudo ./configure --disable-cplusplus
sudo make
sudo make install


5. Install rTorrent.

5.1. Install Libtorrent.
cd ..
sudo wget -O libtorrent-0.13.4.tar.gz
sudo tar xvf libtorrent-0.13.4.tar.gz
cd libtorrent-0.13.4
sudo ./
sudo ./configure
sudo make
sudo make install


5.2. Install rTorrent.
cd ..
sudo wget -O rtorrent-0.9.4.tar.gz
sudo tar xvf rtorrent-0.9.4.tar.gz
cd rtorrent-0.9.4
sudo ./
sudo ./configure --with-xmlrpc-c
sudo make
sudo make install
sudo ldconfig


6. Make Directories these are needed for rTorrent to function.

sudo mkdir -p /opt/rtorrent/{session,watch,download}
sudo chmod 777 -R /opt/rtorrent/{session,watch,download}
sudo chown rtorrent:rtorrent -R /opt/rtorrent/{session,watch,download}


7. Edit the .rtorrent.rc file and put it in the home directory of the user that will run rTorrent.

sudo wget -O /opt/rtorrent/.rtorrent.rc


Edit: directory, session, watch_directory, port_range and add scgi port: scgi_port.

sudo nano /opt/rtorrent/.rtorrent.rc
directory = /opt/rtorrent/download
session = /opt/rtorrent/session
#schedule = watch_directory,5,5,load_start=/opt/rtorrent/watch/*.torrent
port_range = 6882-6892
upload_rate = 0
download_rate = 0
use_udp_trackers = yes
max_uploads = 200
check_hash = no

peer_exchange = yes
dht_port = 1026
dht = auto

# Encryption
encryption = allow_incoming,try_outgoing,require,require_RC4,prefer_plaintext,enable_retry

scgi_port = localhost:5000


Change permission:

sudo chown rtorrent:rtorrent /opt/rtorrent/.rtorrent.rc


8. Install ruTorrent.

8.1. ruTorrent via GIT.
sudo apt-get install git
sudo git clone /var/www/rutorrent/
sudo chown -R www-data:www-data /var/www/rutorrent



8.2. ruTorrent ver. 3.7.
cd ..
sudo wget
sudo unzip
sudo mv ruTorrent-master /var/www/rutorrent
sudo chown -R www-data:www-data /var/www/rutorrent



8.3. ruTorrent ver. 3.6.
cd ..
sudo wget
sudo tar xvf rutorrent-3.6.tar.gz
sudo mv rutorrent /var/www
sudo wget
sudo tar xvf plugins-3.6.tar.gz
sudo mv plugins /var/www/rutorrent
sudo chown -R www-data:www-data /var/www/rutorrent



8.4. ruTorrent ver. 3.5.
cd ..
sudo wget
sudo tar xvf rutorrent-3.5.tar.gz
sudo mv rutorrent /var/www
sudo wget
sudo tar xvf plugins-3.5.tar.gz
sudo mv plugins /var/www/rutorrent
sudo rm -rf /var/www/rutorrent/plugins/darkpal
sudo chown -R www-data:www-data /var/www/rutorrent


8.5. ruTorrent mobile.

Acces to ruTorrent, rTorrent from Apple smartphones and older smartphones.

8.6. Install mediainfo.
sudo apt-get install mediainfo


8.7. Install GeoIP i ffmpeg.
sudo wget
sudo gunzip GeoLiteCity.dat.gz
sudo mkdir -v /usr/share/GeoIP
sudo mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
sudo apt-get install php5-geoip libav-tools
sudo ln -s /usr/bin/avconv /usr/bin/ffmpeg


Package ffmpeg is deprecated.

sudo apt-get install ffmpeg


9. Create the .htpasswd file.

cd /var/www/rutorrent
sudo htpasswd -c /var/www/rutorrent/.htpasswd username


You will be asked for a password twice. Response:

New password:
Re-type new password:
Adding password for user username


Edit file /var/www/rutorrent/.htaccess and add location secured by password.

sudo nano /var/www/rutorrent/.htaccess
AuthUserFile /var/www/rutorrent/.htpasswd
AuthName "ruTorrent_login"
AuthType Basic
require valid-user


Access to ruTorrent WebUI.

Edit /etc/apache2/sites-available/000-default.conf and add infoformation about files and locations secured by password apache2.

sudo nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/

    <Directory />
        Options FollowSymLinks
        AllowOverride None

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all


        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf


Create configfile /etc/apache2/sites-available/rutorrent.

sudo nano /etc/apache2/sites-available/rutorrent
# ruTorrent

<VirtualHost *:80>
        DocumentRoot /var/www/rutorrent/
        ErrorLog /var/log/apache2/error.log
        CustomLog /var/log/apache2/access.log combined



Enable ruTorrent configfile:

sudo ln -s /etc/apache2/sites-available/rutorrent /etc/apache2/sites-enabled/rutorrent


Add server name to configfile eg: localhost (at the bottom).

sudo nano /etc/apache2/apache2.conf
ServerName localhost


Enable modules auth_digest and authn_file:

sudo a2enmod auth_digest
sudo a2enmod authn_file


Restart apache2:

sudo /etc/init.d/apache2 restart


10. Secure SCGI (/RPC2).

Create folders: passwords-available, passwords-enabled in /etc/apache2.

sudo mkdir -p /etc/apache2/passwords-{available,enabled}


Create new username password for SCGI.

cd /etc/apache2/passwords-available
sudo htpasswd -c rtorrentscgi username


Link folder passwords-available to passwords-enabled to enable configfile with password.

cd ../passwords-enabled
sudo ln -s ../passwords-available/rtorrentscgi


Edit file /etc/apache2/sites-available/rtorrentscgi and add location of SCGI secured by password.

sudo nano /etc/apache2/sites-available/rtorrentscgi
#rTorrent SCGI Password Location
        <LocationMatch "/RPC2">
                AuthType        Basic
                AuthName        "rtorrentscgi"
                AuthUserFile    /etc/apache2/passwords-enabled/rtorrentscgi
                Require         valid-user
                BrowserMatch    "MSIE"  AuthDigestEnableQueryStringHack=On
                Order           allow,deny
                Allow From      all


#LoadModule scgi_module /usr/lib/apache2/modules/



Enable rtorrentscgi configfile:

sudo ln -s /etc/apache2/sites-available/rtorrentscgi /etc/apache2/sites-enabled/rtorrentscgi


Restart apache2.

sudo /etc/init.d/apache2 restart


11. Install Screen.

sudo apt-get install screen


Start rTorrent in a detached shell using screen.

su - rtorrent
screen -fa -d -m rtorrent


Testing rTorrent:

sudo netstat -npl | grep rtorrent



tcp    0  0*           LISTEN  6642/rtorrent   
tcp    0  0*           LISTEN  6642/rtorrent


12. rTorrent Autostart script.

Download script and save it to /etc/init.d/.

sudo wget -O /etc/init.d/rtorrent


Edit script and chanage option user to rtorrent.

sudo nano /etc/init.d/rtorrent


Change permission and start rTorrent.

sudo chmod +x /etc/init.d/rtorrent
sudo update-rc.d rtorrent defaults
sudo /etc/init.d/rtorrent start


From now rTorrent will start with system automatically in a detached shell using screen.


sudo /etc/init.d/rtorrent start       - start rtorrent
sudo /etc/init.d/rtorrent stop        - stop rtorrent
sudo /etc/init.d/rtorrent restart     - restart rtorrent


13. Access to your web front-end for rTorrent.




You should be asked for username and password to access website





Comments have been disabled.