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






Skip to comment form

    • andy on 28 February 2015 at 19:00


    installed step for step, but opened rutorrent in the browser: “No connection to rTorrent. Check if it is really running. Check $scgi_port and $scgi_host settings in config.php and scgi_port in rTorrent configuration file”. (Ubuntu 14.04.2).

      • sethuper on 28 February 2015 at 21:39

      I just tested this tutorial on Ubuntu 14.04.2 (Desktop) and there is no problem at all.
      “No connection to rTorrent.” it means that rtorrent is not running.

      sudo /etc/init.d/rtorrent start

      Pay more attention when you copy and paste this tutorial.

    • andy on 1 March 2015 at 16:02

    netstat says, that rtorrent is running, but not on Port is correct in config.php and rtorrent config-file. Why there is no connection to localhost?

    1. I didn’t say anything about configuring config.php.
      You missed some Apache2 configuration.

      Here is logfile for Apache2, it will show errors about connection:


    • Martin on 21 April 2015 at 10:54

    Hello, thank you for your guide.

    I downloaded and installed your init script. It works if invoked manually with sudo /etc/init.d/rtorrent start, but rtorrent is not running after reboot.
    There are no errors in the log file, only my debug messages I’ve put in there to see which functions are invoked. During boot, checkcnfg and d_start are invoked, but rtorrent is not running.

    1. After some updates, there is sometimes problem with shutting down rtorrent, all you need to do is to remove this file: rtorrent.lock and run rtorrent again:

      sudo rm -fr /opt/rtorrent/session/rtorrent.lock
      sudo /etc/init.d/rtorrent start

      or reboot

      sudo rm -fr /opt/rtorrent/session/rtorrent.lock
      sudo reboot

        • Martin on 21 April 2015 at 23:26

        Nope, that’s not it. That file doesn’t exist.

        I have created my own short script and added it to init.d, the log shows that it runs during the boot, but it doesn’t show up in netstat.

        In the end, I’ve added a line to /etc/rc.local: sudo -H -u rtorrent bash -c ‘screen -fa -d -m rtorrent’
        And after the reboot, netstat reports rtorrent is running and also rutorrent works.

        1. Try to copy your rtorrent.rc config to root directory and see what happens.

          sudo cp /opt/rtorrent/.rtorrent.rc /root

          kill then run rtorrent again.

          or you can try run rtorrent like this:
          Log in as user rtorrent:

          su - rtorrent

          • strathos on 27 April 2015 at 21:03

          I struggled with the same scenario, and I think I found the answer. The init script doesn’t have networking as a requirement. So modify the info part of your init script to match:
          ### BEGIN INIT INFO
          # Provides: rtorrent
          # Required-Start: $local_fs $remote_fs $network $syslog
          # Required-Stop: $local_fs $remote_fs $network $syslog
          # Default-Start: 2 3 4 5
          # Default-Stop: 0 1 6
          # Short-Description: Start daemon at boot time
          # Description: Enable service provided by daemon.

          This worked at least for me in exactly the same situation (manually worked, but not on boot).

          1. Well, I never had problem with this script, but i will update it just to make sure that there will not be any problems with it in the future..

            Thank You.

            • Marco Lourenço on 16 October 2015 at 10:33

            I think it’s not working again. I can start it manually but not with the provided script at startup. I’m using Ubuntu 14.04.2. I’m trying to debug it, but it’s not easy.

            • sethuper on 16 October 2015 at 19:14

            Sorry I can’t check it and tell you will it work stable.
            Disable rtorrent init script and try script for systemd from this tutorial:

            • Marco Lourenço on 17 October 2015 at 02:53

            Following your idea of not using init.d, I used an old upstart script for Deluge daemon and converted it for rtorrent :

            start on filesystem and static-network-up
            stop on runlevel [016]

            respawn limit 5 30

            exec start-stop-daemon –start –chuid rtorrent –name rtorrent –exec /usr/bin/dtach — -n /tmp/rtorrent.dtach /usr/local/bin/rtorrent

            This goes in /etc/init/rtorrent.conf. I used a start-stop-daemon call from someone else, so it is using dtach instead of screen, which is not a big deal. Hope it helps someone, it worked for me at least.

            • Marco Lourenço on 31 October 2015 at 04:15

            Well, it stopped working again, don’t know why. I’ve already tried all script results for init.d and upstart from Google search.

            Finally, because I also had some problems with ddclient and OpenVPN at startup, problems that I solved with a “sleep 60” for the ddclient startup script, I randomly applied the same strategy here.

            I added a “sleep 30” to the startup script of rtorrent (I know it’s ugly) and now the script does start rtorrent correctly. I think screen is not available for whatever reason when the script tries to launch the screen command. Because it seemed to work previously, maybe screen has changed something in it’s behaviour or maybe it’s juste my server having problems.

            If anyone running Ubuntu 14.04 has no problems with the script provided in this tutorial, I guess it’s my computer, but really couldn’t tell why. Anyway, hope the “sleep hack” can help someone one day…

    • Malin Cenusa on 29 June 2015 at 07:26

    Tested it on Ubuntu 15.04 (Vivid Vervet) and works flawlessly.

    • slapper on 12 July 2015 at 15:02

    Also tested on 15.04 and works awesome. Great job!

    It is great that this comes up near the top of the results when you query for rtorrent guides.

    One thing I would recommend is to do the ruTorrent 3.7 via git clone instead of downloading the zip. This way you just do “git pull” in the directory in the future to keep in sync with Novik’s ruTorrent git

    sudo git clone /var/www/rutorrent/

    1. Here you are
      ..8.1. ruTorrent via GIT.

    • Janik on 12 July 2015 at 21:00

    Hey There,
    unfortunately I can not download from, the site is offline?

    Is there an alternative download, or has anyone the files?

    Have attempts and, but this does not work the make. It’s not a make file available.

    Regards Janik

    1. Server is down.

        • Janik on 12 July 2015 at 22:16

        When will he be back online? Is there an alternative download?

        1. I dont know, its unusual..
          Use git instead:
          sudo git clone /var/www/rutorrent/

    • slapper on 13 July 2015 at 19:20

    Yes it is known problem about the site. I found it in bug report (read the comments at the end)

    It is there I also found that

    LibTorrent 0.13.5 and rTorrent 0.9.5 has been tagged and released 2 weeks ago !!

    Time to update the guide 🙂

    1. I will do it soon, now I fight with CCTV Zoneminder..

    • Robert on 7 August 2015 at 02:09

    Thanks for the excellent guide! I had tried setting up ruTorrent on my own using the packages available in Utopic (libtorrent14 and rtorrent 0.9.2), but needed some help with the htaccess/SCGI part. When I still failed to make it work properly, I used the exact method stated here, and it now works like a charm!

    • Robert on 8 August 2015 at 22:39

    Just a quick note; I remembered a couple of things I had to do on Ubuntu 14.10 (and replicated on 15.04) slightly differently from the guide. Mileage may vary on these as I was working with pretty bare-bones server installations, and a standard installation might have some or all of these already.

    I had compilation errors with xmlrpc-c that I didn’t feel like trying to resolve. So, instead of step 4:
    sudo apt-get install libxmlrpc-c++8 libxmlrpc-c++8-dev

    I also got an error (missing libcrypto) when configuring libtorrent. Before step 5:
    sudo apt-get install libssl-dev

    Other than that, the guide was flawless. Although, I should mention that both times I left the .rtorrent.rc in /opt/rtorrent instead of the user’s home directory, and wondered why the SCGI port wasn’t working! If it was my guide, I’d put “~/.rtorrent.rc” in that command instead, but that’s just me; anyone who’s actually READING the thing would know what to do. 😛

    Thanks again for this very useful guide!

    1. I did this tutorial on Ubuntu 14.10 long time ago..
      Added libssl-dev.
      Yes you are right, if you configure rtorrent.rc for your own user..
      nano ~/.rtorrent.rc
      but in this case you create seperated user just for rtorrent.
      To edit the way you have done it, you have to login as user rtorrent:
      su - rtorrent
      nano ~/.rtorrent.rc

      Thank you for info.

    • Hello on 2 September 2015 at 02:13

    Thank you for the tutorial! BTW, what’s your Apache version for this tutorial? For some new Apache versions, it has /var/www/html, not /var/www. I’m not sure if this tutorial works for /var/www/html, anything to modify if Apache is the version? Like 2.4.7.

    Thank you!

      • sethuper on 2 September 2015 at 05:17

      It was long time ago when i tested this tutorial, but if default configuration of apache2 (2.4.7) is /var/www/html at this moment then replace /var/www to /var/www/html or make alias:
      Alias /rutorrent /var/www

      <Directory /var/www>
      Options +Indexes +Includes +FollowSymLinks +MultiViews
      AllowOverride all
      Require all granted

    • ScaryCat on 31 October 2015 at 16:06

    followed the guide works for r/rutorrent some other things failed..doesnt bother me! but it doesnt ask for password to webGUI what did i miss??

      • sethuper on 31 October 2015 at 16:34

      You need to tell me what kind of things failed.
      It could be a reason why password for rutorrent doesn’t work.

    • nikos on 9 November 2015 at 16:46

    Hi, I did everything mentioned but rtorrent doesn’t work. How can I delete the whole process so I start it from scratch?

      • sethuper on 9 November 2015 at 16:54

      What do you mean that rtorrent doesnt work? does it start at all? Is compilation failed?
      You do not need to remove whole process of the installation if one has failed…
      Let me know where the proces failed the i will sort it out for you cos you are not the first who got problem with the instalation after when ubuntu got some new updates…

        • nikos on 9 November 2015 at 17:26

        I had a problem when configure with xmlrpc-c which I ignored. I start rtorrent, but rtorrent doesn’t show up with netstat. When I go to I get the usual error “No connection to rTorrent. Check if it is really running. Check $scgi_port and $scgi_host settings in config.php and scgi_port in rTorrent configuration file.” I did check for scgi if is configured correct and it is. I did follow carefully step by step the guide.
        I have Ubuntu 15.04 with latest updates

          • sethuper on 9 November 2015 at 17:42

          ok then you have to uninstall rtorrent installation. got to install folder:
          cd install
          then to rtorrent folder
          cd rtorrent-0.9.4
          and uninstall rtorrent:
          sudo make uninstall
          and again got to libtorrent folder:
          cd ..
          cd libtorrent-0.13.4
          and uninstall libtorrent:
          sudo make uninstall
          then you can compile and install everything again, dont forget about xmlrpc.

    • nikos on 9 November 2015 at 20:36

    I cant reply. rtorrent/libtorrent gives error “nothing to be done” and xmlrpc gives error: no rule to uninstall

      • sethuper on 9 November 2015 at 21:29

      So rtorrent and libtorren’t wasnt installed then just compiled.
      Compile rtorrent again with xmlrpc this time..

    • nikos on 10 November 2015 at 08:59

    I don’t know why I can’t reply anymore, rtorrent/libtorrent still give error: nothing to be done when I try make install. Same thing happened with xmlrpc that gives error: error no 2

      • sethuper on 10 November 2015 at 22:49

      I found temporary solution.
      Do not compile xmlrpc-c. Skip this step and install these 2 packages instead:
      sudo apt-get install xml2-dev libxmlrpc-c++8-dev
      Then compile libtorrent and rtorrent..
      If you will get any error while compiling libtorrent, configure it again like this:
      ./configure --prefix=/usr --enable-libxml2-backend --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server --disable-cplusplus
      Just tested under Ubuntu 15.10 Desktop (64bit).

    • nikos on 11 November 2015 at 09:03

    No, it doesn’t work onto my system.

Comments have been disabled.