Setting up Transmission daemon on Ubuntu home server

Discussion of Transmission that doesn't fit in the other categories
Post Reply
panzerneo
Posts: 1
Joined: Tue Feb 10, 2009 6:13 am

Setting up Transmission daemon on Ubuntu home server

Post by panzerneo »

Here are the results of my struggle to install Transmission as a daemon on my home server.

I'm only using Transmission remotely, via the Web Interface via my MacBook and Firefox.

I will also show how to setup a scheduled task to choke Transmission when I'm at home and have it run full throttle
when I'm gone to work.

First of all, my server has a minimalist VIA EPIA motherboard with a C3 processor, fanless.
So, needless to say, it's not a powerhouse and every bit of software must be carefully tuned (sweet for geeks :)

Also, I'm a Linux newbie, so this post is intended to help other newbies, gurus, please don't bash!

Step 0: install Transmission:

Code: Select all

 sudo apt-get install Transmission
We're going to install Transmission as a daemon, for that we'll install sysv-rc-conf first.
It's a command-line utility to manage daemons. It has an n-curse interface that mimic a gui.
If you don't know squat about daemons and run-levels, I suggest to scan through this Linux Boot Introduction

Step 1: install sysv-rc-conf

Code: Select all

 sudo apt-get install sysv-rc-conf
Step 2: install the Transmission daemon
follow these instructions to create an init script (called transmission-daemon in the following)

Code: Select all

sudo sysv-rc-conf transmission-daemon on
this should install Transmission as a daemon for runlevel 2 to 5. (basically your average user)
Not sure how to specif to run as a given user (if you have created a transmission user, as specified in the headless wiki)

You can verify that Transmission is now running:

Code: Select all

pgrep -l transmission
this should return something like this:

> 23434 transmission

Verify your RPC options (controls the Web Interface):

Code: Select all

cat ~/.config/transmission/settings.json | grep rpc-
should return:

Code: Select all

"rpc-access-control-list": "+127.0.0.1, +192.168.1.*", 
    "rpc-authentication-required": 0, 
    "rpc-enabled": 1, 
    "rpc-password": "S5JKW2qfdeyZNMyk", 
    "rpc-port": 9091, 
    "rpc-username": "transmission", 
Note how the localhost and other computers on my network are allowed to connect:
rpc-access-control-list": "+127.0.0.1, +192.168.1.*"
(My wifi-router is at 192.168.1.1 )

Make sure your server's firewall (if you have one, Ubuntu does not by default, as far as I know) does allow
for port 9091 to be open, otherwise your other computers will not 'see' Transmission at http://your_servers_ip:9091

Since I use a MacBook to control everything from my bed, I also added a bookmark via Delicious's Firefox extension to this address:
http://your_servers_ip:9091
I set the keyword to 'bt', this way, when I want to check my torrents real quick, I just type 'bt' in Firefox's address bar.
This is super fast!

I always set the encryption to 'forced', since I got a letter from the Boss one day...

Code: Select all

cat ~/.config/transmission/settings.json | grep encryption
should return:

"encryption": 2,

Step 3: the scheduled task ( a.k.a. the Cron Job)

Ubuntu uses crontab. I used this tutorial

Code: Select all

crontab -e
select the nano editor, if you're a newbie like me :)

Inside the editor enter this:

Code: Select all

# m h  dom mon dow   command

#  at 6 a.m. everyday, force Transmission download and upload bandwidths to 0 KB/s, I need to read the NYTimes online!
0 06 * * * /usr/bin/transmission-remote -d 0 && /usr/bin/transmission-remote -u 0 > ~/log/cron-transmission.out.log 2> ~/log/cron-transmission.err.log

# at 11 a.m. Monday through Friday, restore Transmission download and upload bandwidths to Unlimited (I'm at work, so might as well download something:)
0 11 * * 1-5 /usr/bin/transmission-remote -D &&  /usr/bin/transmission-remote -U > ~/log/cron-transmission.out.log 2> ~/log/cron-transmission.err.log

# at 5 p.m. Monday through Friday, , force Transmission download and upload bandwidths to 0 KB/s
0 17 * * 1-5 /usr/bin/transmission-remote -d 0 && /usr/bin/transmission-remote -u 0 > ~/log/cron-transmission.out.log 2> ~/log/cron-transmission.err.log

# at 2 a.m. everyday, restore Transmission download and upload bandwidths to Unlimited (I'm at work, so might as well download something:)
0 02 * * * /usr/bin/transmission-remote -D &&  /usr/bin/transmission-remote -U > ~/log/cron-transmission.out.log 2> ~/log/cron-transmission.err.log

#note that during the weekends, Transmission will only run from 2am to 6am
note: "> ~/log/cron-transmission.out.log 2> ~/log/cron-transmission.err.log" is simply to record the job outcome
this WILL FAIL if the directory ~/log does not exist! To create one, just type:

Code: Select all

mkdir ~/log


and you're done!

Please, post comments, advice, etc!
BadCam
Posts: 1
Joined: Sat Oct 17, 2009 4:16 am

Re: Setting up Transmission daemon on Ubuntu home server

Post by BadCam »

I've sucessfully gotten to this point here:
cat ~/.config/transmission/settings.json | grep rpc-
However when I run this I get the following:

Code: Select all

cat: /home/badcam/.config/transmission/settings.json: No such file or directory
I ran your instructions logged into the server as Badcam. Badcam has sudo rights.

Have I missed something?

Thanks.
Post Reply