Tutorial on Installing Debian Squeeze, SABnzbd, SickBeard, CouchPotato and Headphones on the D-Link DNS-320 and DNS-325


Overview:

This guide is going to cover installing Debian Squeeze, SABnzbd, SickBeard, CouchPotato and Headphones to run on the D-Link DNS-320 and DNS-325.

This guide assumes that you already have a WORKING installation of Fun Plug on your NAS if you haven’t please consult this guide first Installing Fun Plug (FFP) on D-Link DNS 320, 323, 325, 323, 343 and 345.

Although assuming that you do have a working Fun Plug installation, lets get rocking and rolling as the cool kids might say.

What you need:

  • A compatible device already setup and running Fun Plug.
  • Debian Squeeze files which are found here.
  • PuTTY (Telnet and SSH client) available here.
  • Patience and an lower than average IQ. (We jest)

Before you begin:

With the unit booted and the existing Fun Plug already loaded, create a backup of the fun_plug file that is on the NAS. Rename the backup to “fun_plug.bak” and keep it in the same location, this backup is very important so please do back it up.

Installing Debian Squeeze:

Now you can extract the Debian Squeeze files you have just downloaded to a folder of your choosing. You should now have two files named:

  • fun_plug.debian
  • squeeze.tar.gz

Rename fun_plug.debian to fun_plug and then copy the two files fun_plug and squeeze.tar.gz onto the Volume_1 folder of your NAS. You may need to overwrite your original fun_plug file depending on if you made a copy prior to renaming it.

Now here’s the important part, do not reboot the device just yet as we need to use the already loaded and original fun_plug installation to configure this one. So open up PuTTY and SSH into your device. You should be greeted with the all too familiar:

/#

Now perform the following commands:

cd /mnt/HD/HD_a2
gunzip squeeze.tar.gz
tar -xf squeeze.tar

and finally

ls

Confirm that a directory called “squeeze” has been created and that the new fun_plug is also there.

You can now shut down and reboot the device either via the web interface or by holding the power button for 5 – 10 seconds.

Configuring your new Debian installation:

Open up PuTTY and SSH into your device, you should be greeted by a login prompt default username is ‘root’ and password is ‘dlink’.

Now you can add updated repository by using nano by typing :

nano /etc/apt/sources.lis

And add the following line at the bottom of the file

deb http://security.debian.org/ squeeze/updates main contrib non-free

Now hit Ctrl + O to write the file and Ctrl + X to exit

Lets run some updates by running the following commands:

apt-get update

and

apt-get upgrade

We should now set the root password to something other than dlink for security reasons so enter this command and set a new memorable password.

passwd

As it’s not advised to do everything as the root user (Linux hierarchy and all that) so lets create a new user account by entering :

adduser nasdestruction

Substituting nasdestruction for a username of your choice, for the remainder of this guide we will refer to the account as nasdestruction so please remember to substitute that for the username you specified when running the above command.

Finally let’s set the timezone so Debian knows what time it is, enter the following command:

dpkg-reconfigure tzdata

and finally

cat /etc/timezone

Installing Git and dependance files:

To manage the packages and install the software on this one we’re going to need to install Git and required files to run Git so we can Git Get Going on installing SABnzbd and SickBeard etc. so run the following commands in succession:

apt-get install git-core
cd /usr/local/sbin
chmod 666 /dev/null
chmod 777 /dev/urandom
ln -s /dev/urandom /dev/random
apt-get install python python-cheetah python-configobj python-feedparser python-support par2 python-openssl python-yenc unzip unrar python-dbus sudo

And Finally

Exit

You should no longer be logged in as root so SSH back into the unit and you should now login as the user you created earlier so your command prompt should now be a /$ instead of a /#.

Installing SABnzbd:

So now logged in as your new user you created earlier you should have an $ prompt now so lets install SABnzbd by running the following commands – remembering to substitute nasdestruction for the username you created earlier. Unless you left it as nasdestruction in which case we’re flattered but I digress.

Firstly lets change into the new users directory to make sure all the files and folders are organized.

cd /home/nasdstruction/

And now install SABnzbd by running the following commands.

wget http://voxel.dl.sourceforge.net/project/sabnzbdplus/sabnzbdplus/sabnzbd-0.6.15/SABnzbd-0.6.15-src.tar.gz
tar xzvf SABnzbd-0.6.15-src.tar.gz
mv SABnzbd-0.6.15 SABnzbd
rm SABnzbd-0.6.15-src.tar.gz
mkdir .sabnzbd

and check that the two directories are there by running the following command

ls -a

There should be a SABnzbd and .sabzbd listed.

So lets fire up SABnzbd and make sure it works by running the following command, remember to substitute ‘YourNASIPHere’ for your NAS’ IP Address otherwise it wont quite work.

python SABnzbd/SABnzbd.py -d -f .sabnzbd/sabnzbd.ini -s YourNASIPHere:8080

You might need to give it a minute or two but that should start SABnzbd, once started you can open up a web browser and in the address bar type in the IP address of your NAS with :8080 at the end. This should open up SABnzbd and you can continue through the quick start wizard that you should see in your web browser.

Installing SickBeard, CouchPotato and Headphones:

To Install the applications we’re going to use the GIT command which will download and install the programs for us, please note that each of these applications can be quite system intensive and you should only install the required items.

To install SickBeard we’d run the following command:

git clone git://github.com/midgetspy/Sick-Beard.git

To install CouchPotato run the following command:

git clone git://github.com/RuudBurger/CouchPotato.git

To install Headphones run the following command:

git clone git://github.com/rembo10/headphones.git

Once those are installed you can start each service by running the following commands :

python Sick-Beard/SickBeard.py -d
python CouchPotato/CouchPotato.py -d
python headphones/Headphones.py -d

You can access each service once started by typing the IP address of your NAS into your web browser and using the following ports for each service:

  • SickBeard on port 8081 ( yourNASIPHere:8081 )
  • CouchPotato on port 5000( yourNASIPHere:5000 )
  • Headphones on port 8181 ( yourNASIPHere:8181 )

 

So now all the services and additional packages are running on the system and you can configure them via their webguided configurations, lets move onto the last steps in this setup guide.

 

Final configuration:

Lets make sure there is a downloads folder that is writable with writable recurisve sub directorys and if not lets make one. Enter the following command:

cd /mnt/HD/HD_a2/

Now lets look for a Downloads folder by entering

ls

If you see a Downloads folder you can skip this next line, if you don’t however create one by typing

mkdir Downloads

If you have just created a Downloads folder or already had one, we now need to make sure it’s chmod permissions are 777 and recusive (this means any folders and files created within that directory are also as default chmodded to 775. So enter the following code to achieve this:

chmod 777 -R /mnt/HD/HD_a2/Downloads

 

Now onto the last part of the last section which is configuring each item to start automatically with the NAS.

 

Setting the packages to run on startup:

SSH into the NAS as root by typing su at the command prompt, once logged in we need to edit some files so lets start by running the following command:

nano /etc/init.d/sabnzbd

Copy the text below and remember to change the IP and directory’s with the ones you setup and and you will also need the SABnzbd API key available in the SABnzbd confg screen via the web interface which you should enter in place of ‘SABNZBDKEYGOESHERE’:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          SABnzbd
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start SABnzd at boot time
# Description:       Start SABnzbd.
### END INIT INFO

case "$1" in
start)
  echo "Starting SABnzbd."
  /usr/bin/sudo -u root -H /home/nasdestruction/SABnzbd/SABnzbd.py -d -f /home/nasdestruction/.sabnzbd/sabnzbd.ini
;;
stop)
  echo "Shutting down SABnzbd."
  /usr/bin/wget -q --delete-after "http://YourNASIPHere:8080/sabnzbd/api?mode=shutdown&apikey=SABNZBDKEYGOESHERE"
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0

Now hit Ctrl + O to write the file and Ctrl + X to exit

Then type the following code to make it bootable:

chmod 755 /etc/init.d/sabnzbd

and then

update-rc.d sabnzbd defaults

We then need to add to boot at startup by running the following:

nano /boot/linuxrc

and after the last line add:

# START SickBeard CouchPotato Headphone
/etc/init.d/mediaservers.sh

# START SABnzbd
service sabnzbd start

Now hit Ctrl + O to write the file and Ctrl + X to exit

And then:

nano /etc/init.d/mediaservers.sh

and paste in the following code removing any lines that you haven’t installed or don’t want to run and remember to substitute the nasdestruction folder for your user directory that you created earlier.

#!/bin/bash
su root -c "chmod 666 /dev/null"
su nasdestruction -c "python /home/nasdestruction/CouchPotato/CouchPotato.py -d"
su nasdestruction -c "python /home/nasdestruction/Sick-Beard/SickBeard.py -d"
su nasdestruction -c "python /home/nasdestruction/headphones/Headphones.py -d"

Now hit Ctrl + O to write the file and Ctrl + X to exit

And finally chmod that to make it bootable by typing:

chmod 755 /etc/init.d/mediaservers.sh

And then:

exit

Restart the NAS via the D-Link web interface or by holding the power button for 5 – 10 seconds and we’re done. If you’ve installed all the applications it could take a while for the unit to boot so please give it at least 5 minutes for everything to load.

6 Comments

  1. bg1 says:

    the section for “And now install SABnzbd by running the following commands.” has a typo. you have “wget sttp://…” instead of “wget http://..”

    otherwise, thanks for the great tutorial!

  2. Owen Conti says:

    Thanks for the incredibly useful blog post!

    You have a typo in your wget line of SABnzbd, just so you know

    http:// instead of sttp:// :)

    Owen

  3. Gianni says:

    I have followed your instructions but I get this error when I try to start SABnzbd:
    Traceback (most recent call last):
    File “SABnzbd/SABnzbd.py”, line 65, in
    import sabnzbd
    File “/home/jjcuzz/SABnzbd/sabnzbd/__init__.py”, line 85, in
    import sabnzbd.api
    File “/home/jjcuzz/SABnzbd/sabnzbd/api.py”, line 29, in
    locale.setlocale(locale.LC_ALL, “”)
    File “/usr/lib/python2.6/locale.py”, line 513, in setlocale
    return _setlocale(category, locale)
    locale.Error: unsupported locale setting

  4. Rob says:

    Install went okay – but when I SSH in after reboot, ‘dlink’ isn’t accepted as the password. Any ideas?

  5. ioannis says:

    Great tutorial.
    Could I have also Transmission installed with this configuration?
    I want to download from CouchPotato and SickBeard using torrent files instead of nzb.
    Is this possible?
    Thank you.

Leave a Comment