Dlink NAS DNS-323 + Debian chroot + rTorrent + wTorrent

DNS323 — Mark @ 9:28 pm

EDIT #2: I have written an expanded and up to date (Jan 2010) guide on the setup of a DNS-323 with Transmission. This has been written as a series of posts and can be found http://blog.markstahler.ca/series/dns-323-ultimate-setup/

EDIT: I no longer use the rTorrent + wTorrent combination, there were fatal bugs in rTorrent which caused it to crash after a short period of time (5 hrs – several days??). I use Transmission + .NET Remote + Transmission Web Interface. If you want a guide for this one (using Debian and built from source; a Funplug installer is currently available here), let me know in the comments.

This is a quick guide to getting rTorrent running on your 323 with the wTorrent web interface.

There are several ways that one could get this working in theory but this is the only method that worked properly. The fun_plug custom rtorrent package did not work properly at all nor did the ipkg one work with xmlrpc enabled (which is required for wTorrent).

To run rTorrent with wTorrent, you must install Debian Linux on your 323. This takes 5-10 minutes and there is a fun plug package that automates all of the work for you. Debian is installed in a chroot environment which means it is completely seperated and self contained from the rest of the 323 software.

If you (like I was) were running Fonz’s Fun Plug you will first have to remove it. This is done by deleting the funplug directory in /mnt/HD_a2/fun_plug. It is possible it can be done via Windows Explorer (or whatever) if you changed its permissions/owner, otherwise do it from the command line.

(Please be careful using rm -rf, you can destroy a Linux system with one wrong delete)

rm -rf /mnt/HD_a2/fun_plug
chmod -R 777 /mnt/HD_a2/ffp
rm -rf /mnt/HD_a2/Nas_prog

Reboot the NAS and delete the /mnt/HD_a2/ffp directory.

You are now ready to install Debian. This is very simple using the Debnas fun plug package. You can find it at http://sourceforge.net/projects/debnas/. At the time of this writing 0.5 is the latest version.

Download and extract the package to Volume_1 of the 323 (tar -jxf in /mnt/HD_a2/). There should now be linux.tar and the fun_plug in the root of the drive now.

Reboot the 323 and Debian will install, this will take several minutes. SSH will be enabled when the device boots. SSH to the 323, the default root password is 12345678. Change the password immediately with the passwd command.

Now you have a full Linux environment on the 323 with all the repository packages at your disposal. The first step is to upgrade to Debian Lenny, a newer stable version of the operating system. Edit /etc/apt/sources.list.d/etch.list, replacing the word etch with lenny. I also changed the mirror url to a North American mirror rather than the German one by removing the de. in the url. You may also rename the filename from etch.list to lenny.list if you feel so inclined.

Now we need to update the repository packages listing and upgrade to lenny. You may have GPG issues which you can resolve by following the guide here :

apt-get update
apt-get dist-upgrade

This will take a while to download and then upgrade. When it is done reboot Debian. I had to reboot using the command ‘reboot -f’. When Debian comes back up, it will be running Lenny. When it comes back up, update to make sure everything is current.

apt-get update
apt-get upgrade

Now we have a reasonably current Linux system to play with. Time to install rTorrent, lighttpd, wTorrent and all the dependencies.

apt-get install <package name>

Apt-get should resolve and install all the package dependencies for you.

List of Packages:

rtorrent
lighttpd
screen
php5
php5-cgi
php5-cli
php5-sqlite
php5-xmlrpc
libxmlrpc-c3
subversion
// Packages I dont think are required but installed anyways
automake
build-essential
libapache2-mod-scgi
libapache2-mod-php5
libapache2-mod-fastcgi

Dont worry about lighttp complaining that it cant be started because port 80 is in use, we will change it.

First we will modify the rTorrent settings. One thing that I do that you may also like is that I store my rtorrent settings on the NAS volume 1 and link it to /home/<user>/.rtorrent.rc

Add the following line to your .rtorrent.rc

scgi_port = localhost:5000

usually this line is already in the config and just needs to be uncommented. For this option to work, rTorrent needs to have RPC support built into the program. The rTorrent available from apt does but it is an older version.

Now edit /etc/lighttpd/lighttpd.conf

Under the server.modules section, add the following lines at the end before the ).

“mod_fastcgi”,
“mod_scgi”

Change where the server stores webpages:

server.document-root       = “/mnt/HD_a2/www/pages/”

You also need to change the port the webserver runs on. 80 is used by the dlink admin page:
server.port               = 8080

Add the following section to the config:

## php support
fastcgi.server = ( “.php” => ((
“bin-path”  => “/usr/bin/php-cgi”,
“socket”    => “/tmp/php-cgi.socket”,
“max-procs” => 2
)
)
)

## enable communication between lighttp and rtorrent
scgi.server = (
“/RPC2″ => # RT_DIR
( “127.0.0.1″ =>
(
“host” => “127.0.0.1″, # Ip where rtorrent is listening
“port” => 5000, # Port specified in .rtorrent.rc
“check-local” => “disable”
)
)
)

NOTE: You can change the other settings to your hearts content. I changed the directories for my logs etc, I leave this up to you.

Now lighttp and php are configured properly. Lets make the web home on your 323 volume.

mkdir /mnt/HD_a2/www
mkdir /mnt/HD_a2/www/pages

echo “<html><body>TEST<?php phpinfo( ); ?></body></html>” > /mnt/HD_a2/www/pages/index.php

Start up the web server by:

/etc/inid.d/lighttpd start

Enter the URL including the correct IP for you 323 and you should see the PHP info version page
http://192.168.1.5:8080/

If everything works all you need to do is setup nstall wTorrent into a directory under your webserver home.

Download wTorrent from http://www.wtorrent-project.org/trac/ch … ormat=zip. Unzip the archive and move the /wtorrent/ directory to /mnt/HD_a2/www/pages/wtorrent. chmod -R 777 wtorrent.

Point your browser to http://<nas ip>:8080/wtorrent/install.php and follow the prompts. After installation is complete, start rTorrent and browse to http://<nas ip>:8080/wtorrent/.

  • marca

    Hey, thanks for a great guide.

    When i boot into debian my fan is on full speed and it dosent react to the changes i make in the (d-link) web-gui. When i go back to my ffp setup it start to work again (auto/low setting)

    How can i control the fan so it dosen't make all that crazy noise?

  • markstahler

    Hi marca,

    I personally havent run into this problem. I noticed you made a post over at http://forum.dsmg600.info/viewtopic.php?id=4797 which is definitely the right place to ask. I hope you resolve your issue.

  • http://reliable-hosts.com/ jeffie web

    thanks for the remarkable guidance.learned a lot from it.going to bookmark this page on my browser for further reference

  • http://reliable-hosts.com/ jeffie web

    thanks for the remarkable guidance.learned a lot from it.going to bookmark this page on my browser for further reference

  • James

    I would like to see a guide on how to build Transmision from source. I built 1.76 recently but crashed after a while under chroot'd debian on my DNS-323.
    Thanks.

  • http://www.markstahler.ca Mark

    Hey James.

    It sounds like you have successfully compiled Transmission but run into a bug if you are experiencing crashes. Have you checked their open bugs? http://trac.transmissionbt.com/report/1

    Looking at the guide again, I might be able to make a full guide including Debian + Transmission without too much trouble. Thanks for the suggestion.

  • Pingback: The Ultimate DNS-323 Setup: Part 1 – Debian Installation

  • http://blog.markstahler.ca/ Mark

    This post is out of date and has been replaced. You can find the updated articles which include the setup and configuration of Transmission with a DNS-323 at http://blog.markstahler.ca/series/dns-323-ultim

  • JaCh0o

    hello there,
    i have small problem, im a linuxe newbie and i dont know how to find file “.rtorrent.rc” and make link to it, and then add line (as ju wrote here:First we will modify the rTorrent settings. One thing that I do that you may also like is that I store my rtorrent settings on the NAS volume 1 and link it to /home/<user>/.rtorrent.rc
    Add the following line to your .rtorrent.rc
    scgi_port = localhost:5000″) second question does transmission or rtorrent work for private trackers ?? (becouse this is mainly reason for what i need the dns-323) waiting for answer ASAP

  • JaCh0o

    could any1 help me?

  • http://blog.markstahler.ca/ Mark

    I dont understand your question. Just create the file yourself using a text editor. Find a list of available options on their website. I do not use rtorrent anymore (see note at top of the article).

    Yes rtorrent works with private trackers.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2016 Mark Stahler – Blog | powered by WordPress with Barecity