I needed to grab a new ISO of Ubuntu via BitTorrent and I had issues with Deluge (See this Post) So I thought I’d have a look at Transmission as I used it on my Ubuntu desktop with no issues.
This article explains how to install, configure, and run the Transmission daemon on a headless Ubuntu 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 and Torrent-Fu.
Installation
First, install the Transmission daemon using apt-get.
server@homehub:~$ 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.
Preparation of File System and Group Permissions
I wanted all torrent files to be stored somewhere within my media drive (/media/datadrive/), which debian-transmission does not, by default, have access to. That means that I had to create folders for Transmission to use, and then grant debian-transmission read/write/execute access to them (execute is necessary to create folders), while ensuring that my user account (<username>) still had full control of the folders and their contents as well.
To do so, first create the folders for downloading and seeding torrents, completed torrents. These folders will be used by Transmission directly. I used Webmin to create the folder on my dedicated hard drive.
Then, add your user account to the group debian-transmission. Now your user account and the debian-transmission user account are in the same group.
server@homehub:~$ sudo usermod -a -G debian-transmission <username>
Next, change the group ownership of the folders Transmission will use to debian-transmission (the group, not the user).
server@homehub:~$ chgrp debian-transmission ~/media/datadrive/downloads
Finally, modify the permissions on each folder to allow full access (read, write, and execute) for both user (me) and group (debian-transmission, in this case).
server@homehub:~$ chmod 777 ~/media/datadrive/downloads
Doing so grants the debian-transmission group read/write access to that folder. NOTE : chmod 777 give read/write access to everybody. So you could use chmod 770.
These changes also require me to “umask” setting in Transmission’s configuration file 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. Not changing the umask will make Transmission create files that your user account cannot delete or access completely.
Configuring Transmission
Configuring Transmission is a little unusual, compared to other daemons such as Samba, due to the daemon’s method of saving (overwriting) its configuration file on exit. Restarting the daemon, 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. Importantly, it does not stop the the daemon, which would cause it to write over the configuration file.
server@homehub:~$ sudo service transmission-daemon reload
After Transmission is installed, the daemon will be started automatically. Without changing the configuration, however, Transmission will not be accessible from other machines, which would pose a problem on a headless server. You must edit the configuration file using the command below, set the proper configuration options, then reload the daemon, to get Transmission going the way you want it to.
server@homehub:~$ sudo nano /etc/transmission-daemon/settings.json
Here is my settings.json file, which I recommend that you use as a starting point. It configures Transmission to be available to clients other than localhost, to use separate folders for incomplete and complete (seeding) downloads and for the watch folder.
You have to edit the rpc-whitelist setting to connect to the server from anything other than the local host (and that’s nearly useless on a headless server). You should also edit the paths (download-dir, watch-dir, incomplete-dir) and peer ports as you see fit. Be sure to set the rpc-password, too!
{
"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": "/media/datadrive/downloads",
"download-limit": 100,
"download-limit-enabled": 0,
"encryption": 2,
"incomplete-dir": "/media/datadrive/downloads",
"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": 20500,
"peer-port-random-high": 20599,
"peer-port-random-low": 20500,
"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-limit": 100,
"upload-limit-enabled": 0,
"upload-slots-per-torrent": 4,
"watch-dir": "/media/datadrive/downloads",
"watch-dir-enabled": False
}
After saving any changes, tell the daemon to reload its configuration file, which applies all the changes you have made.
server@homehub:~$ sudo service transmission-daemon reload
Note that if you change the rpc-password to a plaintext value (which is the easiest way to do it), the password will remain unencrypted until transmission-daemon closes and it rewrites its settings file. To ensure that happens, and that the password is encrypted, restart (instead of reload) the service after you have reloaded it to apply the configuration changes. Once transmission-daemon saves its configuration file, the password will be converted from plaintext to a SHA1 encrypted format. You should only have to do this when you are changing the password.
$ sudo service transmission-daemon restart
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. The open dialog supports URLs to torrent files, magnet links, and uploading a torrent file from your computer.
Thanks very much for this guide – it worked perfectly! I have also managed to get it set up so that I can use the same folders with Samba to share with the other computers on the network. It also links into my home media server (serviio) which I have another web access for, so as soon as a torrent downloads its’ available to view on my DLNA TV!
By the way, if you want to share the same folders as used by Transmission-Daemon with say something like Samba, then use ‘umask = 0′.
Thanks again!
Nice, works great
!