vaheeD khoshnouD

linux, mikrotik, macosx

How To Install Torrent Client on linux With Web Interface to access anywhere

Written by vaheeD on January 18, 2013
4.50 avg. rating (89% score) - 2 votes

This article explains how to install, configure, and run Transmission on a headless Ubuntu Lucid Lynx (10.04) server. Transmission, specifically transmission-daemon, is a BitTorrent client that can be accessed via a web browser and other front-ends, including a desktop app called trasmission-remote-gui and Android apps, including Transdroid (my favorite) and TorrentFu.

Transmission’s daemon is a good choice over rtorrent, an excellent ncurses client that I used to prefer, because Transmission is simpler to configure, and requires no other software to be installed for accessibility via a web browser or external client.

Installation

First, install the Transmission daemon using apt-get. This part is simple.

$ sudo apt-get install transmission-daemon

This installs the app and starts the daemon. The daemon runs under the user “debian-transmission”, which belongs to a group of the same name.

Configuration

Configuring Transmission is a little tricky, due to the placement of the configuration file (out of the box, the daemon doesn’t read /etc/transmission-daemon/settings.json, as you would expect), and due to the service’s method of saving (overwriting) its configuration file on exit. Restarting the service, if it is already running, will result in it saving the configuration file, and overwriting any changes you might have made to it. Instead of restarting the service after editing the configuration file, you should reload the service. The following code sends a SIGHUP signal to transmission-daemon, which causes it to reload its configuration file.

$ sudo service transmission-daemon reload

Edit the settings file using your favorite text editor. Note that the default location is /var/lib/transmission-daemon/info/settings.json.

$ sudo vi /var/lib/transmission-daemon/info/settings.json

Here is my settings.json file. I have almost all the options set. I recommend that you use my file as a starting point. You have to edit the rpc-whitelist setting to connect to the server from anything other than the local host. You should also edit the paths (download-dir, watch-dir, incomplete-dir) as you see fit.

{
"alt-speed-down": 500,
"alt-speed-enabled": true,
"alt-speed-time-begin": 480,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": true,
"alt-speed-time-end": 0,
"alt-speed-up": 10,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"dht-enabled": true,
"download-dir": "\/home\/user\/dl\/torrent",
"download-limit": 1000,
"download-limit-enabled": 0,
"encryption": 2,
"incomplete-dir": "\/var\/lib\/transmission-daemon\/info\/Incomplete",
"incomplete-dir-enabled": false,
"lazy-bitfield-enabled": true,
"max-peers-global": 200,
"message-level": 2,
"open-file-limit": 32,
"peer-limit-global": 240,
"peer-limit-per-torrent": 60,
"peer-port": 20683,
"peer-port-random-high": 20500,
"peer-port-random-low": 20599,
"peer-port-random-on-start": true,
"peer-socket-tos": 0,
"pex-enabled": true,
"port-forwarding-enabled": false,
"preallocation": 1,
"proxy": "",
"proxy-auth-enabled": false,
"proxy-auth-password": "",
"proxy-auth-username": "",
"proxy-enabled": false,
"proxy-port": 80,
"proxy-type": 0,
"ratio-limit": 0.2500,
"ratio-limit-enabled": true,
"rename-partial-files": true,
"rpc-authentication-required": true,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "password",
"rpc-port": 9091,
"rpc-username": "transmission",
"rpc-whitelist": "127.0.0.1,*.*.*.*",
"rpc-whitelist-enabled": true,
"speed-limit-down": 1500,
"speed-limit-down-enabled": true,
"speed-limit-up": 50,
"speed-limit-up-enabled": true,
"umask": 2,
"upload-slots-per-torrent": 4,
"watch-dir": "\/home\/user\/dl\/torrent",
"watch-dir-enabled": true
}

It is (for the most part) safe to enter a plaintext password in this file. If you do so, when transmission-daemon closes, and it rewrites its settings file, the password will be saved in a SHA1 encrypted format. Just restart the service after completing these instructions, and your password will be encrypted.

I encountered difficulties with file permissions when I had Transmission save downloads within the /var/lib/transmission-daemon/. Therefore, I changed Transmissions setting to download to a folder within my home directory. To ensure that both I and the debian-transmission user had read/write permissions, I added my account to the debian-transmission group (which is created when you install transmission), and I changed the group ownership of my torrent download directory to debian-transmission. Doing so grants the debian-transmission group read/write access to that folder, preserves read/write/execute access for my account, and prevents access to all others.

$ sudo usermod -a -G debian-transmission mjdescy
$ chgrp debian-transmission ~/dl/torrent
$ chmod 770 ~/dl/torrent

I also changed the “umask” setting from the default of 18 to 2. That means transmission-daemon will create files with read/write permissions set at both the user and group level.

After saving any changes, tell the daemon to reload its configuration file.

$ sudo service transmission-daemon reload

That finishes configuration. Note that you will likely have to set up port forwarding on your router to access the web app from outside your network, and to seed properly.

Web Access

To access the server, point your web browser to

http://your.server.ip.address:9091.

(9091 is the default port, which can be changed, under “rpc-port”, in the settings file.) The web interface is pretty simple. Note that you can adjust some settings, such as transfer speed and download directory, by clicking the gear on the lower right of the page.

4.50 avg. rating (89% score) - 2 votes

Posted Under: Linux

About vaheeD

Leave a Reply

Your email address will not be published. Required fields are marked *

Protected by WP Anti Spam