annabunches.net/content/posts/2011-05-26-bittorrent-linux-way.md

19 lines
6.4 KiB
Markdown
Raw Normal View History

2016-04-11 22:01:00 +00:00
---
2016-05-04 18:41:25 +00:00
excerpt_separator: <br/>
category: technology
2016-04-11 22:01:00 +00:00
layout: post
title: BitTorrent, the Linux way
date: '2011-05-26T10:00:00.000-04:00'
author: Anna Wiggins
tags:
- tutorial
- bittorrent
- linux
- dropbox
- Technology
modified_time: '2013-10-22T11:19:50.897-04:00'
blogger_id: tag:blogger.com,1999:blog-4209116010564764361.post-8579340143964763744
blogger_orig_url: http://www.stringofbits.net/2011/05/bittorrent-linux-way.html
---
I use <a href="http://en.wikipedia.org/wiki/BitTorrent_%28protocol%29">BitTorrent</a> a lot. Most Linux distributions have torrents available, and I have gotten a lot of <a href="http://creativecommons.org/">Creative Commons</a>-licensed music, such as the work of <a href="http://www.jonathancoulton.com/">Jonathan Coulton</a>, via BitTorrent. It is a great way to deliver content.<br/><br/>However, I have a problem with (most of) the available BitTorrent clients. Given what BitTorrent <em>does</em>, which is allow you to download and subsequently seed content, it should really run like a service - quietly running in the background handling your torrents. However, most of the clients for Linux work like Windows applications. They sit in your system tray, giving you "helpful" popup notifications. More importantly, they die if you logout. Luckily, I have found a solution.<br/><h3>Enter transmission-daemon</h3><br/>Transmission is one of the bittorrent clients for Linux that works like I described above - it's a desktop application. However, it comes with a variant, transmisison-daemon, that can run in the background, as a dedicated 'transmission' user. This is much nicer.<br/><br/>Setting it up in fedora is pretty easy. Install the transmission-daemon package. Edit /etc/sysconfig/transmission-daemon to suit your needs. You can change TRANSMISSION_HOME to whatever directory you'd like your completed torrent files to live in (you <strong>do not</strong> need to modify the actual home directory of the transmission user, but do make sure TRANSMISSION_HOME is owned by that user).<br/><br/>Now, start transmission-daemon, then stop it again:<br/><pre>service transmission-daemon start<br/>service transmission-daemon stop</pre><br/>That step created the transmission configuration files, which you can now find in $TRANSMISSION_HOME/.config/transmission-daemon/. The file you probably want to edit is settings.json. Edit this file to suit your needs, then start transmission again. To tell transmission to automatically start at boot, run:<br/><pre>chkconfig transmission-daemon on</pre><br/><h3>transmission-remote - for all your transmission-related needs</h3><br/>So, now you have a daemonized BitTorrent client, running unobtrusively in the background. But how do you use it?<br/><br/>The answer is transmission-remote. This tool is an administrative front-end for transmission-daemon that lets you add, remove, start, stop, and view your torrents, and a lot more besides. To add a torrent, you can use 'transmission-remote -a' on either a local .torrent file or a URL, like so:<br/><pre>transmission-remote -a /path/to/file.torrent<br/>transmission-remote -a http://example.com/file.torrent</pre><br/>Once the torrent is added, it will automatically start. You can get information on all your torrents with 'transmission-remote -l'. Note that each torrent has a numeric ID assigned to it; you use that ID with the '-t' option to tell transmission-remote to perform actions on the torrent. For example, to stop the torrent with ID 42, you could run:<br/><pre>transmission-remote -t 42 -S</pre><br/>transmission-remote can do a lot more; check its man page for details. In particular, the -s, -i, and --remove-and-delete are useful flags to know.<br/><h3>Making things easier - the watch directory</h3><br/>The problem with the approach I have described is that the command line, while great for interacting with your local torrents, is not the place most people go to look for torrents in the first place. More often, you find a .torrent file on the web, and having to open a terminal and run a command is an annoying extra step.<br/><br/>To make things easier, you can set up a watch directory; any .torrent files placed in that directory will automatically be added to transmission-daemon. To set up a watch directory, edit settings.json and add the following:<br/><pre>watch-dir-enabled: "true",<br/>watch-dir: "/path/to/watch/dir",</pre><br/>(I have found it is best to always stop transmission-daemon before making changes to settings.json. It often overwrites settings