Transmission

Transmission 1.42

Transmission is a torrent Downloader that can be managed by a web interface.

You don't need to compile Transmission anymore, because it came now in Optware feed.
also, you don't have to modify your http server, neither install clutch because it came embedded with it already.

Installation procedure :

First you need to have optware, including the /etc/ld.so.conf file updated.

These 2 lines will make sure your /etc/ld.so.conf contains /opt/lib

[ ! -e  /etc/ld.so.conf ] && echo  "/opt/lib" >/etc/ld.so.conf
[ "`grep -c "/opt/lib" /etc/ld.so.conf`" -eq "0" ] && echo -en "\n/opt/lib" >>/etc/ld.so.conf

then you can install Transmission

# /opt/bin/ipkg update
# /opt/bin/ipkg install transmission

Install character conversion tool…
# /opt/bin/ipkg install libiconv

After each ipkg install, we do the following…
# ldconfig

++Start Transmission
You can now start the daemon and then check if it running properly:
# /opt/bin/transmission-daemon
# ps -A | grep transmission

Set up Webinterface access

By default recent version of Transmission only allow webinterface access from the localhost. This means that you may not be able to the webinterface on your local network or over the internet. To fix this edit /root/.config/transmission-daemon/settings.json. NOTE: You may need to kill the transmission-daemon process for the changes to be allowed. Add/edit the following lines to include your local network:

"rpc-access-control-list": "127.0.0.*,192.168.1.*",
"rpc-whitelist": "127.0.0.1,192.168.1.*",

Note: Take good care about the , comma at the end. The last line in the file does not need a comma. or you may get an error like http://mybookworld.wikidot.com/forum/t-225457/json-error

In this example, the daemon will allow all connections from the local host and the local network between 192.168.1.0 to 192.168.1.255.

Now you can connect from your web-browser http://<MyBookWorld>:9091/

And that's all. You are running.

Proxy Webinterface through lighttpd

A small tip to those who don't like to run it on port 9091, you can configure the main lighttpd as a proxy to the transmission interface.

In /etc/lighttpd/lighttpd.conf
1. add "mod_proxy" to server.modules
2. add the following to end of your lighttpd.conf file

proxy.server = ( "/transmission" =>
                       ( (
                           "host" => "127.0.0.1",
                           "port" => 9091
                         ) )
                     )

Now you can access your Transmission interface on http://<MyBookWorld>/transmission/web

Most of Transmission's web interface are static files. Since the MyBook is a limited device on which lighttpd performs better than the Transmission embedded web server, you can use it to serve these static files with the following configuration:

#Redirect from /transmission to /transmission/web
url.rewrite-once += ( "^/transmission[/]?$" => "/transmission/web" )
$HTTP["url"] =~ "^/transmission/" {
  #Serve static files from /opt/share/transmission
  server.document-root = "/opt/share/"
  #Forward RPC requests to the Transmission daemon
  proxy.server = (
    "/transmission/rpc" => (
      ( 
        "host" => "127.0.0.1",
        "port" => 9091
      )
    )
  )
}

Transmission configuration file

We have already edited this file in the previous section on setting up the webinterface. Now you can make some further changes to this file in order to configure the default settings for your daemon. Once you configure it, it will restart always as the preconfigured state

Stop transmission:

# killall transmission-daemon

Edit the settings file with nano:

# nano /root/.config/transmission-daemon/settings.json

Some of this configuration will be override by the option menu in the webif

Here is a sample of what you may find in the settings file:

{
    "blocklist-enabled": 0,
    "download-dir": "\/root",
    "download-limit": 100,
    "download-limit-enabled": 0,
    "encryption": 1,
    "max-peers-global": 200,
    "peer-port": 51413,
    "pex-enabled": 1,
    "port-forwarding-enabled": 0,
    "rpc-access-control-list": "+127.0.0.1",
    "rpc-authentication-required": 0,
    "rpc-password": "",
    "rpc-port": 9091,
    "rpc-username": "",
    "upload-limit": 100,
    "upload-limit-enabled": 0
}

This config has no modifications as what is created from the first execution, but the most comon will be

"download-dir": "\/root", # this is the path were you execute transmission the first time
can be change from the WebIf. You should definitely edit this to some folder in you DataVolume, otherwise your root partition will run out of disk-space.

if you want security from the users of the network not to mess with your torrents

"rpc-authentication-required": 1, # 1 will ask password
"rpc-username": "YYYYYYYYY", # Username for the Webif
"rpc-password": "XXXXXXXX", # Password for the Webif

Thanks to servo, frater and all the other contributors on this topic…

Auto Start Transmission at Startup

A startup script in /opt/etc/init.d will start transmission when the mybook starts up. Sometimes mybook will put its configuration in / instead of /root. For that reason I included the location of the config-file in the startup script. Modify it if you run transmission as a different user:

/opt/etc/init.d/S90transmission

#!/bin/sh
export EVENT_NOEPOLL=1

prefix="/opt"

PATH=${prefix}/bin:${prefix}/sbin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=transmission-daemon
CONFIGDIR=/root/.config/transmission-daemon
DAEMON=${prefix}/bin/${NAME}

test -x $DAEMON || exit 0

if [ -z "$1" ] ; then
    case `echo "$0" | sed 's:^.*/\(.*\):\1:g'` in
        S??*) rc="start" ;;
        K??*) rc="stop" ;;
        *) rc="usage" ;;
    esac
else
    rc="$1"
fi

case "$rc" in
    start)
        echo "Starting Torrent client: $NAME"
        nice $DAEMON -g ${CONFIGDIR}
        ;;
    stop)
        #if [ -n "`pidof $NAME`" ]; then
            echo "Stopping Torrent client: $NAME"
            killall $NAME 2> /dev/null
        #fi
        ;;
    restart)
        "$0" stop
        sleep 1
        "$0" start
        ;;
    *)
        echo "Usage: $0 (start|stop|restart|usage)"
        ;;
esac

exit 0

Then make it executable and create a symbolic link:

chmod +x /opt/etc/init.d/S90transmission
ln -s /opt/etc/init.d/S90transmission /opt/etc/init.d/K10transmission

Here's an alternative S90transmission which also downloads a blocklist.
This S90transmission will also make sure transmission is being stopped.

#!/bin/sh
export EVENT_NOEPOLL=1

prefix="/opt"

PATH=${prefix}/bin:${prefix}/sbin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=transmission-daemon
CONFIGDIR=/root/.config/transmission-daemon
DAEMON=${prefix}/bin/${NAME}

test -x $DAEMON || exit 0

if [ -z "$1" ] ; then
    case `echo "$0" | sed 's:^.*/\(.*\):\1:g'` in
        S??*) rc="start" ;;
        K??*) rc="stop" ;;
        *) rc="usage" ;;
    esac
else
    rc="$1"
fi

case "$rc" in
    start)
        if [ -n "`pidof $NAME`" ]; then
          echo "$NAME is already running"
        else
          cd ${CONFIGDIR}/blocklists
          if [ $? -eq 0 ]; then
             find . -mtime +4 -type f -name level1 -exec rm {} \;
             if [ ! -f ${CONFIGDIR}/blocklists/level1 ]; then
                # update blocklist
                echo "updating blocklist, ~4MB"
                wget -q -O level1.gz http://download.m0k.org/transmission/files/level1.gz
                if [ -f level1.gz ]; then
                  gunzip level1.gz
                  if [ $? -eq 0 ]; then
                    chmod go+r level1
                  else
                    rm -f level1*
                  fi
                fi
             fi
             cd - 2>&1 >/dev/null
          fi
          echo "Starting Torrent client: $NAME"
          nice $DAEMON -g ${CONFIGDIR}
        fi
        ;;
    stop)
        if [ -n "`pidof $NAME`" ]; then
            echo "Stopping Torrent client: $NAME"
            n=1
            while true; do
              killall $NAME 2> /dev/null
              sleep 1
              [ ! -n "`pidof $NAME`" ] && break
              sleep 4
              [ $n -gt 5 ] && break
              let n+=1
            done
            n=1
            while true; do
              killall -9 $NAME 2> /dev/null
              sleep 1
              [ ! -n "`pidof $NAME`" ] && break
              sleep 2
              [ $n -gt 10 ] && break
              let n+=1
            done
            if [ -n "`pidof $NAME`" ]; then
              echo "Termination of $NAME was not successful, it keeps running"
              sleep 1
            fi
        else
            echo "$NAME already stopped"
        fi
        ;;
    restart)
        "$0" stop
        "$0" start
        ;;
    *)
        echo "Usage: $0 (start|stop|restart|usage)"
        ;;
esac

exit 0

It needs the gunzip binary which you have to install with ipkg (ipkg install gzip)
Do make sure you have enabled the blocklist by editing the file /root/.config/transmission-daemon/settings.json
"blocklist-enabled": 1,

Windows Frontend

When you don't like the web interface, then there are remote windows clients available at
http://code.google.com/p/transmission-remote-dotnet/ (Requires .NET Framework 3.5)
A forum thread about it http://forum.transmissionbt.com/viewtopic.php?f=1&t=6611

http://code.google.com/p/transmisson-remote-gui/
A forum thread about it http://forum.transmissionbt.com/viewtopic.php?f=1&t=6700

Other Usefull links :

The forum where this transmission tutorial come from : thanks to servo and frater...
Other infos on transmission
Automatically Start-Stop Transmission
Completely AUTOMATED Transmission installation

Original , oldy, Links :
Transmission - Discussion thread here.
Another guide on Transmission, and a helper script to automate it's usage

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License