3

I apologize in advance for the somewhat generic nature of this questions, but I am new to using my Pi.

I had a thought recently of how I would like to serve up some of my own files as .torrents and would REALLY like to be able to do this from a Pi.

This is, in a way, a 2-part question.

  1. Can this be done at all? Can the Pi even handle this type of load?
  2. Do I need to do anything special to make the torrent server read files from an external USB drive?

If I am missing something, please leave a comment and I will try to clarify on what I am trying to accomplish. Thanks in advance for your help on this.

5

Please before you start commenting about breaking the law etc etc notice that there are many freeware programs out there which you can download and share freely.

Also, I would have posted more links for the software you need to do this, but I do not have enough reputation

First of all these are the things you need to start your project

  1. Your Raspberry Pi
  2. A USB HUB with power
  3. A USB hard disk

...and a keyboard to start with

Now we have to go to our windows computer to format our USB Disk and prepare the SD Card. I prefer this free Mini tool Partition Wizard. You can get it from here http://download.cnet.com/MiniTool-Partition-Wizard-Home-Edition/3000-2094_4-10962200.html

To prepare the SD Card. To do that you need a program called Win32DiskImager Extract the exe an install it.

Then we have to download the Raspberry Pi distribution. I use the latest distribution from Pi’s official site. The image I use is the 2013-05-25-wheezy-raspbian.

Extract the image file and start Win32DiskImager, Select your downloaded image, you SDCard device and press Write. Wait until the image is ready. Now we are ready to start.

Put the SDCard to your Pi and put the power cable in. In this step you need to have a keyboard connected to your Pi and a monitor to see what’s heppening.

Now you are ready to start. First of all you have to setup your device to run the raspbian. Also as you will use the Pi for torrenting you don’t need the GUI.

Finish all the proper adjustments and press finish.

Your device will restart and you have to log in. The defaults are

USER:pi 
PASSWORD:raspberry

If you have changed your password use the new password.

You are now logged in. Write down the IP address of your device so you can connect to it later, It is something like 192.168.1.24.

Key in

sudo shutdown –h now

and wait for the device to shut down. At this point you can remove the keyboard and the monitor and connect the HDD and the HUB as above. Start the Pi and leave it there.

You can go now to back to your Windows computer. I use PuTTY to connect via SSH on Windows. It is freeware and you can download it online.

Run putty and write the address of your pi (in my case it is 192.168.1.24) Log in the Pi using pi as user and your password

I have renamed my device as mypi the default name is raspberrypi And now it is time to start. What I usually do is that I shutdown the pi and put the SD card back into the computer. I start Win32DiskImager and save my work to an image file (you can give to it any name) so if (better is when) I make a mistake I will not lose all my work. If you press read the program copies the SD Card to an image file which you can write back

Now we are back logged in the pi.

TIP If you don’t like typing you can copy the text from windows and paste it to putty with a right click

First of all we need to update raspbian

sudo apt-get update

Wait until the update is finished. The next thing is to get rid of all the unnecessary GUI content

sudo apt-get purge libx11-6 libgtk-3-common xkb-data lxde-icon-theme raspberrypiartwork
penguinspuzzle

[TIP] If you make a typing mistake you can press the UP ARROW and edit your command

sudo apt-get autoremove

Next we must make our pi to have all times the same network address (static). For this we must use a text editor names nano to edit the file /etc/network/interfaces.

sudo nano /etc/network/interfaces

We replace all the content of the file:

auto eth0
iface eth0 inet static
address 192.168.1.24
netmask 255.255.255.0
gateway 192.168.1.1

We do this when we are plugged into a wired network and we don’t use a wireless, else we leave wlan0 in place.

To write the content of the file to the SD we press Control-O [^O] and then ENTER. To exit nano [^X] (control and X simultaneously).

In the address you can put at the fourth number any number between 2 and 255 but I prefer to use the address it was automatically assigned.

The gateway is usually 192.168.1.1. In my case it is 192.168.1.2 because of the router I use.

In some cases might be 192.168.0.1 because the network address of the DHCP server (usually the router).

The gateway address is the address of your router which is connected to the internet.

If you change the address you better restart the pi.

If you want to have access from the internet, you should get an address from http://www.noip. org or any other provider. You'll also need to forward your external IP to your Pi's IP address on your LAN. It depends on your router. Usually there's NAT, or Virtual server or Port forward. Use port 80.

If you haven't yet changed the default password, do the following:

sudo passwd

Now it’s time to see our partion table

cat /proc/partitions

For me, the disk is sda1. We need to instruct Pi to mount our Disk at the same position

sudo mkdir /media/USBDisk

Before we can mount the drives, we need to create a directory to mount the drives to.

sudo mount -t auto /dev/sda1 /media/USBDisk

*Note that in LINUX words are case sensitive. USBDisk is not the same as usbdisk

sudo mkdir /media/USBDisk/shares
sudo mkdir /media/USBDisk/shares/downloading
sudo mkdir /media/USBDisk/shares/completed
sudo nano /etc/fstab

We add the /dev/sda1 line and save it NOW it’s time to install the torrent client, transmission,

sudo apt-get install transmission-daemon

Now to configure permissions:

sudo usermod -a -G debian-transmission pi
sudo chgrp debian-transmission /media/USBDisk/shares/downloading
sudo chgrp debian-transmission /media/ USBDisk/shares/completed
sudo chmod 770 /media/USBDisk/shares/downloading
sudo chmod 777 /media/ USBDisk/shares/completed

If you want you can change the 770 to 777 to have full control on it, go ahead.

Reload the transmission

sudo service transmission-daemon reload

Edit transmission settings.json file

sudo nano /etc/transmission-daemon/settings.json

The content of the file is here. Marked are the lines we must edit

{
"alt-speed-down": 50,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 50,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 4,
"dht-enabled": false,
"download-dir": "/media/data/complete",
"download-limit": 100,
"download-limit-enabled": 0,
"download-queue-enabled": true,
"download-queue-size": 5,
"encryption": 1,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/media/data/incomplete",
"incomplete-dir-enabled": true,
"lpd-enabled": false,
"max-peers-global": 200,
"message-level": 2,
"peer-congestion-algorithm": "",
"peer-limit-global": 91,
"peer-limit-per-torrent": 150,
"peer-port": 51413,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": "default",
"pex-enabled": false,
"port-forwarding-enabled": true,
"preallocation": 1,
"prefetch-enabled": 1,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 30,
"ratio-limit": 2,
"ratio-limit-enabled": false,
"rename-partial-files": true,
"rpc-authentication-required": true,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "{2dc2c41724aab07ccc301e97f56360cb35f8ba1fGVVrdHDX",
"rpc-port": 9091,
"rpc-url": "/transmission/",
"rpc-username": "transmission",
"rpc-whitelist": "*.*.*.*",
"rpc-whitelist-enabled": false,
"scrape-paused-torrents-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",
"seed-queue-enabled": false,
"seed-queue-size": 10,
"speed-limit-down": 250,
"speed-limit-down-enabled": true,
"speed-limit-up": 0,
"speed-limit-up-enabled": true,
"start-added-torrents": true,
"trash-original-torrent-files": false,
"umask": 18,
"upload-limit": 100,
"upload-limit-enabled": 0,
"upload-slots-per-torrent": 14,
"utp-enabled": true
}
"download-dir": "/media/data/complete",
Becomes
"download-dir": "/media/USBDisk/shares/completed",
"incomplete-dir": "/media/data/incomplete",
"incomplete-dir": "/media/USBDisk/shares/downloading",
"rpc-username": "transmission",
"rpc-username": "myname",

I changed the username because it’s easier to remember. You are not obliged to do that if you don’t want to. Cross your fingers and open your browser.

now install SAMBA

sudo apt-get install samba samba-common-bin

Open the configuration file

sudo nano /etc/samba/smb.conf

At the end of the file add the following lines

[Torrentbox]
comment = Public Shares
path = /media/USBDisk/shares/completed
writeable = Yes
only guest = Yes
create mask = 0777
directory mask = 0777
browseable = Yes
public = yes
Restart SAMBA
sudo service samba restart

THAT’S IT
YOU CAN NOW ACCESS YOUR FILES FROM WINDOWS EXPLORER

If you want to access transmission from your android phone you can install Remote Transmission. Hope I helped

ADDED BONUS

If you want to have access to your files from outside you have to install an ftp server. This is how we can do it. Install the ftp program

sudo apt-get install vsftpd

Uncomment (that means delete the # before) the following lines

local_enable=YES
write_enable=YES

Restart the service and you are done

sudo service vsftpd restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.