Print

Configuring Transmission Bit Torrent Daemon

My Environment

Server: SunOS blackhole 5.11 NexentaOS_20090926 i86pc i386 i86pc Solaris
Clients: Anything (web browser and remote unix rpc command line utilities)

Documentation


Prerequisites - Install Transmission (Daemon)

Refer to http://trac.transmissionbt.com/ (external link) for most information.
For Nexenta (Opens Solaris + Debian Packages) refer to:

Step 1 - Create the working files and directories
  • Decide on the directories to be used (my values in parentheses):
    1. Transmission working directory (/var/transmission/daemon/)
    2. Torrent up/download data directory (/tank/transmission/data/)
    3. OPTIONAL New torrent autoload directory (/tank/transmission/torrents/)
  • create the directories if needed
  • chown them to be transmission:transmission (probably only the user is important here, group could probably be something different)
    Does the autoload (watch) directory need to be setuid transmission ??

Open Tip

  • The default unix Transmission behaviour is to create (eg on exit or when directed) its configuration files under $HOME/.config/transmission-daemon. I prefer a daemon's config files not to be hidden under .config. See http://trac.transmissionbt.com/wiki/ConfigFiles (external link)
  • The default download-dir is $HOME/Downloads.
  • If the working directory doesn't exist Transmission will create it in the next step.

Open Tip

Conveniently, the working directory contents are more-or-less portable across platforms. I happened to be migrating from an existing Transmission install on Apple OS X to the server version. I tarred up the Apple working directory ~/Library/Application Support/Transmission/ and untarred it on the server. Note however:
  • the untarred directories need to be renamed to all lowercase
  • the untarred tree should be chown'd transmission:transmission as necessary
  • remove any ._* (and any other Mac files)
  • The Mac config file is different and incompatible with settings.json
  • The data directory will probably have changed if you moved torrents so see Step 7

Step 2 - Get transmission to create an initial config file and any working directories
  • The config file is named "settings.json" and is in json format.
    If you happen to have one from an migration install then use that (make a backup copy just in case)
Exclamation Warning

  • Transmission reads and WRITES the config file so don't bother organising its layout, it will just be rewritten in default (alphabetical) order.
  • When editing the settings file by hand make sure Transmission is not running (or your changes will be lost)

  • su - transmission
  • transmission-daemon --config-dir /var/transmission/daemon -f --paused--
    • You may want to use --paused if you have transferred some torrents across to prevent them starting until testing is complete.
  • Ctrl-C the daemon twice.
    /usr/local/bin/transmission-daemon  -f
    [08:11:11.224] RPC Server: Adding address to whitelist: 127.0.0.1
    [08:11:11.224] RPC Server: Serving RPC and Web requests on port 9091
    [08:11:11.225] RPC Server: Whitelist enabled
    [08:11:11.225] Transmission 1.76 (9395) started
    [08:11:11.279] DHT: Generating new id
    [08:11:11.556] Port Forwarding (NAT-PMP): initnatpmp succeeded (0)
    [08:11:11.556] Port Forwarding (NAT-PMP): sendpublicaddressrequest succeeded (2)
    ^C
    [08:11:13.959] Saved "/var/transmission/daemon/settings.json"
    [08:11:19.597] Port Forwarding: State changed from "Not forwarded" to "Starting"
    [08:11:19.598] DHT: Not saving nodes, DHT not ready
    [08:11:19.598] Port Forwarding: Stopped
    [08:11:19.598] Port Forwarding: State changed from "Starting" to "???"
    ^C

    The "Port Forwarding" lines may not appear if you press Ctrl-C twice in quick succession. However the "Saved" line should appear.
    The -f option tells Transmission to run in the foreground. A list of other command line options can be found by passing -h as usual.
  • At this point there should be a tree structure like:
    /var/transmission/daemon/settings.json
    /var/transmission/daemon/blocklists/
    /var/transmission/daemon/torrents/
    /var/transmission/daemon/resume/
    /var/transmission/daemon/stats.json

    See http://trac.transmissionbt.com/wiki/ConfigFiles (external link) for information on these items.

Step 3 - Edit the configuration file (settings.json)
  • Make sure the Transmission daemon is NOT running (or it will overwrite your changes!)
  • Review http://trac.transmissionbt.com/wiki/EditConfigFiles (external link) for information on the parameters. The documentation appears to be a little behind the source code but it is close enough.
  • Edit settings.json as needed.
  • Some of the defaults (eg speed related seem a little arbitrary so review the carefully)
  • At least one change required will be the rpc-whitelist. If you want to access the web interface from another machine on your local network (assumed to be 192.168.0.0) change the line to read:
    "rpc-whitelist": "127.0.0.1,192.168.*.*",
  • Ensure rpc-enabled line is set to true or '1'.

Step 4 - Test your config file.
  • Make a copy of settings.json just in case Transmission clobbers it (guess how I learnt that one!).
  • Run Transmission to dump out the config file: transmission-daemon --config-dir /var/transmission/daemon -d
  • Check the dump to see it matches what you expect. If it shows default values only then look for error messages near the start complaining about parsing errors, or else you may have the wrong config-dir.

Step 5 - Start Transmission (manually)
  • su - transmission
  • transmission-daemon --config-dir /var/transmission/daemon -f --paused--

Step 6 - Test the remote admin command line tool
  • On the server run: torrent-remote -si
    It should connect (to localhost) and display something like the following:
    /usr/local/bin/transmission-remote -si
    VERSION
      Daemon version: 1.76 (9395)
      RPC version: 6
      RPC minimum version: 1
    
    TRANSFER
      Download directory: /tank/transmission/data
      Listenport: 51413
      Portforwarding enabled: Yes
      Peer exchange allowed: Yes
      Encryption: preferred
    
    LIMITS
      Peer limit: 240
      Upload speed limit: Unlimited  (Disabled limit: 100 KB/s; Disabled turtle limit: 50 KB/s)
      Download speed limit: Unlimited  (Disabled limit: 100 KB/s; Disabled turtle limit: 50 KB/s)
  • This tool can also be used from another machine: transmission-remote host:port -si
  • transmission-remote -h details the options available.
  • There is also a command line CLIENT tool: transmissioncli or transmission-cli

Step 7 - Updating any existing torrents
Skip this step if you have not moved any existing torrents across.

The resume file for each torrent contains the local settings for that file, including the data file path - which has probably changed.
We need to update every torrent. If there are only one or two it can be done manually. If you have more than say a dozen use the shell script below (it only works properly if all datafiles are in the same directory - ie no subdirs, if not you have to change them individually.
  • List all the torrents first using transmission-remote -l and note of the largest ID number (here it's 56):
    /usr/local/bin/transmission-remote -l
    ID     Done       Have  ETA           Up    Down  Ratio  Status       Name
       1     0%       None  Unknown      0.0     0.0   0.81  Stopped      BigBuckBunny.avi
    ...
      56   100%   650.6 MB  Done         0.0     0.0   1.50  Stopped      NeoOffice-1.2.dmg
    Sum:            3.6 GB               0.0     0.0
  • For each ID execute: /usr/local/bin/transmission-remote -t ID --find /PATH/TO/DATADIR
    Eg: /usr/local/bin/transmission-remote -t 1 --find /tank/transmission/data/
    Note we use the find command not the move command because we've already moved the file.
    script to automate data file relocation
    #!/bin/sh
    if [ $# -lt 1 ]; then
    echo "Usage: $0 MAX_ID"
    echo "Run usr/local/bin/transmission-remote -l to find largest torrent ID and rerun with argument"
    exit
    fi
    max=$1
    i=1
    while [ $i -le $max ]; do
    /usr/local/bin/transmission-remote -t $i --find /tank/media/Transmission/Data
            (( i = i + 1 ))
    done

    Note: The first if/fi statement is just candy.
    Save the script into a file, say "relocate.sh" and do "sh relocate.sh MAX_ID" where MAX_ID is 56 in the example above.
    If you're unsure about doing a batch update, use the web interface (next step) and view the current data file location of say the first torrent, then update its location using the find option and review the web data to gain confidence.
    Once this is done either restart transmission or using the web interface right click on a torrent and select "Verify Local Data" to force a recheck.

Step 8 - View the Transmission web page
  • Transmission has its own inbuilt webserver (although it can be proxied through apache etc)
  • Bring up a browser on any machine on the approved whitelist network and enter http://SERVERIP_OR_HOSTNAME:9091/ where 9091 is the (default) port in the config file.
    Information Note
    Consider enabling security and/or using proxy security to protect Transmission. To set a password either enter a plain text password into settings.json which should be encrypted when transmission is next run or use transmission-remote --auth USERNAME:PASSWORD

    BTW - I must comment that the web GUI quality is excellent.

Step 9 - Final Setup

  • Create/update firewall rules as necessary for your new Transmission server.
  • Try a test torrent upload and download.
  • Test the watched torrent directory if enabled.
  • Set an admin password as needed

To administer your new Transmission server use transmisison-remote (IMHO it should be renamed transmission-admin). transmission-remote -h for help.


Step 10 - Have a coffee/beer and consider contributing a few $ to the excellent Transmission project



  • + : A leading plus sign indicates that this word must be present in every object returned.
  • - : A leading minus sign indicates that this word must not be present in any row returned.
  • By default (when neither plus nor minus is specified) the word is optional, but the object that contain it will be rated higher.
  • < > : These two operators are used to change a word's contribution to the relevance value that is assigned to a row.
  • ( ) : Parentheses are used to group words into subexpressions.
  • ~ : A leading tilde acts as a negation operator, causing the word's contribution to the object relevance to be negative. It's useful for marking noise words. An object that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the - operator.
  • * : An asterisk is the truncation operator. Unlike the other operators, it should be appended to the word, not prepended.
  • " : The phrase, that is enclosed in double quotes ", matches only objects that contain this phrase literally, as it was typed.

Categories

Related Sites

Toolbox

Print