Phil Sturgeon

Web developer, kayaker, outdoors madman and part-time alcoholic.


How to: Install Transmission CLI to Ubuntu Server

Posted Linux at Feb 27, 2009

I made this guide as I had a little trouble finding all the correct informaiton required to get this set up. Some of it was scattered around the Transmission Wiki, some on random blogs and some was just missing. This guide will help compile everything into one place to hopefully save some of you a little time.

The repositries we will be using are unofficial repositries maintained by "kas". The original post can be found here. This needs to be done so we can get the newest stable version of Transmission, as the newest version you can get from the Ubuntu Server 8.10 default list of repositries is 1.32 and sadly that version is no longer supported by the Transmission team.

Main setup

Adding the Unofficial Transmission repositry

$ sudo vim /etc/apt/sources.list

Enter the two lines below that correspond to your Ubuntu Server version. Press A to start writing using vim.

Hardy Heron - 8.04

deb http://ppa.launchpad.net/transmissionbt/ubuntu hardy main deb-src http://ppa.launchpad.net/transmissionbt/ubuntu hardy main

Intrepid Ibex - 8.10

deb http://ppa.launchpad.net/transmissionbt/ubuntu intrepid main deb-src http://ppa.launchpad.net/transmissionbt/ubuntu intrepid main

Jaunty Jackalope - 9.04

deb http://ppa.launchpad.net/transmissionbt/ubuntu jaunty main deb-src http://ppa.launchpad.net/transmissionbt/ubuntu jaunty main

When you are done hit ESC then :wq and Enter to write and quit the file.

Now you need to import the GPG signing key for the stable repository. Enter these two lines into the terminal:

$ gpg --keyserver keyserver.ubuntu.com --recv 976b5901365c5ca1 $ gpg --export --armor 976b5901365c5ca1 | sudo apt-key add -

Now that you have added these repositries we must update apt

$ sudo apt-get update

Run the following code to install the transmission-cli package along with the transmission-common package which provides shared code between the CLI and GUI versions.

$ sudo apt-get install transmission-cli transmission-common

After the scrolling madness you should be able to spot the following:

Setting up transmission-common (1.50-0ubuntu0~intrepid0) ... Setting up transmission-cli (1.50-0ubuntu0~intrepid0) ...

This means you have the newest version (at time of writing this guide) so things are going correctly so far.

Now, lets start setting it up. The Transmission developers reccomend we run transmission with it's own user for various security reasons, this also means we can put transmission configuration into its own home directory.

$ sudo adduser --disabled-password transmission $ sudo su transmission

To create the settings file, we can start the daemon and tell it where to put the files. This command will run forever waiting for incoming connections, so as soon as it sits still press Ctrl + C to cancel out of it.

$ transmission-daemon -g /home/transmission/.config/transmission-daemon -f

When you have canceled this process you will see it says - amoungst other things - the following text:

Saved "/home/transmission/.config/transmission-daemon/settings.json

Exit out of being the transmission user and return to your usual login.

$ exit

Now you need to decide where you want to put your download files. Unlike rtorrent which I was previously using, transmission-cli is not able to use different directories for unfinished files and whatnot (without hackery). So instead create a single folder that will contain partial and complete downloads. This happens to be where I put mine:

$ sudo mkdir /mediaserver/torrents/Downloads $ sudo chmod 777 /mediaserver/torrents/Downloads

Now we can change these settings using vim again. Most of these can be left alone, but if you want the web interface to work you will need to modify a few.

Set the download-dir setting to the path you just created above:

"download-dir": "/mediaserver/torrents/Downloads",

Now, if you are going to be using the web interface you will need to configure how you want access to work.

Local network users only:

"rpc-whitelist": "127.0.0.*,192.168.*.*", "rpc-whitelist-enabled": 1,

Log in from anywhere (with a password):

"rpc-authentication-required": 1, "rpc-enabled": 1, "rpc-password": "password01", "rpc-port": 9091, "rpc-username": "username", "rpc-whitelist": "*", "rpc-whitelist-enabled": 0,

Now that the transmission daemon is all configured it can be started.

$ transmission-daemon

Check running by filtering the running process list for any process with the word "transmission" in it.

$ ps aux | grep transmission

Stopping/Restarting the daemon

If you need to stop transmission-daemon for any reason such as to edit the config files, the only method I have found (without adding in a custom start-script) is to kill it which seams a little mean.

$ ps aux | grep transmission

This command once again checks for any transmission processes by matching the name. Look for the first number in the line that will look similar to the one below and use that number in the second command to kill it.

username 8785 0.1 0.5 15928 3052 ? Ssl 16:43 0:00 transmission-daemon
$ kill -9 8785

Then you can edit it and start it up again with:

$ transmission-daemon

Testing

To trial run the torrents are working it is a good idea to use a heavily seeded torrent such as an ubuntu release. This is a random one I picked for my testing, use any torrent you like.

$ wget http://releases.ubuntu.com/8.10/ubuntu-8.10-desktop-amd64.iso.torrent $ transmission-remote --add ubuntu-8.10-desktop-amd64.iso.torrent $ sudo rm ubuntu-8.10-desktop-amd64.iso.torrent

Now finally, if you are using the weub GUI you can access it using the server's IP address and the URL below:

http://server.ip.address:9091/transmission/web/

To mask this URL and port (e.g http://torrents.example.com/) check out my guide on creating Apache proxies.

Setting it to run on boot

So far we have a working torrent client that will run whenever we ask it, but that is probably not 100% useful for most media server users. If you want this to start on boot, the Transmission developers have provided us Debian/Ubuntu users with an init.d script to run. You can find the Transmission init.d boot script here, so copy the content of the script at the bottom, enter the command below, press "a" to start editing and paste it in.

$ sudo vim /etc/init.d/transmission-daemon
Press A to edit.
Paste (different in all terminals, start with a right click and take it form there).
Press Esc
Type ":wq" to write and quit

Now you need to give it permission to be executed as a script and add it to the boot up procedure.

$ chmod +x /etc/init.d/transmission-daemon $ sudo update-rc.d transmission-daemon start 51 S .

Done! Restart your machine and test it out. I will be writing a follow up article on how to add some great extra features to this program shortly, so keep an eye on the RSS feed.

Comments

User comments
  • Gravatar Chris

    Jul 22, 2009

    Tried this on Hardy today and current version is now 1.72. transmission-deamon is no longer part of transmission-cli, it has it's own package and it automatically starts the deamon on boot. Install is now much simpler.
    -Enable the repo as described here
    -install transmission-daemon
    -stop daemon
    -edit /etc/transmission-daemon/settings.json as required
    -start daemon
    You're done!

  • Gravatar Frans Van Der Star

    Jul 06, 2009

    Shri,

    Not tried but i think you need to be root for this: sudo -i

  • Gravatar Shri

    Jul 05, 2009

    when I key in the command transmission-daemon -g /home/transmission/.config/transmission-daemon -f

    I get following message:


    "/home/transmission/.config": Permission denied

    Any idea, how to solve this?

    Thanks for your help

  • Gravatar Phil Sturgeon

    Feb 27, 2009

    Captcha is being an idiot at the moment. Please register to comment without a captcha form or send your feedback via the contact form. Any feedback sent to me will be posted as comments when its fixed (or inserted directly to the database).

Post a comment