DLink DNS-320 NAS as an Always-On BitTorrent Box

This post is a tutorial on how to setup a DLink DNS-320 NAS as an always on BitTorrent box.

Steps to achieve that are:

  1. Install fun_plug0.7 on the NAS
  2. Install Debian on the NAS.
  3. Install and configure Deluge BitTorrent Client on the NAS.
  4. Fine tune of Debian installation.

1.  Install fun_plug0.7 on the NAS

Follow one of the bellow link to install fun_plug on NAS:

2. Install Debian on the NAS.

Follow link bellow to install Debian Squeeze on NAS

3.  Install and configure Deluge BitTorrent Client on the NAS.

For the installation and configuration of Deluge BitTorrent client I used the bellow article. Feel free and use that for a detailed reference.

Install Deluge BitTorrent client on a Debian based machine

I’m going to write down the commands I have used to achieve this:

  • As usual before the installation update your repositories:

apt-get update

  • Installing the necessary components:

apt-get install deluged deluge-console python-mako deluge-web

  • The we have to run for first time the Deluge daemon:

deluged

pkill deluged

  • Create a new user that will be used to run deluged

adduser nas_torrent

In my tutorial consider the below credentials:

username: nas_torrent

password: Torrent1!

  • Backup the original configuration

cp ~/.config/deluge/auth ~/.config/deluge/auth.old

  •  Open the original configuration file with your favourite editor

vim ~/.config/deluge/auth

Put the below line to the bottom :

nas_torrent:Torrent1!:10

Basicaly the format is as follows:

<username>:<password>:<access level>

  • Start the deluge daemon

deluged
deluge-console

If all went ok you will have something similar as below on your screen:

2013-03-24_163942

  • Put the below  commands while you are in deluge console:

config -s allow_remote True
config allow_remote
exit

  • Restart the daemon to apply the settings:

sudo pkill deluged
deluged

  • Install and launch deluge client

Disable the Classic Mode option:

2013-03-24_173041

  • Apply the changes and restart the client after that you will prompted to add host.
  • Complete the fields according to your setup. Username and password are the same as the user we created in the begining

add_new_host

  • After adding the host the connection manager will appear with one entry. Select your connection and press connect.

Now you have your desktop ThinClient connected to the deluge BitTorrent client running on your NAS.

Also you can access the Web UI of the deluge client by visiting the bellow link:

http:// < your_nas_ip > : 8112

But first we have to do some fine tuning to our setup

4. Fine tune of Debian installation.

We have to create two cron jobs that will run every minute to check the status of deluged and deluge-web services to be sure that our client will be always in running state.

Access your NAS via ssh connection.

First we have to create two scripts for deluged and deluge-web services.

  • Use your favourite editor and:

1. Deluge.sh script

vim deluged.sh

   Put the below in the script:

#!/bin/bash

# Check if gedit is running
if ps aux | grep “deluged” > /dev/null
then
#echo “deluged is running”
deluged
else
#deluged
echo “deluged is running”
fi

2. Deluge-web.sh script

vim deluged-web.sh

  Put the below in the script:

#!/bin/bash

# Check if gedit is running

if ps aux | grep “deluge-web” > /dev/null
then
#echo “deluge-web is running”
deluge-web
else
#deluge-web
echo “deluge-web is running”

fi

  • Open the crontab file:

crontab -e

And enter the below lines:

*/1 * * * * sh /root/deluged.sh
*/1 * * * * sh /root/deluged-web.sh

  • Save the configuration and restart your NAS.

Now setup and configuration is complete.

Also you can access your setup via Transdroid android application to access your Deluge client.

You have an Always-On BitTorrent Box accessible from all over the world.

Happy downloading ( and seeding 🙂 ).