{"id":574,"date":"2012-08-16T17:43:40","date_gmt":"2012-08-16T17:43:40","guid":{"rendered":"http:\/\/naich.net\/wordpress\/?p=574"},"modified":"2012-09-03T11:42:10","modified_gmt":"2012-09-03T11:42:10","slug":"wibble-teapot","status":"publish","type":"post","link":"https:\/\/naich.net\/wordpress\/index.php\/wibble-teapot\/","title":{"rendered":"Torrents of Pi"},"content":{"rendered":"<p><a title=\"Keeping it up to date (given up with the Pi puns)\" href=\"http:\/\/naich.net\/wordpress\/?p=563\">Continued from here<\/a><\/p>\n<p><a title=\"Yummy Pi\" href=\"http:\/\/naich.net\/wordpress\/?p=435\">First page here<\/a><\/p>\n<h3>8.\u00c2\u00a0 Installing a Bittorrent Client<\/h3>\n<p>I don&#8217;t know about you, but I want to install a <a href=\"http:\/\/en.wikipedia.org\/wiki\/BitTorrent\">Bittorrent<\/a> client on your Pi, and I&#8217;ll tell you why.\u00c2\u00a0 If your PC uses a wireless router and you use Bittorrent, you will probably find that the Bittorrent traffic over your network utterly clobbers your PC&#8217;s connection, making the internet virtually unusable.\u00c2\u00a0 You also have to leave your PC on overnight when downloading large files, like Linux distributions or the many legal video torrents that exist.\u00c2\u00a0 Furthermore, once your torrent has finished, you have to leave the bandwidth-hogging Bittorrent program running in order to get any sort of honourable ratio.<\/p>\n<p>Running a Bittorrent client on your Pi, plugged directly into the router, solves all these problems.\u00c2\u00a0 In fact, the whole setup is so unobtrusive that I&#8217;ve occasionally forgotten I&#8217;ve been seeding something and discovered I&#8217;ve worked up an enormous ratio.\u00c2\u00a0 Fnar fnar.\u00c2\u00a0 Sorry.\u00c2\u00a0 It also allows something else &#8211; you can log into your bittorrent client from any PC, even from outside your home network.\u00c2\u00a0 Say you are at work, browsing around at lunchtime, when you remember there is a perfectly legal film you want to watch this evening. \u00c2\u00a0Logging in from your work&#8217;s PC, you can tell your Pi to start downloading it and by the time you get home, your film will be waiting for you.<\/p>\n<p>So let&#8217;s find a Bittorrent client to install.\u00c2\u00a0 Shall we fire up Google?\u00c2\u00a0 No.\u00c2\u00a0 We don&#8217;t need to do that.\u00c2\u00a0 We can search the repository for Bittorrent clients using the &#8220;apt-cache&#8221; command like this: <strong><tt>apt-cache search bittorrent client<\/tt><\/strong>.\u00c2\u00a0 Note that you don&#8217;t need to sudo it because you aren&#8217;t installing anything yet.\u00c2\u00a0 The &#8220;apt-cache search&#8221; bit searches for whatever you put after it.<\/p>\n<blockquote>\n<pre>naich@raspberrypi ~ $ apt-cache search bittorrent client\r\napt-transport-debtorrent - an APT transport for communicating with DebTorrent\r\naria2 - High speed download utility\r\nazureus - BitTorrent client\r\n... loads and loads and loads ...\r\ntransmission - lightweight BitTorrent client\r\ntransmission-cli - lightweight BitTorrent client (command line programs)\r\ntransmission-common - lightweight BitTorrent client (common files)\r\ntransmission-daemon - lightweight BitTorrent client (daemon)\r\ntransmission-dbg - lightweight BitTorrent client (debug symbols)\r\ntransmission-gtk - lightweight BitTorrent client (GTK interface)\r\ntransmission-qt - lightweight BitTorrent client (Qt interface)\r\nunworkable - efficient, simple and secure bittorrent client\r\nvuze - Multimedia BitTorrent client\r\nnaich@raspberrypi ~ $<\/pre>\n<\/blockquote>\n<p>Spoiled for choice, aren&#8217;t we?\u00c2\u00a0 What we want is one that will happily do its own thing without any input from a human and doesn&#8217;t need a GUI.\u00c2\u00a0 In Linux, a program that runs in the background without requiring human interaction is called a &#8220;daemon&#8221;.\u00c2\u00a0 If you take a look at the list, two packages fit the bill &#8211; &#8220;deluged&#8221; and &#8220;transmission-daemon&#8221;.\u00c2\u00a0 We&#8217;ll use the latter.\u00c2\u00a0 Let&#8217;s download it, install it, set it up, and run it with 4 words: <strong><tt>sudo apt-get install transmission-daemon<\/tt><\/strong>.<\/p>\n<blockquote>\n<pre>naich@raspberrypi ~ $ sudo apt-get install transmission-daemon\r\nReading package lists... Done\r\nBuilding dependency tree \r\nReading state information... Done\r\nThe following extra packages will be installed:\r\n libcurl3-gnutls libminiupnpc5 libnatpmp1 minissdpd transmission-cli\r\n transmission-common\r\nSuggested packages:\r\n natpmp-utils transmission-gtk\r\nThe following NEW packages will be installed:\r\n libcurl3-gnutls libminiupnpc5 libnatpmp1 minissdpd transmission-cli\r\n transmission-common transmission-daemon\r\n0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.\r\nNeed to get 1,905 kB of archives.\r\nAfter this operation, 4,173 kB of additional disk space will be used.\r\nDo you want to continue [Y\/n]?<\/pre>\n<\/blockquote>\n<p>Do you see all those dependencies that will be installed as well?\u00c2\u00a0 Apt is also suggesting other packages that aren&#8217;t needed but might be useful.\u00c2\u00a0 You want to continue.\u00c2\u00a0 Things going up the screen&#8230;\u00c2\u00a0 Done yet?\u00c2\u00a0 Did you notice this line?<\/p>\n<blockquote>\n<pre>[ ok ] Starting bittorrent daemon: transmission-daemon.<\/pre>\n<\/blockquote>\n<p>You are now running your bittorrent client.\u00c2\u00a0 It will automatically start up every time your Pi starts, so you don&#8217;t even have to remember to restart it when you reboot.\u00c2\u00a0 Isn&#8217;t that nice?\u00c2\u00a0 Come on &#8211; that is pretty cool isn&#8217;t it?<\/p>\n<p>So let&#8217;s use it.\u00c2\u00a0 Transmission comes with a built in web server to use as an interface.\u00c2\u00a0 You use it by putting this into your browser: &#8220;http:\/\/your_pi&#8217;s_ip_address:9091&#8243;\u00c2\u00a0 &#8211; that&#8217;s a colon and 9091 after the address, no slashes.\u00c2\u00a0 You should see this:<\/p>\n<h1>403: Forbidden<\/h1>\n<p>Unauthorized IP Address.<br \/>\nEither disable the IP address whitelist or add your address to it.<br \/>\nIf you&#8217;re editing settings.json, see the &#8216;rpc-whitelist&#8217; and &#8216;rpc-whitelist-enabled&#8217; entries.<br \/>\nIf you&#8217;re still using ACLs, use a whitelist instead. See the transmission-daemon manpage for details.<\/p>\n<p>This is correct.\u00c2\u00a0 As a general rule, installed packages will be set up in a safe way, so that nasty people (including you) can&#8217;t use it.\u00c2\u00a0 You will need to edit the configuration file to relax its security enough that you can use it.\u00c2\u00a0 Full instructions on how to do it are here: <a href=\"https:\/\/trac.transmissionbt.com\/wiki\/EditConfigFiles\">https:\/\/trac.transmissionbt.com\/wiki\/EditConfigFiles<\/a>\u00c2\u00a0 but let&#8217;s just get it going quickly for now.\u00c2\u00a0 Transmission is a bit unusual in that it overwrites its configuration files when it exits.\u00c2\u00a0 This isn&#8217;t normal and caused me much confusion for a while because I&#8217;d edit the configuration, restart Transmission and it wouldn&#8217;t work because all my changes were overwritten.\u00c2\u00a0 So let&#8217;s stop Transmission before we edit the file with <strong><tt>sudo service transmission-daemon stop<\/tt><\/strong>:<\/p>\n<blockquote>\n<pre>naich@raspberrypi ~ $ sudo service transmission-daemon stop\r\n[ ok ] Stopping bittorrent daemon: transmission-daemon.\r\nnaich@raspberrypi ~ $<\/pre>\n<\/blockquote>\n<p>You can probably work out what is going on there.\u00c2\u00a0 Now edit the configuration file.\u00c2\u00a0 It&#8217;s in the &#8220;\/etc&#8221; directory, (along with all the other configuration files), in its own directory.\u00c2\u00a0 If you want to find a configuration file for a daemon, look in &#8220;\/etc&#8221; &#8211; it&#8217;ll be there, either in its own directory or as a file.\u00c2\u00a0 Type <strong><tt>sudo nano \/etc\/transmission-daemon\/settings.json<\/tt><\/strong>:<\/p>\n<blockquote>\n<pre>naich@raspberrypi ~ $ sudo nano \/etc\/transmission-daemon\/settings.json<\/pre>\n<\/blockquote>\n<p>Now, move the cursor down until you find this part (without the numbers):<\/p>\n<blockquote>\n<pre>1 \"rpc-authentication-required\": true,\r\n  \"rpc-bind-address\": \"0.0.0.0\",\r\n  \"rpc-enabled\": true,\r\n2 \"rpc-password\": \"{1669ab9b7fdadc2a8a910abf75a60f6c584365e6oRs3weiW\",\r\n  \"rpc-port\": 9091,\r\n  \"rpc-url\": \"\/transmission\/\",\r\n3 \"rpc-username\": \"transmission\",\r\n4 \"rpc-whitelist\": \"127.0.0.1\",\r\n5 \"rpc-whitelist-enabled\": true,<\/pre>\n<\/blockquote>\n<p>&#8220;rpc&#8221; means &#8220;Remote Procedure Call&#8221; and refers to the web server. \u00c2\u00a0Seems a bit odd to call it this as RPCs are generally from computers rather than humans, but what do I know? \u00c2\u00a0 When you make changes, make sure you preserve the punctuation: the quotes, colons and commas all need to be in their correct places. \u00c2\u00a0Going through the numbers, leave the unmarked lines alone and change these ones to suit your preferred method of access:<\/p>\n<ol>\n<li>If this is &#8220;true&#8221; (note that there are no quotes round the word in the config file) then you will be asked for a username and password before you can use the web pages.<\/li>\n<li>This is the password you log in with if 1. is set to &#8220;true&#8221;. \u00c2\u00a0The default is an impossible-to-guess huge random string.<\/li>\n<li>The username you log in with if 1. is set to &#8220;true&#8221;.\u00c2\u00a0 Default is &#8220;transmission&#8221; and you should change it if you plan to use a username\/password &#8211; default usernames are bad.<\/li>\n<li>The comma-separated list of IP addresses that are allowed to use the web page. \u00c2\u00a0A &#8220;*&#8221; means any number. \u00c2\u00a0If your home network has addresses that all start &#8220;192.168&#8230;&#8221; then you could make this string &#8220;127.0.0.1,192.168.*.*&#8221; to make sure that only people in your home network can log in. \u00c2\u00a0Leave the &#8220;127.0.0.1&#8221; in there, as this refers to the Pi itself.<\/li>\n<li>If you set this to &#8220;false&#8221; then 4 is ignored and anyone can connect from any PC.<\/li>\n<\/ol>\n<p>I&#8217;d recommend either:<\/p>\n<ul>\n<li>Set 1 to &#8220;false&#8221;, 5 to &#8220;true&#8221; and make sure that any PC you will access it from is included in the list at 4 or<\/li>\n<li>Set 1 to &#8220;true&#8221;, set the name\/password in 2\/3 and set 5. to &#8220;false&#8221;<\/li>\n<\/ul>\n<p>The first one doesn&#8217;t require a password, but you will be restricted to logging in from only the PCs whose IP numbers are specifically set in 4. \u00c2\u00a0The second allows you to access it from any PC in the world (make sure you set your router&#8217;s port forwarding so connections to port 9091 are sent to your Pi&#8217;s IP), but you need to have a username\/password to stop any Tom, Richard or Harry using it.<\/p>\n<p>Then start it up again with \u00c2\u00a0<strong><tt>sudo service transmission-daemon start<\/tt><\/strong>:<\/p>\n<blockquote>\n<pre>naich@raspberrypi ~ $ sudo service transmission-daemon start\r\n[ ok ] Starting bittorrent daemon: transmission-daemon.\r\nnaich@raspberrypi ~ $<\/pre>\n<\/blockquote>\n<p>Point your web browser at\u00c2\u00a0http:\/\/your_pi&#8217;s_address:9091\u00c2\u00a0and you should see something like this:<\/p>\n<div>\n<p><a href=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2012\/08\/Screenshot-from-2012-08-16-222357.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-635 alignnone\" style=\"margin: 20px;\" title=\"Screenshot from 2012-08-16 22:23:57\" src=\"http:\/\/naich.net\/wordpress\/wp-content\/uploads\/2012\/08\/Screenshot-from-2012-08-16-222357.png\" alt=\"\" width=\"474\" height=\"346\" srcset=\"https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2012\/08\/Screenshot-from-2012-08-16-222357.png 474w, https:\/\/naich.net\/wordpress\/wp-content\/uploads\/2012\/08\/Screenshot-from-2012-08-16-222357-300x218.png 300w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>But probably not as squished. \u00c2\u00a0I wanted to get all the icons in the screenshot.\u00c2\u00a0 But let&#8217;s not wander away from the point that you now have a working Bittorrent client on your Pi.\u00c2\u00a0 Give yourself a pat on the back and put the kettle on for a celebratory cup of tea.<\/p>\n<p>But there is a slight problem.\u00c2\u00a0 Click on the spanner and look at &#8220;Download to:&#8221; to see where your torrents will be put.\u00c2\u00a0 It&#8217;s something like &#8220;\/var\/lib\/transmission-daemon\/download\/buried\/so\/deep\/youll\/never\/find\/it\/again\/&#8221;.\u00c2\u00a0 Wouldn&#8217;t it be better to have it somewhere a bit more memorable, maybe even on a memory stick so you could take it out of your Pi and take it with you?\u00c2\u00a0 We can do both.\u00c2\u00a0 Change the &#8220;Download to: &#8221; location to <strong><tt>\/mnt\/downloads<\/tt><\/strong> and continue to the next chapter, where we&#8217;ll be setting it all up&#8230;<\/p>\n<p><a title=\"Memory sticks and torrents\" href=\"http:\/\/naich.net\/wordpress\/?p=670\">Continued here.<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Continued from here First page here 8.\u00c2\u00a0 Installing a Bittorrent Client I don&#8217;t know about you, but I want to install a Bittorrent client on your Pi, and I&#8217;ll tell you why.\u00c2\u00a0 If your PC uses a wireless router and you use Bittorrent, you will probably find that the Bittorrent traffic over your network utterly [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74,102],"tags":[],"class_list":["post-574","post","type-post","status-publish","format-standard","hentry","category-geek","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=574"}],"version-history":[{"count":24,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/574\/revisions"}],"predecessor-version":[{"id":643,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/574\/revisions\/643"}],"wp:attachment":[{"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/naich.net\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}