Guide to creating a torrent slave


Recommended Posts

Torrent Box Guide

I'm writing this guide as a starting point for anyone considering building a low-power low-budget torrent slave their home network. This article is an instruction in what to look for in terms of hardware and then making it all work using Ubuntu Server and Deluge.

I am assuming you know at least something about computers and how to install operating systems. No Linux expertise is required, common sense is required, and being able to ask for help in a nice manner.

Hardware

So, what's in the box? I wanted something that's low-power because most of the time it's sitting idle. When it is downloading, it's not using much power either. Sure you could buy an old cheap Athlon but they still use quite a bit of power (unless you under-volt/-clock it) and the performance wouldn't be so good at low clock speeds if you did want to do anything intensive. Another factor was having something that's new enough to support some of the modern technologies. Sure old Athlons have SATA support but other things like DDR1 RAM are hard to find and expensive now.

I decided to go with one of the new “Pineview” Intel Atoms. They're no longer a power hungry beast because of an old north-bridge that uses more power than the processor itself. There's no nVidia based Pineview Atoms yet because of licensing disputes so if you want it to double as a HTPC you're going to be using more power.

Since the Pineview Atoms are low-power it makes sense to use a passive heat-sink on them. This also reduces the noise a bit too because you don't have as many fans whirring.

The board I chose is the ASUS AT5NM10-I. It's a Pineview Dual-core Intel Atom (with Hyperthreading) with a passive heat-sink. It has 2 SATA ports which is enough for me. I don't know what the official maximum supported hard drive is on there, but two 1TB hard drives would be enough for most applications.

There's also gigabit LAN so there should be no problems with transfer speeds over the network for those large files.

Personally I'd recommend against putting a WLAN card in it because that's going to provide a huge bottleneck in streaming and transferring files. It's up to you if you decide to put a WLAN card in and shove the computer in a closet somewhere. Just be aware that performance will degrade.

The board is mini-ITX so you can put it into quite a small case and it won't take up much room. I bought a cheapy mini-ITX with a power supply in it. You could go with an ATX case if you had one spare, it doesn't matter too much unless space is a problem.

My Setup

The hardware configuration for slave is:

  • ASUS AT5NM10-I motherboard
  • Mini-ITX case
  • 2GB DDR2 RAM
  • 320GB SATA HDD

Software

Now the software, the most important part of this guide. None of this would work without it.

I chose Ubuntu Server 10.04 for the operating system. I'm familiar with Ubuntu having used it for the past three years. The current release (10.04) is a Long Term Support release so it has 5 years of security updates for the server edition. Ubuntu is also quite ubiquitous so there's plenty of help and packages out there for you if you ever get lost.

Installing Ubuntu

Because my torrent slave doesn't have a CD/DVD drive I had to install via USB. Fortunately Ubuntu provides good support for this and even has an official guide.

The installation is quite straight forward, follow the prompts, answer the questions. If you're unfamiliar with partitioning then I suggest you let the installer do it for you.

Installing the server edition leaves you without a GUI desktop so you've only got the terminal. Don't worry, you don't have to do too much with it once things are installed.

NB: swap partition:

I chose not to use a swap partition. I've never actually used any swap, even when using a machine with 1GB RAM. My current configuration for the torrent machine only hits about 700MB used memory so 2GB is more than enough.

Configuring Ubuntu

So now you've installed Ubuntu, time to configure it.

To make things easier we'll install ssh server and set the IP to a static one so you'll always know where it is.

Having a static IP is handy if you have multiple services running on the one server. You'll always know where it is and can later set up an alias in your hosts file (http://en.wikipedia.org/wiki/Hosts_file). You could also later set up port forwarding to your torrent box so you can access the deluge web UI from the internet and manage your torrents remotely.

On the torrent box, start it up and log in.

First we'll set up a static IP

(From https://help.ubuntu.com/8.04/serverguide/C/network-configuration.html)

To configure your Ethernet device with a static IP address and custom configuration, some more information will be required. Suppose you want to assign the IP address 192.168.0.2 to the device eth1, with the typical netmask of 255.255.255.0. Your default gateway's IP address is 192.168.0.1. You would enter something like this into /etc/network/interfaces:

iface eth1 inet static
        address 192.168.0.2
        netmask 255.255.255.0
        gateway 192.168.0.1

In this case, you will need to specify your DNS servers manually in /etc/resolv.conf, which should look something like this:

nameserver 192.168.0.1
nameserver 4.2.2.2

To edit /etc/network/interfaces type this command

sudo nano /etc/network/interfaces

For example, this is my /etc/network/interfaces

# This file describes the network interfaces available on your system 
# and how to activate them. For more information, see interfaces(5). 

# The loopback network interface 
auto lo 
iface lo inet loopback 

# The primary network interface 
auto eth0 
iface eth0 inet static 
address 192.168.1.90 
netmask 255.255.255.0 
network 192.168.1.0 
broadcast 192.168.1.255 
gateway 192.168.1.1 

and my /etc/resolv.conf is

nameserver 203.24.100.125 
nameserver 192.168.1.1 

Now restart your network by typing into the terminal

sudo service networking restart

It should say [OK]. You can double check that it worked by typing

ifconfig

and seeing if the IP you set is the same as inet addr on the device.

eth0      Link encap:Ethernet  HWaddr ff:ff:ff:ff:ff:ff  
          inet addr:192.168.1.90  Bcast:192.168.1.255  Mask:255.255.255.0

Also check that you can access the internet by typing

ping google.com

SSH Server

Installing the SSH server is much easier. Type in this command

sudo apt-get update
sudo apt-get install openssh-server -y

Now ssh is installed you no longer need a keyboard or monitor attatched to your torrent box. You can connect to through the network now.

On Windows you can use PuTTY to connect to your torrent box.

Before we go onto installing anything else we should make sure ubuntu has the latest packages installed.

Run:

sudo apt-get upgrade

SAMBA Shares

So you can access your downloaded files we'll set up a samba share. This works best as you'll be able to access the files from Windows as well.

To install samba

sudo apt-get install samba -y

Once that is done we need to configure it.

I have my torrent box set up to have two folders shared

  • Partial Downloads
  • Completed

Make these folders in the home of the user that you're using for torrents.

mkdir ~/partial
mkdir ~/completed

Now edit /etc/samba/smb.conf so the shares are visible.

sudo nano /etc/samba/smb.conf

What we want to add are these lines under [global]

security = share
usershare allow guests = yes

Then at the bottom of the file add these lines

[Completed]

	path = /home/<your username>/completed
	read only = no
	guest ok = yes
	force user = <your username>

[Partial Download]

	path = /home/<your username>/partial
	read only = no
	guest ok = yes
	force user = <your username>

Change <your username> to what ever the user name is you've created the folders in. Don't forget that linux IS case sensitive. ToRRent is not the same as torrent.

Now anyone can create, delete and modify files in those directories. (I'm assuming you trust anyone accessing your share)

Configuring Deluge

Server Side(The torrent box)

Now on to Deluge. I use Deluge because it has some good features I like. It has a client/server architecture which allows you to have the server on a seperate computer and connect the GUI client side to it over the network. It also has the plugins I need, a blocklist (ala PeerGuardian) and a web UI.

To get the latest version of Deluge for Ubuntu

sudo add-apt-repository ppa:deluge-team/ppa

NB: If add-apt-repository does not work you can install it by running

sudo apt-get install python-software-properties

If everything goes okay you should get a message saying it has imported a key.

Once this is done, update apt-get so it knows Deluge is there and then install Deluge.

sudo apt-get update
sudo apt-get deluged deluge-web deluge-console

This will download the daemon, the web client and the console client.

Now we'll set Deluge up to auto-run the daemon and the web-ui

Follow this guide from Deluge themselves http://dev.deluge-torrent.org/wiki/UserGuide/InitScript/Ubuntu'>http://dev.deluge-torrent.org/wiki/UserGuide/InitScript/Ubuntu

(There's also guides for other distributions at http://dev.deluge-torrent.org/wiki/UserGuide/InitScript)

Client Side(Your desktop)

On the client side of things you'll want to install Deluge which you can get from http://dev.deluge-torrent.org/wiki/Download or if you're on Linux, your package manager(for Ubuntu all you need is deluge, deluge-common and deluge-gtk)

To connect to your deluge server follow these 10 simple steps:

1.Run deluge.

2.Go to "Preferences -> Interface" and untick "Enable" under "Classic Mode".

3.Restart deluge. You should now see a connection manager box pop up.

4.Remove the localhost daemon.

5.Click "Add" and enter your server's ip.

6.Leave the port as default.

7.Enter the username & password you added to the authentication file.

8.Click "Add" to add your server's daemon. You should now see a green tick as the status for the host you just added.

9.(Optional) Expand "Options" and select "Automatically connect to selected host on startup" and "Do not show this dialog on start-up".

10.Click "Connect" and the connection manager pop up box should disappear.

Congratulations! You can now access deluge on the server via the GTK UI.

(http://dev.deluge-torrent.org/wiki/UserGuide/ThinClient#ClientSetup)

You can know change any options on the server from the GUI.

To enable the blocklist and scheduler

1.Run deluge

2.Go to “Preferences -> Plugins” and tick the plugins you want

3.Click “Apply”

4.Go to “Preferences ->” <Plugin> and change the options

I find it's best to leave the blocklist URL as it already is as it works. If you want to use a different one you can.

The scheduler I have set so that it only downloads at night in my off-peak hours.

To get deluge to download to different directories

1. Run deluge

2. Go to "Preferences -> Downloads" and tick "Move completed torrents to:"

3. Change "Download to: to "/home/torrent/partial"

4. Change "Move completed torrents to:" to "/home/torrent/completed"

Web UI

To access the web UI of deluge open your browser and go to

http://&lt;serverIP&gt;:8112

You will be prompted with a password. The default is “deluge” (without the quotation marks).

I suggest you change this immediately to something else.

To do this

1.Preferences - > Interface

2.Change the password in the text fields provided

3.Click Change

Once you've done this check that the new password works by clicking Logout (top right) and then logging in with your new pasword.

RSS Downloader

As others have pointed out having your torrent slave automatically download torrents for you would truly make it a slave. The reason it wasn't in here originally was it didn't work for me the first time. The software couldn't download its required libraries, but now it can!

Thanks to gazpachoking on the deluge forums here is the RSS automation.

1. Log in to your torrent slave

2. Make sure the latest version of python is installed and the python utility "easy_install"

sudo apt-get install python python-setuptools

3. We now want to download the FlexGet "egg". The default python version of ubuntu 10.04 is 2.6 so we'll download that egg.

The link is current as of writing (14th june 2010)

 wget http://download.flexget.com/unstable/FlexGet-1.0r1283-py2.6.egg

4. Once FlexGet is downloaded we need to install it which is done with

sudo easy_install /path/to/FlexGet-1.0r1283-py2.6.egg

If you haven't moved directory you should be able to do

sudo easy_install ./FlexGet-1.0r1283-py2.6.egg

When it's installed check that it's working by running

flexget -V

which should produce output such as this

FlexGet 1.0r1283

5. Now it's installed we need to set up a config for FlexGet so it knows which shows we want it to download

make a directory in the home of the user that will be running FlexGet. If you follow my instructions it will be the user you're currently logged in as.

mkdir ~/.flexget

To create the config:

 nano ~/.flexget/config.yml

The indentation for this is very precise. DO NOT use tabs, USE SPACES

The layout for a simple RSS of TV shows would go something like this

feeds:
  feed_name:
    rss: www.examplefeed.com/feed/
    series:
      normal:
        - TV Show
        - Another Show
      720p:
        - Example Show
    deluge: yes

Each "indentation" is two spaces

feed_name can be changed to what ever you want. It can't have spaces in it, so use _ or -. eg tv-show, tv_shows

rss is the rss feed you want FlexGet to check

normal is the quality of video you want. This will select your usual 350MB/hour HDTV rips

720p will select 720p rips of the shows. FlexGet will only download Example Show episodes that are 720p, it won't fall back to a normal rip.

deluge means that it will automatically add the torrent to deluge for you, which makes it all nice and easy.

Same example with the number of spaces that precede the first character

feeds: 0
  feed_name: 2
    rss: www.examplefeed.com/feed/ 4
    series: 4
      normal: 6
        - TV Show 8
        - Another Show 8
      720p: 6
        - Example Show 8
    deluge: yes 4

Check your config.yml by running

flexget --check

Expected output would be this for my config

2010-06-14 22:36 INFO     deluge                        Using deluge 1.2 api
Feed 'feed_name' passed

FlexGet will only check the feed when run, so we need to set up a cron job to automatically run the command for us.

To do this edit the crontab by running

crontab -e

It will make a new crontab for your user and run all the commands set up as your user.

cron can look confusing, so here's some help from wikipedia explaining it

.---------------- minute (0 - 59) 
|   .------------- hour (0 - 23)
|   |   .---------- day of month (1 - 31)
|   |   |   .------- month (1 - 12) OR jan,feb,mar,apr ... 
|   |   |   |  .----- day of week (0 - 7) (Sunday=0 or 7)  OR sun,mon,tue,wed,thu,fri,sat 
|   |   |   |  |
*   *   *   *  *  command to be executed

There's also some shortcuts instead of defining a time

@yearly 	Run once a year 
@annually 	(same as @yearly)
@monthly 	Run once a month 
@weekly 	Run once a week 
@daily 	Run once a day
@midnight 	(same as @daily) 
@hourly 	Run once an hour

so instead of the * * * * * format you would replace it with one of the above.

So choose a time you want to check the RSS feed. If it's a busy one you might want to use @hourly, but I wouldn't recommend going more often than that as the feed owner might ban you for checking too often.

An example of hourly would be

@hourly /usr/local/bin/flexget --cron

So go in and add a line at the end of the crontab to set when you want FlexGet to check for new torrents. Mine is set to check at 8pm (2000 hours) every day.

0 20 * * * /usr/local/bin/flexget --cron

Now your torrent box should really be a torrent slave

If you would like to do more, see the FlexGet Cookbook

The End

So everything should have gone as planned. If it has you now have a low-powered machine that will download torrents for you in your off-peak hours and store them on the network for you.

You can easily add more functionality to your machine if you wished. Linux is limitless.

I've got Mediatomb installed which is a UPnP streamer. It's handy for when I want to watch something on my PS3 that I've downloaded and don't want to turn on my main computer to access the video. Sadly I haven't been able to get mkvs working properly. However I have found a script that will remux mkvs into a playable format. It can be found at http://mediatomb.equateuk.com/scripts/mkv2m2ts/mkv2m2ts.sh

Useful Links:

Overview of various Pineview motherboards in relation to Linux

Mediatomb UPnP media server

Webmin web management to make administration of your system easier

Questions, complaints, bugs, advice?

Edit: Added justification for static IP

Added web UI instructions. Thanks for pointing that out boogerjones

Added instructions for RSS download using FlexGet

Added how to set the download completed torrents and partial torrents

Added note for if add-apt-repository is not installed

Link to comment
Share on other sites

Nice guide. Easy to follow.

1) The only thing that wasn't clear to me was how to connect to Deluge. If the purpose is to create a machine dedicated for torrents, then I think you should demonstrate how to access the WebUI on that machine rather than from a separate Deluge client on another machine that connects to the slave. I think people might read this tutorial and try to install Deluge on their server.

2) I think the static IP assignment will confuse uninitiated users. Although you're arguing that a local IP should be static, I'd access the torrent slave machine through a DNS name rather than a vanilla IP address anyway, in which case DHCP would be fine. Furthermore, many routers (including all those running DD-WRT or Tomato) allow DHCP to return static IP assignment based on MAC address, though that's out of the scope of your tutorial. Maybe just explaining why it's preferred would be good (primarily for port-forwarding purposes, I assume).

3) I'd have a hard time justifying the server edition of Ubuntu unless I was really tight on RAM for the torrent slave. Although the desktop edition doesn't eliminate the need for the command line, I still find the terminal somewhat cumbersome even after becoming sufficiently accustomed to it, especially when it comes to Samba and file permissions/deletion/movement. Furthermore, the desktop edition includes Transmission, which also has a nice web interface. However, for the limited purpose of your target machine, I can see why the server edition would be fine.

Link to comment
Share on other sites

I did something like this recently but I chucked windows xp on it and used UTorrent for a web front end

Up and running in under an hour, lovely :)

Used a low power consumption Atom as well, but I went windows XP so I could get it to do other stuff as well by using rdp as I'm not particularly handy with linux, maybe I will set up another machine and follow your guide here. Should be an interesting experience for me. Nice guide, thanks :)

Link to comment
Share on other sites

Nice guide. Easy to follow.

1) The only thing that wasn't clear to me was how to connect to Deluge. If the purpose is to create a machine dedicated for torrents, then I think you should demonstrate how to access the WebUI on that machine rather than from a separate Deluge client on another machine that connects to the slave. I think people might read this tutorial and try to install Deluge on their server.

2) I think the static IP assignment will confuse uninitiated users. Although you're arguing that a local IP should be static, I'd access the torrent slave machine through a DNS name rather than a vanilla IP address anyway, in which case DHCP would be fine. Furthermore, many routers (including all those running DD-WRT or Tomato) allow DHCP to return static IP assignment based on MAC address, though that's out of the scope of your tutorial. Maybe just explaining why it's preferred would be good (primarily for port-forwarding purposes, I assume).

3) I'd have a hard time justifying the server edition of Ubuntu unless I was really tight on RAM for the torrent slave. Although the desktop edition doesn't eliminate the need for the command line, I still find the terminal somewhat cumbersome even after becoming sufficiently accustomed to it, especially when it comes to Samba and file permissions/deletion/movement. Furthermore, the desktop edition includes Transmission, which also has a nice web interface. However, for the limited purpose of your target machine, I can see why the server edition would be fine.

Thanks.

I've put in the instructions on the web ui. It had slipped my mind by that point of writing the guide.

I used the server edition because I don't need any of the desktop features. Less stuff to keep up to date and it's not needed on a headless machine. Once it's running there's almost no need to use the terminal any more. One thing I was considering was putting in using webmin for system administration so there's a nice GUI approach to keeping the machine up to date.

Link to comment
Share on other sites

+ rep, very nice guide you have created there.

If you are looking to expand the guide more you could add instructions on how to RSS download your favorite TV shows automatically, it really would be a "torrent slave" then... well if your in to TV shows anyway :)

Its nice to come home and have your TV shows ready to watch without needing to do anything.

Link to comment
Share on other sites

To let everyone know I've added RSS automation in there. I didn't have it working at the time I first wrote the guide, but it does now.

There's also some useful links at the end for more software you could use and a list of over Pineview motherboards that should be good for linux use.

Link to comment
Share on other sites

  • 3 weeks later...

for some reason on my ubuntu server box, i cant run the command

sudo add-apt-repository ppa:deluge-team/ppa

i get sudo: add-apt-repository: command not found

my ubuntu box is 10.04 server

Link to comment
Share on other sites

for some reason on my ubuntu server box, i cant run the command

sudo add-apt-repository ppa:deluge-team/ppa

i get sudo: add-apt-repository: command not found

my ubuntu box is 10.04 server

I just checked on my box, it's not there anymore. You can install it by installing python-software-properties

# add-apt-repository
The program 'add-apt-repository' is currently not installed.  You can install it by typing:
apt-get install python-software-properties

Link to comment
Share on other sites

  • 3 years later...

Great guide.

The OP stated he picked Ubuntu server for the update life cycle. A torrent slave is meant to stay on and connected to the internet 24/7, so using an end-of-cycle OS like XP or some other OS that is likely to stop receiving security updates is a bad idea.

My torrent slave runs on a virtual instance of 2008 R2, i have uTorrent running as a service and a nice add-on in chrome that sends torrent links right to the slave from my workstation. The system automatically restarts after updates. It's a set it and forget it setup.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.