[HowTo] rtorrent instead of transmission (rewritten and tested)

sudo -s
apt-get update
apt-get install rtorrent screen
cd /etc/ssl/certs
wget --no-check-certificate https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Global_eBusiness_CA-1.cer
mv Equifax_Secure_Global_eBusiness_CA-1.cer Equifax_Secure_Global_eBusiness_CA-1.pem
c_rehash

mkdir -p ~/torrents/watch
mkdir -p ~/torrents/incomplete
mkdir -p ~/torrents/complete
touch ~/.rtorrent.rc
nano  ~/.rtorrent.rc

a simple default config is provided here if you dont like the options change them to your preferance before adding them in your system

# This is an example resource file for rTorrent. Copy to
# ~/.rtorrent.rc and enable/modify the options as needed. Remember to
# uncomment the options you wish to enable.
 
# Maximum and minimum number of peers to connect to per torrent.
min_peers = 1
max_peers = 100
 
# Same as above but for seeding completed torrents (-1 = same as downloading)
min_peers_seed = 1
max_peers_seed = 50
 
# Maximum number of uploads single torrent may use
max_uploads = 10
 
# Maximum number of simultaneous downloads
max_downloads_global = 10
# Maximum number of simultaneous uploads
max_uploads_global = 20
 
# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0
upload_rate = 0
 
# Default directory to save the downloaded torrents.
directory = ~/torrents
 
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = ~/torrents/.rsession
 
# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = watch_directory,5,5,load_start=~/torrents/watch/*.torrent
schedule = tied_directory,6,5,start_tied=
schedule = untied_directory,7,5,stop_untied=
 
# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=2000M
 
# Periodically save session data
schedule = session_save,240,300,session_save=
 
# Enable the default ratio group.
# ratio.enable=
# Change the limits, the defaults should be sufficient.
# Upload to a minimum ratio of 4.0
# ratio.min.set=400
# Upload to a maximum ratio of 20.0
# ratio.max.set=2000
# Upload a minimum of 250 MB
# ratio.upload.set=250M
 
# When seeding ratio is reached close the torrent
# system.method.set = group.seeding.ratio.command, d.close=
 
# Move files to ./unsorted when download completes
system.method.set_key = event.download.finished,move_complete,"execute=mv,-n,$d.get_base_path=,~/torrents/complete/;d.set_directory=~/torrents/complete"
 
# Port range to use for listening.
port_range = 33101-33199
 
# Start opening ports at a random position within the port range.
port_random = yes
 
# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
encryption = allow_incoming,try_outgoing,enable_retry,prefer_plaintext
 
# Sort the main view by ratio
view.sort_current = main,greater=d.get_ratio=
view.sort_new = main,less=d.get_ratio=
view.sort = main
 
# Sort the seeding view by the upload rate and only show torrents with peers
view.sort_current = seeding,greater=d.get_up_rate=
view.filter = seeding,"and=d.get_complete=,d.get_peers_connected="
view.sort_new = seeding,less=d.get_up_rate=
view.sort = seeding
 
# Sort the leeching view by name
view.sort_current = leeching,greater=d.get_name=
view.sort_new = leeching,greater=d.get_name=
view.sort = leeching
 
# Filter the active view by connected peers
view.sort_current = active,less=d.get_name=
view.sort_new = leeching,less=d.get_name=
view.filter = active,d.get_peers_connected=
view.sort = active
 
schedule = sort_main,11,5,view.sort=main
schedule = sort_seeding,12,5,view.sort=seeding
schedule = sort_leeching,13,5,view.sort=leeching
schedule = sort_active,14,5,view.sort=active
 
# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
# 
dht = auto
 
# UDP port to use for DHT. 
# 
dht_port = 6881
 
# Enable peer exchange (for torrents not marked private)
#
peer_exchange = yes

# webui
scgi_port = 127.0.0.1:5000

create this service file at /etc/systemd/user/rt.service

sudo nano /etc/systemd/system/rt.service

[Unit]
Description=rTorrent
After=network.target

[Service]
Type=forking
KillMode=none
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=%h

[Install]
WantedBy=multi-user.target

then its time to fire up rtorrent

systemctl enable rt
systemctl start rt

now for the more advance parts for the webui

(coming soon gonna use nodejs)

Works on RPI 1 & 2, Vero

Hi Toast,

Thank You very much for this guide. I really wish to install rTorrent and ruTorrent in my osmc Raspberry, but something is going wrong, because when I send:

systemctl enable rt@$osmc

I’ve got:
Failed to execute operation: No such file or directory

And when I try:

apt-get install lighttpd php5-fastcgi libsqlite3 lighttpd-mod-access lighttpd-mod-auth lighttpd-mod-scgi lighttpd-mod-fastcgi
I’ve got E:

Unable to locate package php5-fastcgi
Unable to locate package libsqlite3
Unable to locate lighttpd-mod-access
Unable to locate lighttpd-mod-auth
Unable to locate lighttpd-mod-scgi
Unable to locate lighttpd-mod-fastcgi

Could you please help me? I really appreciate your help
Best regards and sorry for my english
Juan

I finally got time to test this and I’m stuck at the 2nd command. I get this error message:
“E: Unable to locate package rtorrent”

EDIT: Found a solution I think, I needed to run this command before “sudo apt-get update”

EDIT2: Another error message. When I try to run this command “systemctl enable rt@$osmc” I get the error message: “Failed to execute operation: Access denied”

you forgot to run as root

sudo

When I run that command with sudo I only get “Failed to execute operation: No such file or directory”

What is rt@$osmc supposed to be ? doesn’t look like a valid service name to me.

Assuming you spelt systemctl right I assume it is complaining about the name of the service - where did you get that name from ?

I am copy/paste’ing everything from Toast’s guide up here. My Linux knowledge is very limited so can’t say much about services and such.

This guide originated from a request/suggestion I made here: rTorrent for App Store?

that was my fuckup too used to arch rather then debian

try this instead

sudo -s
systemctl enable rt
systemctl start rt

“systemctl enable rt” still gives me: “Failed to execute operation: No such file or directory”

create this file at this location
/etc/systemd/system/rt.service

[Unit]
Description=rTorrent
After=network.target

[Service]
Type=forking
KillMode=none
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=%h

[Install]
WantedBy=multi-user.target

again if you have a limited knowledge of how linux works perhaps transmission is better suited for you

Like I said from the start, I like rTorrent because it is very light on resources and will barely be noticeable on CPU/Memory usage. Also said that maybe I’m better off waiting for another torrent client becomes available in the appstore. However I would try Transmission if it weren’t for the fact that it is banned where I use it so not an option.

What I hoped for was an automated installer like jenkins made for openelec: http://openelec.tv/forum/rtorrent/42796-rtorrent-service-addon

I don’t mean to critisize OSMC, I think it’s a really nice OS. But just giving my opinion, and that is without good torrent client support it loses much of it’s appeal. Being able to have a always-on machine that handles all my torrents being completely silent and only consumes a few watts is really nice, and at the same time being a great HTPC.

Hi,
I’ve been unable to make the Toast’s guide to work. I think it doesn’t work cause there’s some packets that doesn’t exist, but hopefully I’ve find a way to install rTorrent and ruTorrent, both work like a charm in a raspy one osmc.
First you need to make a fresh osmc install, then in settings change the web server port to anything different to 80, mine is settled at 8091, then run the magic script: look in google for RTorrent-Auto-Install-3.0.2-Debian-Jessie. It takes several hours to install everything but it works for me . I hope It can helps.
Best regards and sorry for my English
PD: Don’t know if it’s possible to post the direct Link to script, so I don’t post it
Juan
It works flawlessly on pi2 too

@Toast

I’ve manged to enable the service, by locating the rt.service description in /etc/systemd/system instead of /user/

But i can’t seem to able to start the service using systemctl start rt, it just says that the job fails with statuscode 203.

Edit had to install screen

apt-get install screen

Works like a charm, the guide has to be updated.

Hi Toast,
thanks for your HOWTO. Maybe you want to edit the first post to change the location of the rt-service from /etc/systemd to /etc/systemd/system ?
With the original location the systemctl start rt command would fail.

Also I’d like to ask if the .rtorrent.rc config you suggest does actually use the complete/incomplete/watch directories you made us create.

Another observation: it is not reccommended to run rtorrent as root. Maybe it would be better to have the torrent directory tree owned by the same regular user such as osmc which might then use it ?

And a last question is about the rutorrent web interface … do you have instructions for that too ?

Take care

With Juon “google for RTorrent-Auto-Install-3.0.2-Debian-Jessie” and LAMB-service that is in beta testing, this worked like a charm.

there is this revolutionary thing called hyperlink that allows you to link stuff on the web mail wanna give that a go

It’s an install script that installs packages needed and compiles rtorrent+rutorrent (even installs apache + php, if not installed allready)

https://github.com/Kerwood/rtorrent.auto.install/blob/master/Rtorrent-Auto-Install-3.0.2-Debian-Jessie

The file is not available anymore on github. Is there a newer one r was it moved ?

Thanks

try this:

wget -O rtorrent_install.sh https://raw.githubusercontent.com/Kerwood/Rtorrent-Auto-Install/master/Rtorrent-Auto-Install-4.0.0-Debian-Jessie
chmod +x rtorrent_install.sh
./rtorrent_install.sh

The script works as expected. I’m wondering is it possible that I postopne the rtorrent service for a minute after startup? I don’t have enough linux knowledge on how to do that. Can anyone help me postopne rtorrent.service that is used in that script to postopne startup for a munute? The problem is because usb drive isn’t mounted fast enoug and torrents cant find files on ext drive, so I need to postopne rtorrent.

Thanks