GOAL: Use a Raspberry PI as a NAS Seed Box (Network Attached Storage running torrent software). RPi 2 is perfect for this due to running at very low electrical low power and being faster than a Fast Ethernet bottleneck. I initially bought a RPi version 1B which I returned as it couldn’t send files over a wired LAN at 10MB per second (basically the bottleneck for Fast Ethernet (100mbps)). Also I can use a thin client for torrenting on my PC with Deluge rather than just a webUI.
- RPi version 2B running Ubuntu (yay linux).
- USB Drive formatted in NTFS.
- Installed Samba (windows file sharing).
- Installed Deluge torrent software with a web interface (deluge also supports a remote thin client 🙂 ).
Using a HDMI monitor and keyboard:
- Install Ubuntu for RPi v 2B (not Snappy Ubuntu Core which doesn’t support apt-get), instructions for putting a system image on an SD card are here. Note again we aren’t using the image on the RPi site but rather the one on the Ubuntu Wiki.
- Follow the first instruction at the above Ubuntu link to resize the SD card partition. The only other instruction on that page I followed was install a SSH server, since I am not installing any GUI stuff on my PI.
- I set a Static IP for my RPi since I don’t want a random DHCP address from my internet router and I can’t reserve an IP on my router. At the RPi Ubuntu terminal screen, open the nano text editor to the network settings file with this command:
sudo nano /etc/network/interfaces
I commented out the current DHCP settings:
#iface eth0 inet dhcp
and put in a static address with openDNS as the DNS:
iface eth0 inet static address 192.168.1.38 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 188.8.131.52
Then I exited nano with Ctrl X, press Y to save current modifications, enter to confirm file name. I usually reopen the file just to check it looks how I wanted (the up arrow retypes the previous command in the terminal window).
- Then I changed the RPi hostname (which is accessible from the windows folder address bar):
sudo nano /etc/hostname
From here I shutdown the RPi (sudo shutdown -h now) and accessed it over the network using SSH (which I installed in step 2). I use MobaXtem for SSH which also brings up a file browser:
- I changed my locale:
shows available locales installed, I used:
sudo update-locale LANG=en_AU.utf8 LC_MESSAGES=POSIX
- Now I mounted my USB drive:
-Use this command to show drive IDs:
-Copy the UUID for the USB Drive (note that Ctrl C isn’t copy in the terminal)
-Create a mount point for the USB drive:
sudo mkdir /media/Data
Before editing /etc/fstab directly, it is a good idea to make a backup. From a terminal:
sudo cp /etc/fstab /etc/fstab.orig
sudo nano /etc/fstab
and I added a line for my NTFS USB drive:
UUID=NUMBERSNSTUFF /media/Data ntfs-3g uid=ubuntu,gid=ubuntu,umask=000 0 0Those settings didn't work for my next ftp project :/... these worked...
I set options uid=ubuntu,gid=ubuntu,umask=000 so that samba could access the drive as well as deluge torrent client.
- Install Samba:
sudo apt-get update sudo apt-get upgrade sudo apt-get install samba
Duplicate original samba settings:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
Add Samba user:
useradd getdeep --shell /bin/false
Add user password:
smbpasswd -a getdeep
change samba config file using nano text editor:
sudo nano /etc/samba/smb.conf
Added under authentication:
security = user encrypt passwords = yes
#commented out printer stuff,
added to bottom:
[Data] path = /media/Data available = yes valid users = getdeep read only = no browseable = no public = no writable = yes
- Install Deluge (from here)
sudo add-apt-repository ppa:deluge-team/ppa sudo apt-get update sudo apt-get install deluged deluge-webui sudo nano
Enter this in nano:
start on (filesystem and networking) or runlevel  stop on runlevel  env uid=ubuntu env gid=ubuntu env umask=022 exec start-stop-daemon -S -c $uid:$gid -k $umask -x /usr/bin/deluged -- -d
Ctrl + X to exit
Y to save
/etc/init/deluge.conf as file name
same again for webUI:
start on started deluge stop on stopping deluge env uid=ubuntu env gid=ubuntu env umask=027 exec start-stop-daemon -S -c $uid:$gid -k $umask -x /usr/bin/deluge-web
Ctrl + X to exit
Y to save
/etc/init/deluge-web.conf as file name
sudo start deluge-web
- Access Deluge from web interface at http://localhost:8112 where localhost is RPI IP. Also Deluge daemon will be running on port 58846, so you can configure a remote computer on the LAN to connect with a thin client.
- SSL can be enabled to avoid the login details being man-in-the-middle attacked. For me this was a major pain in the ass. You need A. to enable SSL and B. to import your SSL Certificates…
A. Edit /etc/init/deluge-web.conf to have ‘–ssl’ at the end, like this
exec start-stop-daemon -S -c $uid:$gid -k $umask -x /usr/bin/deluge-web --ssl
This will force SSL for the web ui.
Possibly you will need to modify the users deluge conf files, for me there are some here: /home/ubuntu/.config/deluge/ specifically web.conf and web_plugin.conf
I found that the preference settings in the web ui didnt do much.
- Now put your public and private keys in the right place. For me that is /home/ubuntu/.config/deluge/ssl/
I renamed my certs to the existing certs, daemon.cert, deamon.pkey
- Holy crap it worked.