We’ll see how to install and setup Transmission the BitTorrent client server daemon on various BSD and Linux distros. To make it automatically download the added torrent’s files. And separate the currently downloading files from the completed ones. As well as, how to manage it remotely.
Transmission is a BitTorrent client which features a variety of user interfaces on top of a cross-platform back-end. Transmission is free software licensed under the terms of the GNU General Public License (GNU GPL), with parts under the MIT License.
Source: Wikipedia
- Official website: TransmissionBT
- Forums: https://forum.transmissionbt.com/
- Download page: https://transmissionbt.com/download/
- Source code: https://github.com/transmission/transmission
- License: GNU GPLv2 / GPLv3 and MIT License
- Donation: Support Transmission
Contents index
Installation:
transmission-daemon
usually is not shipped with almost all Linux distros. Yet, it’s always a good practice to check whether or not you have it installed on your system. Please, see : How to check whether or not a package is installed.
To install it on:
Such as: Debian / Ubuntu / Linux Mint / Devuan / elementary OS / MX Linux / antiX / deepin / Linux Lite / Zorin OS / LXLE / Peppermint OS / SparkyLinux:
$ apt install transmission-daemon
If apt
wasn’t installed by default, then use apt-get
or aptitude
instead.
On Fedora:
$ dnf install transmission-daemon
On RedHat 7 / CentOS 7 / Scientific Linux 7:
$ yum install transmission-daemon
On RedHat 8+ / CentOS 8+ / Scientific Linux 8+:
$ dnf install transmission-daemon
On Mageia:
$ urpmi transmission-daemon
On ArchLinux and its its derivatives: (like: Manjaro / KaOS / ArchBang Linux / BlackArch Linux / Parabola GNU/Linux-libre / Chakra GNU/Linux):
$ pacman -S transmission-cli
On Gentoo:
$ emerge net-p2p/transmission
On Void Linux:
$ xbps-install -S transmission
On Alpine:
$ apk add transmission-daemon
On FreeBSD:
To install the pre-compiled package:
$ pkg install transmission-daemon
If you prefer to compile it yourself:
Using portmaster
:
$ portmaster -v net-p2p/transmission-daemon
Or, the traditional way:
$ cd /usr/ports/net-p2p/transmission-daemon $ make install clean $ rehash
On MacOS X:
If you’re using MacPorts
:
$ port install transmission
If you’re using Brew
:
$ brew install transmission
Alternatively you can download the GUI version from Transmission official page.
Please note in this case the equivalent to settings.json
under Unix is: ~/Library/Preferences/org.m0k.transmission.plist
.
Pre-Configuration:
Stopping the service:
First, become root, otherwise use sudo
whenever it’s needed. Then, go ahead and stop the transmission-daemon
service. This actually is very important, because all the modified settings and configurations will NOT be applied if the service was still running. Besides the old settings will automatically get restored once the service is restarted or with rebooting your system. Here is how to stop it on:
$ systemctl stop transmission-daemon
$ service transmission-daemon stop
$ initctl stop transmission-daemon
Or:
$ stop transmission-daemon
$ sv d transmission-daemon
$ rc-service transmission-daemon stop
Or:
$ service transmission-daemon stop
Please check our tutorial on HowTo: Manage a service in systemd, SysV init, Upstart, runit and OpenRC
Creating the needed directories:
Once the service is stopped, let’s organize our torrents folders, First let’s create the needed directories:
$ mkdir --verbose -p /srv/torrent/{source,pending,completed/{Apps,Audio,Videos,OSes,Games,Misc}}
That command will produce us the following directories tree:
/srv/ |_ torrent/ |_ completed/ | |_ Apps/ | |_ Audio/ | |_ Games/ | |_ Misc/ | |_ OSes/ | |_ Videos/ |_ pending/ |_ source/
Note, that was just an example, you can choose whatever structure you want. Yet, the minimum needed folders in this tutorial is: /srv/torrent/completed
, /srv/torrent/pending
and /srv/torrent/source
.
Backing up the current configurations:
Now, it’s time to start modifying the settings.json
file which holds the Transmission‘s configurations. And it can be found in /etc/transmission-daemon/settings.json
. But first let’s back it up, just in case we mess things up:
$ cp /etc/transmission-daemon/settings.json{,.bkp}
Configuration:
Editing settings.json:
Okay, we should be good to start playing with it. So, let’s open it up:
$ vim /etc/transmission-daemon/settings.json
You may use your favorite text editor instead of vim
.
Files & Paths:
- pending: Which should store all current downloads in.
- completed: Which should store all completed downloads in.
- source: Transmission should watch this directory for any new torrents so that it adds them automatically.
Just make sure that, each of the following variables in your settings.json
have the same exact values as below:
Note, the variables are located between the double quotes "
in the left side, just before the colon :
. While the values are located after it, in the right side between the double quotes "
. (For example: download-dir
is a variable, while /srv/torrent/completed
is its value).
{ ... "download-dir": "/srv/torrent/completed", "incomplete-dir": "/srv/torrent/pending", "incomplete-dir-enabled": true, "preallocation": 1, "rename-partial-files": true, "start-added-torrents": true, "trash-original-torrent-files": true, "umask": 18, "watch-dir": "/srv/torrent/source", "watch-dir-enabled": true }
Notes:
preallocation
: Number (0 = Off, 1 = Fast, 2 = Full (slower but reduces disk fragmentation), default = 1)rename-partial-files
: Boolean (default = true) Postfix partially downloaded files with “.part”.trash-original-torrent-files
: Boolean (default = false) Delete torrents added from the watch directory.umask
: Number (default = 18) Sets transmission’s file mode creation mask. See the umask(2) manpage and umask in wikipedia for more information. Users who want their saved torrents to be world-writable may want to set this value to 0. Bear in mind that the json markup language only accepts numbers in base 10, so the standard umask(2) octal notation “022” is written in settings.json as 18.- The last line that contains a variable and value in your
settings.json
file, just before the}
should NOT end with,
Otherwise, it will cause issues with your configurations.
Bandwidth – Controlling the speeds:
The following are the default download/uploads speeds:
{ ... "speed-limit-down-enabled": true, "speed-limit-down": 600, "speed-limit-up-enabled": true, "speed-limit-up": 300, "upload-slots-per-torrent": 14, ... }
Note that:
- If you don’t want to limit the speeds of download and/or upload, just change the value in above from
true
tofalse
. - The numbers in
speed-limit-down
andspeed-limit-up
are KB/s numbers.
Alternative speed (Turtle Mode)
If you want to set and enable the alternative speed (Also known as Turtle Mode):
{ ... "alt-speed-enabled": true, "alt-speed-down": 100, "alt-speed-up": 50, ... }
Scheduling things:
Instead, you can schedule it. For example let’s schedule it to activate the alternative speed (Turtle Mode) everyday from 2PM till 2AM:
{ ... "alt-speed-time-enabled": true, "alt-speed-time-begin": 840, "alt-speed-time-end": 120, "alt-speed-time-day": 127, "idle-seeding-limit-enabled": false, "idle-seeding-limit": 30, "ratio-limit-enabled": false, "ratio-limit": 2, ... }
Wait! but… how?
Well, the alt-speed-time-begin
and alt-speed-time-end
take values in minutes counted from midnight (00:00 which is 12:00AM). So, in our example mentioned above, we wanted it to get activated at 2PM. First let’s convert the 2:00PM to the 24-Hours mode: 12 + 2 = 14
. Then, let’s convert it to minutes, since each hour has 60 minutes: 14 x 60 = 840
.
And deactivate it at 2AM, which is 2 x 60 = 120
The rule here, is:
Converting time in AM, or in 24-hours mode:
(Hours x 60) + Minutes
Converting time in PM:
(Hours x 60) + Minutes + 720
As for alt-speed-time-day
, it’s actually a decimal number converted from binary. Wait! Don’t skip it, it’s really easy!. And there are two methods for getting that decimal number.
Method 1: Binary to Decimal
So, since the week has 7 days, we will have 7 zeros: 0000000. And each zero is going to represent a day’s status (0 = off, 1 = on). Starting from Sunday to Saturday (From right to left).
For example if we want to activate it only on weekends, we should replace the Saturday and Sunday‘s zeros with ones.
+----------------------------------------------------------------------+ | Saturday | Friday | Thursday | Wednesday | Tuesday | Monday | Sunday | +----------------------------------------------------------------------+ | 1 | 0 | 0 | 0 | 0 | 0 | 1 | +----------------------------------------------------------------------+
Now we have the binary code which is 1000001
, we can convert it to decimal number, using BASH
:
$ echo $((2#1000001))
Which is: 65
Method 2: Alternative way:
If you still find it complicated. Here is an easier alternative way:
Imagine the day Sunday has a value of 1, and each following day has the double of its previous day’s value. So:
Sunday = 1 Monday = 2 x (Sunday's value) = 2 x 1 = 2 Tuesday = 2 x (Monday's value) = 2 x 2 = 4 Wednesday = 2 x (Tuesday's value) = 2 x 4 = 8 Thursday = 2 x (Wednesday's value) = 2 x 8 = 16 Friday = 2 x (Thursday's value) = 2 x 16 = 32 Saturday = 2 x (Friday's value) = 2 x 32 = 64
Great! Now, let’s write them down, shall we:
+----------------------------------------------------------------------+ | Saturday | Friday | Thursday | Wednesday | Tuesday | Monday | Sunday | +----------------------------------------------------------------------+ | 64 | 32 | 16 | 8 | 4 | 2 | 1 | +----------------------------------------------------------------------+
Now, just sum up the values of each day you want to activate the Turtle Mode on.
Example 1: Everyday:
1 + 2 + 4 + 8 + 16 + 32 + 64 = 127
Example 2: Weekends (Saturday and Sunday):
1 + 64 = 65
Notes:
- If you want to stop the seeding after becoming idle for N minutes, specify the minutes as a value of
idle-seeding-limit
, then change the value ofidle-seeding-limit-enabled
to true. - If you want to set a seeding ratio limit, specify the maximum ration number in
ratio-limit
that seeding should be stopped once it’s being reached, then change the value ofratio-limit-enabled
to true.
Remote management (RPC):
Transmission allows you to manage it locally or remotely via a Web-UI. As simple as firing up a browser and heading to http://hostname:9091 or http://IPAddress:9091. This is actually very nice and important feature when you’re installing it on a virtual-machine or a dedicated server. Even if you installed it on your daily Desktop. Sometimes you might need to access and manage it from smart devices or another PC.
So, To enable it, you’d have to assign true as a value to rpc-enabled
, then just modify the following setting’s variables as needed:
{ ... "rpc-authentication-required": true, "rpc-bind-address": "0.0.0.0", "rpc-enabled": true, "rpc-password": "this-password-will-get-encrypted", "rpc-port": 9091, "rpc-url": "/transmission/", "rpc-username": "transmission", "rpc-whitelist": "127.0.0.1,192.168.0.*", "rpc-whitelist-enabled": true, ... }
rpc-authentication-required
: Boolean (default = false). If you want to authenticate users before letting them be able to manage Transmission, set this variable to true, then specify the used username inrpc-username
and the password inrpc-password
rpc-bind-address
: String (default = “0.0.0.0”) Where to listen for RPC connections.rpc-enabled
: Boolean (default = true). If you want to disable the Web-UI, just set this variable to false, otherwise leave it as true.rpc-password
: String. Whatever password you specify here, it will get encrypted/hashed once the Transmission-daemon service got started.rpc-port
: Number (default = 9091).rpc-url
: String (default = /transmission/).rpc-username
: String. Specify the desired username you’d like to use.rpc-whitelist
: String (it defines comma-delimited list of IP addresses that are allowed to access Transmission Web-UI from. Wildcards can be specified in the address using ‘*
‘. Example: “127.0.0.1,192.168.1.*”, Default: “127.0.0.1”).rpc-whitelist-enabled
: Boolean (default = true).
Queuing:
Instead of downloading all the torrent files at once, you can organize the downloading and uploading processes by allowing N files to get downloaded while the other files stay in a queue list waiting their turn. As below:
{ ... "download-queue-enabled": true, "download-queue-size": 5, "queue-stalled-enabled": true, "queue-stalled-minutes": 30, "seed-queue-enabled": false, "seed-queue-size": 10, ... }
download-queue-enabled
: Boolean (default = true) When true, Transmission will only downloaddownload-queue-size non-stalled
torrents at once.download-queue-size
: Number (default = 5) Seedownload-queue-enabled
.queue-stalled-enabled
: Boolean (default = true) When true, torrents that have not shared data forqueue-stalled-minutes
are treated as ‘stalled’ and are not counted against thequeue-download-size
andseed-queue-size
limits.queue-stalled-minutes
: Number (default = 30) Seequeue-stalled-enabled
.seed-queue-enabled
: Boolean (default = false) When true. Transmission will only seedseed-queue-size
non-stalled torrents at once.seed-queue-size
: Number (default = 10) Seeseed-queue-enabled
.
Peers:
Transmission also allows you to control and configure the peers settings as you like. Like below:
{ ... "bind-address-ipv4": "0.0.0.0", "bind-address-ipv6": "::", "peer-congestion-algorithm": "", "peer-id-ttl-hours": 6, "peer-limit-global": 240, "peer-limit-per-torrent": 60, "peer-socket-tos": "default", ... }
bind-address-ipv4
: String (default = “0.0.0.0”) Where to listen for peer connections.bind-address-ipv6
: String (default = “::”) Where to listen for peer connections.peer-congestion-algorithm
: String. This is documented on Tweaking TCP’s Congestion Control Algorithm.peer-id-ttl-hours
: Number (default = 6) Recycle the peer id used for public torrents after N hours of use.peer-limit-global
: Number (default = 240)peer-limit-per-torrent
: Number (default = 60)peer-socket-tos
: String (default = “default”) Set the Type-Of-Service (TOS) parameter for outgoing TCP packets. Possible values are “default”, “lowcost”, “throughput”, “lowdelay” and “reliability”. The value “lowcost” is recommended if you’re using a smart router, and shouldn’t harm in any case.
Peer Ports:
You’re able to control the peer’s ports too, with the following variables:
{ ... "peer-port": 51413, "peer-port-random-high": 65535, "peer-port-random-low": 49152, "peer-port-random-on-start": true, "port-forwarding-enabled": true, ... }
peer-port
: Number (default = 51413).peer-port-random-high
: Number (default = 65535).peer-port-random-low
: Number (default = 1024).peer-port-random-on-start
: Boolean (default = false).port-forwarding-enabled
: Boolean (default = true) Enable UPnP or NAT-PMP.
Blocklist:
A Blocklist is third-party list of peer addresses to block. This can be used to block peers whose addresses are believed to belong to spyware or malware manufacturers.
{ ... "blocklist-enabled": false, "blocklist-url": "http://www.example.com/blocklist", ... }
blocklist-url
: Just specify the URL, which has the list of URLS you’d like to block.blocklist-enabled
: If you want to activate it, just set it to true.
Misc:
Here is some extra settings you can tweak and play with:
{ ... "cache-size-mb": 4, "dht-enabled": true, "encryption": 1, "lazy-bitfield-enabled": true, "lpd-enabled": false, "message-level": 1, "pex-enabled": true, "prefetch-enabled": 1, "scrape-paused-torrents-enabled": true, "script-torrent-done-enabled": false, "script-torrent-done-filename": "", "utp-enabled": true, ... }
cache-size-mb
: Size (default = 4), in megabytes, to allocate for Transmission’s memory cache. The cache is used to help batch disk IO together, so increasing the cache size can be used to reduce the number of disk reads and writes. Default is 2 if configured with –enable-lightweight.dht-enabled
: Boolean (default = true) Enable Distributed Hash Table (DHT).encryption
: Number (0 = Prefer unencrypted connections, 1 = Prefer encrypted connections, 2 = Require encrypted connections; default = 1) Encryption preference. Encryption may help get around some ISP filtering, but at the cost of slightly higher CPU use.lazy-bitfield-enabled
: Boolean (default = true) May help get around some ISP filtering. Vuze specification.lpd-enabled
: Boolean (default = false) Enable Local Peer Discovery (LPD).message-level
: Number (0 = None, 1 = Error, 2 = Info, 3 = Debug, default = 2) Set verbosity of transmission messages.pex-enabled
: Boolean (default = true) Enable [http://en.wikipedia.org/wiki/Peer_exchange Peer Exchange (PEX)].prefetch-enabled
: Boolean (default = true). When enabled, Transmission will hint to the OS which piece data it’s about to read from disk in order to satisfy requests from peers. On Linux, this is done by passingPOSIX_FADV_WILLNEED
toposix_fadvise()
. On OS X, this is done by passingF_RDADVISE
tofcntl()
. This defaults to false if configured with--enable-lightweight
.scrape-paused-torrents-enabled
: Boolean (default = true)script-torrent-done-enabled
: Boolean (default = false) Run a script at torrent completion.script-torrent-done-filename
: String (default = “”) Path to script.utp-enabled
: Boolean (default = true) Enable Micro Transport Protocol (µTP).