Previously we have configured basic NAS storage on Raspberry Pi. Having such power and doing nothing with storage is a waste. To prove its usefulness Next logical step is to implement torrent client on this machine. The benefit is obvious, you have NAS server which his always available and also torrent client which downloads/seeds files without need power hungry PC.
You can find many torrent clients that can be used in Raspberry Pi, but it seems that lots of people prefer Deluge which has plenty of features and requires small memory to run. Deluge is great in its flexibility – the ability to run on desktop, through web interface and through ThinClient. The other popular packet is Transmission, which is also lightweight and has great WebUI. Transmission is able to handle magnet links from web interface. And it seems it is easier to configure. So we are going to stick with Transmission.
Before we start it’s good habit to update Raspbian with following commands:
sudo apt-get update sudo apt-get upgrade
Setting up Transmission on Raspberry Pi
Before we begin configuring torrent client we need to create two directories in our drive. One directory will be for downloads in progress [inprogress] and another for completed [complete]. Both directories we are going to include in torrents folder as follows:
sudo mkdir -p /mnt/16GBdrive/torrents/inprogress sudo mkdir -p /mnt/16GBdrive/torrents/complete
First of all we download and setup transmission package:
sudo apt-get install transmission-daemon
Then we make sure transmission daemon is stopped with command:
sudo /etc/init.d/transmission-daemon stop
Then we can start messing with its settings. As always it is good idea to make a backup of settings file with simple copy command so we could always to revert to default:
sudo cp /etc/transmission-daemon/settings.json /etc/transmission-daemon/settings.json.bak
Open settings.json file with nano editor:
sudo nano /etc/transmission-daemon/settings.json
Here yo need to change few settings:
"rpc-authentication-required": false, "incomplete-dir-enabled": false, "incomplete-dir": "/mnt/16GBdrive/torrents/inprogress", "download-dir": "/mnt/16GBdrive/torrents/complete",
Save file with CTRL+O and exit with CTRL+X.
Since we have changed the download directories we need to set up proper permissions. For this we need to edit:
sudo nano /etc/init.d/transmission-daemon
and change user to pi (you can use different non default user for better security):
Further we need to change some permissions as follows:
sudo usermod -a -G debian-transmission pi sudo chgrp debian-transmission /mnt/16GBdrive/torrents/inprogress sudo chgrp debian-transmission /mnt/16GBdrive/torrents/complete sudo chmod 777 /mnt/16GBdrive/torrents/inprogress sudo chmod 777 /mnt/16GBdrive/torrents/complete
Then you need to reload transmission service in order to save changes:
sudo service transmission-daemon reload
Then we can start transmission service:
sudo service transmission-daemon start
After this you should be able to access torrent client via web interface by entering address:
http://your_pi_ip:9091 e.g. http://192.168.1.11:9091
By clicking on folder icon you can add your torrent to download queue.
If you are getting permission error on download, you should automount your NTFS drive with 777 permision (only this trick seemed to work for me)
Go to your fstab file
sudo nano /etc/fstab
and edit your drive mount line as follows:
/dev/sda1 /mnt/16GBdrive auto nofail,uid=pi,gid=pi,umask=002,noatime 0 0
Restart raspberry pi and start transmission daemon again – your downloads should save now.
Last thing to take care is to load transmission-service on boot with the command:
sudo update-rc.d transmission-daemon defaults