HOWTO: rtorrent + rutorrent on the Netgear ReadyNAS 102

In 14 short steps. Wonderful!


  • A Netgear ReadyNAS 102 with firmware version 6.1.6 to 6.1.8, which I’ve tested this on
  • Root access to the NAS. All the commands in this tutorial should be run as root

NOTE: This tutorial probably works for any system running Debian Wheezy.

Step one: configure apt

Open /etc/apt/sources.list in your favourite editor and change the line with ‘wheezy’ in it to look like this:

deb wheezy main contrib non-free

This will make sure you can get all the necessary packages later on. Update the package list using:

# apt-get update

Step two: install required packages

# apt-get install libapache2-mod-php5 libapache2-mod-scgi rtorrent dtach

Step three: create a group and a user for rtorrent to run as

# adduser --group --system --shell /bin/false rtorrent

Step four: create rtorrent session directory

# mkdir /var/rtorrent

Step five: create rtorrent config file

Open /home/rtorrent/.rtorrent.rc in your favourite text editor. In my case, I took the contents of this example and changed it to contain this:

directory = /path/to/my/downloads
session = /var/rtorrent
scgi_port = localhost:5000
use_udp_trackers = yes
dht = auto
dht_port = 41000
port_range = 41001-41011

You should change this according to your preferences. The only really necessary setting to have is ‘scgi_port’. For the ‘dht_port’ and ‘port_range’ settings you will probably need to set up port forwarding, something I won’t go into in this tutorial.

Step six: set the right permissions

# chown -R rtorrent:rtorrent /var/rtorrent /home/rtorrent

Step seven: test rtorrent

See if rtorrent runs properly by running this command:

# su - rtorrent -s /bin/sh /usr/bin/rtorrent

If not, you might have forgotten to configure something, or this tutorial is missing something, in which case please contact me!

Step eight: create init script

This is basically a modified version of the script found here. Thank you, roog!

Open /etc/init.d/rtorrent in your favourite text editor and slap this in:


case "$1" in
        echo "Starting rtorrent"
        # Check if dtach socket file exists already
        if [ -e $DTACH_SOCKET ]; then
                echo "Error: dtach socket '$DTACH_SOCKET' already exists. Possible reasons: rtorrent already running / not cleanly shut down. If the latter, delete socket file by hand."
                exit 1

        su - rtorrent -s /bin/sh -c "dtach -n $DTACH_SOCKET /usr/bin/rtorrent" &> /dev/null
        if [ $? -gt 0 ]; then
            echo "Error starting rtorrent!"
            exit 1
        echo "Stopping rtorrent"
        killall -s 2 rtorrent &> /dev/null
        if [ $? -gt 0 ]; then
            echo "Error stopping rtorrent!"
            exit 1
        $0 stop
        sleep 1
        $0 start
        echo "usage: $0 {start|stop|restart}"

Step nine: install init script

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

Step ten: test init script

Test the init script by running:

# service rtorrent start

Then double-check if it works with:

# ps -ef | grep rtorrent

Step eleven: get rutorrent

Grab the latest version of rutorrent from here . In my case, it was:

# wget

Then, extract it in Apache’s webroot:

# tar xzf rutorrent-3.6.tar.gz -C /var/www

(The name of the tar.gz file may differ)

Step twelve: configure Apache

NOTE: I have not been able to test updating the ReadyNAS, but I have good hopes that updates will not break the installation of rutorrent.

Open /etc/apache2/mods-available/scgi.load and make it look like this:

LoadModule scgi_module /usr/lib/apache2/modules/

# Perform SCGIMount for rtorrent / rutorrent

Then, open (create) /etc/apache2/sites-available/rutorrent and make it look like this:

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

Make sure these configs are enabled:

# cd /etc/apache2/mods-enabled && ln -s ../mods-available/scgi.load
# cd /etc/apache2/sites-enabled && ln -s ../sites-available/rutorrent 010-rutorrent

Last but not least, verify that the changes will work:

# apache2ctl configtest

…and if nothing shocking happens, reload Apache:

# service apache2 reload

Step thirteen: configure your desktop

There are neater ways to do this, but this is how I did it.

On Windows: open c:\windows\system32\drivers\etc\hosts
On UNIX-like OSes: open /etc/hosts

…and add the following line: rutorrent.nas

Where you should replace with the real IP address of your NAS.

Step fourteen: pure bliss

You should now be able to use rutorrent by pointing your browser to http://rutorrent.nas/ . Happy leeching!

Tags: , , ,
| April 6th, 2014 | Posted in Tutorials |

One Response to “HOWTO: rtorrent + rutorrent on the Netgear ReadyNAS 102”

  1. rTorrent, ruTorrent, RSS, ReadyNAS 102 | daarsk Says:

    […] I followed this link… But had some minor issues. Writing this to jog my memory if I ever have to do it […]