How to Install and Configure: ruTorrent, rTorrent, Libtorrent, XMLRPC, Screen (Debian 8 Jessie).

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


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. Instalacja 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. Instalacja rTorrent.

5.1. Instalacja bibliotek 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. Instalacja 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


sudo nano /opt/rtorrent/.rtorrent.rc

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

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 of rtorrent.rc config file.

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.   Acces to ruTorrent, rTorrent from Android smartphones.

Update path to Download directory.

Edit ruTorrent’s config.php config file and change path to Download directory. Locate $topDirectory and add path to Download directory (/opt/rtorrent/download):

sudo nano /var/www/rutorrent/conf/config.php


$topDirectory = '/opt/rtorrent/download'; // Upper available directory. Absolute path with trail slash.


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



  Configure access to rutorrent. Edit /etc/apache2/sites-available/rutorrent and add infoformation about: alias, files and location secured by password.  

sudo nano /etc/apache2/sites-available/rutorrent.conf


 # ruTorrent
<IfModule alias_module>

Alias /rutorrent        /var/www/rutorrent/

<Directory /var/www/rutorrent/>

Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride all
Require all granted




Enable ruTorrent WebUI.

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


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}


Go to /etc/apache2/passwords-available and make a new password for SCGI.

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


Enable rtorrentscgi password.
Link folder passwords-available to passwords-enabled.

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


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

sudo nano /etc/apache2/sites-available/rtorrentscgi.conf

#rTorrent SCGI Password Location
        <LocationMatch "/RPC2">
                AuthType        Basic
                AuthName        "rtorrentscgi"
                AuthUserFile    /etc/apache2/passwords-enabled/rtorrentscgi.conf
                Require         valid-user
                BrowserMatch    "MSIE"  AuthDigestEnableQueryStringHack=On
                Require ip


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



Enable rtorrentscgi config.

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


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


13. Autostart rTorrent – systemd.

Create rtorrent autostart script for systemd.

sudo nano /etc/systemd/system/rtorrent.service

ExecStartPre=-/bin/rm -f /opt/rtorrent/session/rtorrent.lock
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/local/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/local/bin/rtorrent



Enable rtorrent autostart.

sudo systemctl enable rtorrent.service


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


sudo service rtorrent start       - start
sudo service rtorrent stop        - stop
sudo service rtorrent restart     - restart


sudo systemctl start rtorrent     - start
sudo systemctl stop rtorrent      - stop
sudo systemctl restart rtorrent   - restart


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




You should be asked for username and password to access website




Comments have been disabled.