Setting Up a Torrent Server on Ubuntu 14.04 Using Transmission

Intro

I frequently find myself needing an ISO of some version of Ubuntu or a Raspberry Pi image. I always have to go find the image and wait for it to download. So I thought I would host these torrents, saving me the time to find and download and allowing me to give back just a little.

The following tutorial we cover the installation and configuration of Transmission. Transmission is  a wonderful torrent server that can be used with a headless Ubuntu Server. It includes a web pages interface for adding and monitoring torrents. You can also use the Windows version, called Transmission-Qt, to remotely connect to your remote Transmission server.

Installing the Newest Version of Transmission

On a fresh install of Ubuntu Server 14.04 you will need to add the package software-properties-common. To do this execute the following command:

sudo apt-get install software-properties-common

After the sofrware-properties-common package is installed you can add the transmission repository that includes the most up to date version of Transmission.

sudo add-apt-repository ppa:transmissionbt/ppa

After that you will need to update your package list by executing:

sudo apt-get update

Then you can install transmission-daemon, this will also install the necessary dependencies.

sudo apt-get install transmission-daemon

Configuring Transmission

Transmission by default creates a download and incomplete location. But I don’t like the default locations and want to move mine to my home directory. Note: Do not execute the following commands as root. You want the transmission directory in your home directory to be owned by you, you can also use the chown command after you create it, but for this example the transmission directory will be created by the user and therefore owned by the user.
cd ~
mkdir transmission
cd transmission
mkdir downloads
mkdir incomplete
mkdir torrents
sudo chown debian-transmission:debian-transmission downloads/
sudo chown debian-transmission:debian-transmission incomplete/
sudo chown debian-transmission:debian-transmission torrents/

Then make sure to turn off the transmission-daemon service or your configuration changes will be over written.

sudo service transmission-daemon stop

Next configure transmission daemon by making the changes to /etc/transmission-daemon/settings.json.
sudo nano /etc/transmission-daemon/settings.json

The default Transmission settings.json file is below:

{
    "alt-speed-down": 50, 
    "alt-speed-enabled": false, 
    "alt-speed-time-begin": 540, 
    "alt-speed-time-day": 127, 
    "alt-speed-time-enabled": false, 
    "alt-speed-time-end": 1020, 
    "alt-speed-up": 50, 
    "bind-address-ipv4": "0.0.0.0", 
    "bind-address-ipv6": "::", 
    "blocklist-enabled": false, 
    "blocklist-url": "http://www.example.com/blocklist", 
    "cache-size-mb": 4, 
    "dht-enabled": true, 
    "download-dir": "/var/lib/transmission-daemon/downloads", 
    "download-limit": 100, 
    "download-limit-enabled": 0, 
    "download-queue-enabled": true, 
    "download-queue-size": 5, 
    "encryption": 1, 
    "idle-seeding-limit": 30, 
    "idle-seeding-limit-enabled": false, 
    "incomplete-dir": "/home/debian-transmission/Downloads", 
    "incomplete-dir-enabled": false, 
    "lpd-enabled": false, 
    "max-peers-global": 200, 
    "message-level": 2, 
    "peer-congestion-algorithm": "", 
    "peer-id-ttl-hours": 6, 
    "peer-limit-global": 200, 
    "peer-limit-per-torrent": 50, 
    "peer-port": 51413, 
    "peer-port-random-high": 65535, 
    "peer-port-random-low": 49152, 
    "peer-port-random-on-start": false, 
    "peer-socket-tos": "default", 
    "pex-enabled": true, 
    "port-forwarding-enabled": false, 
    "preallocation": 1, 
    "prefetch-enabled": 1, 
    "queue-stalled-enabled": true, 
    "queue-stalled-minutes": 30, 
    "ratio-limit": 2, 
    "ratio-limit-enabled": false, 
    "rename-partial-files": true, 
    "rpc-authentication-required": true, 
    "rpc-bind-address": "0.0.0.0", 
    "rpc-enabled": true, 
    "rpc-password": "{a65b28d5ad27c15bc9bd9a0452945642bf40c4d12es40yVk", 
    "rpc-port": 9091, 
    "rpc-url": "/transmission/", 
    "rpc-username": "transmission", 
    "rpc-whitelist": "127.0.0.1", 
    "rpc-whitelist-enabled": true, 
    "scrape-paused-torrents-enabled": true, 
    "script-torrent-done-enabled": false, 
    "script-torrent-done-filename": "", 
    "seed-queue-enabled": false, 
    "seed-queue-size": 10, 
    "speed-limit-down": 100, 
    "speed-limit-down-enabled": false, 
    "speed-limit-up": 100, 
    "speed-limit-up-enabled": false, 
    "start-added-torrents": true, 
    "trash-original-torrent-files": false, 
    "umask": 18, 
    "upload-limit": 100, 
    "upload-limit-enabled": 0, 
    "upload-slots-per-torrent": 14, 
    "utp-enabled": true
}

We will make the following changes or additions (listed alphabetically):

"blocklist-enabled": true, 
"blocklist-url": "http://john.bitsurge.net/public/biglist.p2p.gz",
"cache-size-mb": 128,
"download-dir": "/home/allan/transmission/downloads",
"download-queue-enabled": false,
"incomplete-dir": "/home/allan/transmission/incomplete", 
"incomplete-dir-enabled": true, 
"port-forwarding-enabled": true, 
"rpc-password": "yourplaintextpasswordhere",
"rpc-port": 50013, 
"rpc-username": "allan", 
"rpc-whitelist": "10.13.14.*",
"umask": 0,
"watch-dir": "/home/allan/transmission/torrents", 
"watch-dir-enabled": true

Just to clarify a few of these.

blocklist-url: The blocklist comes from https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/.

cache-size-mb: You should consider a cache size based on your hardware. My machine has 8 GB of memory, so 128 MB won’t affect me too much.

rpc-password: You put your plain text password in the quotes, and then when Transmission runs it hashes the password, so if you open this file after Transmission has been run it will be some long string of letters and numbers.

rpc-port: You can choose any port you want, I prefer a nonstandard port so hackers won’t find it open and waiting if some exploit is found. But I really only have this port open on my internal network, so it isn’t as big a deal as if it were open to the internet.

rpc-username: I chose the same username as my Ubuntu username for simplicity.

rpc-whitelist: These are the IP addresses of clients that are allowed to connect to your transmission server, by either the web interface or by a client, like the Windows Transmission-Qt.

umask: This makes the downloaded files be read and writable by others, not just the transmission process. This is especially needed when accessing the downloaded files from your Windows machine.

watch-dir: If you put torrent files in the directory you specify here they will automajically start downloading.

After making all the changes to the settings.json you will need to restart the transmission-daemon service:

sudo service transmission-daemon restart

Using Transmission

At this point you should be able to navigate to the web interface and login too your Transmission torrent server by navigating to the server’s ip address, the port you specified under rpc-port, and then /transmission/web. My address ends up being http://10.13.14.10:50013/transmission/web/.

Transmission 3 Logging into the Web Interface

 

Now you can add torrents by clicking the blue folder and supplying a link to the torrent file, the uploading a torrent file.

I’ll cover in my next tutorial how to use a Samba share with Transmission to access the downloaded torrents and add torrents to be downloaded.


Leave a Reply

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