OpenWrt Forum Archive

Topic: [HowTo] rTorrent with webUi, RSS, GUi (WiN,MAC,DROiD)

The content of this topic has been archived on 2 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Introduction

It's been a year since i suffered with Transmission which consumed all the resources when there was a few torrents on the list and had no RSS support. A few days ago finally decided to get rTorrent even with my poor linux knowledge and after a few hours of research it seemed to be a better option but without any tutorial or how-to documentation on OpenWRT wiki space. So i thought i could share it!

rTorrent is a torrent client based on libtorrent and can be run in daemon mode with screen. There are plenty of webUi and GUi (win,linux,mac) out there and in this tutorial i will describe the ruTorrent webUi and Nativa GUi (mac).


Screenshots

rTorrent main view ruTorrent webUi  Nativa GUi (mac)


Installation

Install rTorrent and screen:

opkg install rtorrent screen

Get the config file and edit to your needs:

cd /root
wget -O .rtorrent.rc http://libtorrent.rakshasa.no/export/1303/trunk/rtorrent/doc/rtorrent.rc
vi .rtorrent.rc

note: be sure to keep the formatting of options and values=don't delete the spaces.


My settings for example:

min_peers = 40
max_peers = 120
min_peers_seed = 2
max_peers_seed = 6
max_uploads = 4
download_rate = 0
upload_rate = 20
directory = /mnt/torrent
session = /mnt/torrent/.session
port_range = 50800-65535
port_random = yes
check_hash = no
use_udp_trackers = yes
scgi_port = 127.0.0.1:5000
xmlrpc_dialct = i8     # for non english characters

note: if you using my config, don't forget to change the "directory" and "session" path to yours!


Verify that rTorrent is installed and configured properly:

rtorrent

note: you can quit with the CTRL+Q combination.


If everything was fine, continue with the init.d script:

vi /etc/init.d/rtorrent

and insert this:

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2012 OpenWrt.org

START=99

boot() {
     HOME=/root screen -dmS rtorrent rtorrent
}

start() {
     HOME=/root screen -dmS rtorrent rtorrent
}
  
stop() {
     killall rtorrent
}

Make it executable and enable:

chmod 755 /etc/init.d/rtorrent
/etc/init.d/rtorrent enable
/etc/init.d/rtorrent start

Usage

Key combos and usage of rTorrent:
rTorrent User Guide


rTorrent is running in the background, to bring it front type this:

screen -r

and to put it back:

CTRL+A+D

Thats it, now you have rTorrent installed. You're not satisfied with it? Keep reading and get more wink

(Last edited by gregrice on 18 Dec 2012, 13:04)

ruTorrent webUi tutorial

We have now rTorrent working and prepared for remote control, so it would nice to have some fancy webUi. Just follow the steps described below smile


Screenshots

ruTorrent main page ruTorrent settings pane ruTorrent dark theme


Installation

Install the required packages:

opkg install lighttpd php5-fastcgi libsqlite3 lighttpd-mod-access lighttpd-mod-auth  lighttpd-mod-scgi lighttpd-mod-fastcgi

Edit the lighttpd.conf in /etc/lighttpd to look something like this:

server.modules = ( 
   "mod_access",
# "mod_auth",     # work in progress
   "mod_fastcgi",
   "mod_scgi"
)

server.network-backend = "write"
server.document-root = "/www/"
index-file.names = ( "index.php", "index.html", "default.html", "index.htm", "default.htm" )

mimetype.assign = (  
   ".pdf"   => "application/pdf",
   ".class" => "application/octet-stream",
   ".pac"   => "application/x-ns-proxy-autoconfig",
   ".swf"   => "application/x-shockwave-flash",
   ".wav"   => "audio/x-wav",
   ".gif"   => "image/gif",
   ".jpg"   => "image/jpeg",
   ".jpeg"  => "image/jpeg",
   ".png"   => "image/png",
   ".css"   => "text/css",
   ".html"  => "text/html",
   ".htm"   => "text/html",
   ".js"    => "text/javascript",
   ".txt"   => "text/plain",
   ".dtd"   => "text/xml",
   ".xml"   => "text/xml"
 )

static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

server.port = 9092
server.pid-file = "/var/run/lighttpd.pid"

fastcgi.server = (
      ".php" => ((
      "host" => "127.0.0.1", 
      "port" => 1026,
       ))
)

#auth.debug = 2
#auth.backend = "plain"
#auth.backend.plain.userfile = "/etc/lighttpd/lighttpd.user"
#
# This kind of auth is not going to work with the Transdroid client
# I have to find another way.
#
#auth.require = (
#  "/" =>
#        (
#         "method"  => "basic",
#         "realm"   => "rutorrent",
#         "require" => "user=admin"
#         )
#)

scgi.server = (
     "/RPC2" =>
          ( "127.0.0.1" =>
               (
                "host" => "127.0.0.1",
                "port" => "5000",
                "check-local" => "disable"
                )
         )
)

server.event-handler = "poll"

Create the lighttpd.user in /etc/lighttpd:

echo "admin:admin" >> /etc/lighttpd/lighttpd.user

note: just skip this step if you kept commented the auth lines before


Get the ruTorrent files:

cd /www
wget http://rutorrent.googlecode.com/files/rutorrent-3.5.tar.gz
tar zxvf rutorrent-3.5.tar.gz
rm rutorrent-3.5.tar.gz
mv ./rutorrent/* ./
rm -r ./rutorrent

Edit ruTorrent config in /www/conf/config.php:

$scgi_port = 5000;
$scgi_host = "127.0.0.1";

Enable and start everything:

/etc/init.d/php5-fastcgi enable
/etc/init.d/lighttpd enable
/etc/init.d/php5-fastcgi start
/etc/init.d/lighttpd start

Open up webUi:
http://192.168.1.1:9092
And log in with admin/admin or whatever you echoed in the lighttpd.user file.


Optional - Plugins (needed for RSS, Themes, etc...)

Get the plugins package:

cd /www
wget http://rutorrent.googlecode.com/files/plugins-3.5.tar.gz
tar zxvf plugins-3.5.tar.gz
rm plugins-3.5.tar.gz

Edit plugins.ini in /www/conf to your needs:
  --- only enable plugins what you really need ---
because it can consume a lot of mem and resource!

Mine looks like this:

[default]
enabled = no
canChangeToolbar = yes
canChangeMenu = yes
canChangeOptions = yes
canChangeTabs = yes
canChangeColumns = yes
canChangeStatusBar = yes
canChangeCategory = yes
canBeShutdowned = yes

[rss]
enabled = yes

[theme]
enabled = yes

note: with this config by default every plugin will be disabled except what you not defined (like rss and themes)


Restart ruTorrent:

/etc/init.d/php5-fastcgi restart
/etc/init.d/lighttpd restart

Open up webUi, plugins should be already working:
http://192.168.1.1:9092
note: plugins will load when ruTorrent is opened in a browser, but some plugins - like rss - would be good to have running in the background from rTorrent startup. Instructions are below in the next post for the rss plugin, but it can be adapted to other plugins.


Now you have rTorrent with a nice webUi  installed and working. Not enough? Keep reading wink

(Last edited by gregrice on 18 Dec 2012, 11:22)

ruTorrent webUi RSS Tutorial - WiP

This plugin is designed to fetch torrents via rss download links.
It has 2 main parts, one for entering feeds, the other for setting up filters.


Somehow this one i can't get to work with any setups,
so any help would be appreciated!

Installation

If you've followed my ruTorrent tutorial optional part,
then you should have it already in your plugins directory.
In case you not:

cd /www/plugins
wget [url]http://rutorrent.googlecode.com/files/rss-3.5.tar.gz[/url]
tar zxvf rss-3.5.tar.gz
rm rss-3.5.tar.gz

Install json and fix config files:

opkg install php5-mod-json

config.php in /www/conf:

$pathToExternals = array(
 "php"  => '/usr/bin/php-fcgi', 
 "curl" => '',
 "gzip" => '/bin/gzip',
 "id" => '/usr/bin/id',
);

php.ini in /etc:

; Dynamic Extensions
extension=json.so

Restart everything:

/etc/init.d/rtorrent restart
/etc/init.d/php5-fastcgi restart
/etc/init.d/lighttpd restart

Here comes the nasty part:

HELP NEEDED!

When you done all this and uncommented the "extension=json.so" line then the php-fcgi will show an error at start "PHP Warning: Module 'json' already loaded in Unknown on line 0 openwrt". I'm not sure yet what is loading it already besides the php-fcgi, but the RSS plugin gives me the same error - no matter if you installed the json or not - "Bad response from server: (500 [error,getplugins])". Also the webUi or GUis can't connect to the rTorrent.


Get the RSS plugin load with rTorrent (not just with the webUi):
edit .rtorrent.rc in /root

execute = {sh,-c,/usr/bin/php-fcgi /www/php/initplugins.php &}

note: do not follow this step if you have the above issues as me!


Usage

The ruTorrent wiki have a very nice user guide with pictures and detailed instructions on use:
ruTorrent: RSS Plugin User Guide

(Last edited by gregrice on 18 Dec 2012, 12:54)

Nativa rTorrent GUi for Mac

Nice and smart rTorrent GUi for Mac users, written in cocoa.


Screenshots

Nativa main window Nativa network settings Nativa bandwith settings


Installation

Fire up Terminal and get Nativa

curl -LO http://bitbucket.org/vovasty/nativa/downloads/Nativa-0.4.6.zip
tar zxvf Nativa-0.4.6.zip
rm Nativa-0.4.6.zip
mv Nativa.app /Applications

Launch and setup:
Nativa is now should be in your Applications with a "drawn little girl" icon.
After first launch the "Nativa Configuration Assistant" will show up. For now
choose the "Connect via SSH tunnel" and on the next pane enter IP for the router
which running the rTorrent and the SSH username/password (not the one for the webui!).
The app will check connection and proceed to the SCGi port and remote download folder location setup.
If you want remote downloads folder you need a working Samba server on your router with the
downloads folder shared. When you've finished you can mount it with the following command:

mount -t smbfs //GUEST:@smb-server_name/smb-share_name /Volumes/mountname

This is good as the Transmission, isn't it?! smile Keep reading for the Android client!

(Last edited by gregrice on 18 Dec 2012, 11:41)

thank you!!!

Transdroid rTorrent remote for Android

Manage your torrents from your Android device with Transdroid. All popular clients are supported, including ĀµTorrent, Transmission, rTorrent, Vuze, Deluge and BitTorrent 6. You can view and manage the running torrents and individual files. Adding is easy via the integrated search, RSS feeds or the barcode scanner. Monitor progress using the home screen widget or background alarm service.


Screenshots

Main view Torrent details Choose site to search Search results
note: looks nice also on tablets!


Installation

Download latest Transdroid:
http://transdroid.org/latest

to use the Search Feature get this library also:
http://transdroid.org/latest-search


Setup

On the Transdroid main screen at the bottom choose "Open Settings",
then "Add new server" and give details of your rTorrent server:

Name: rTorrent
Server type: rTorrent
IP or domain name: 192.168.?.? (your routers ip address)
Port: 9092
Use authentication: no (since we don't have one for now)
SCGi folder: /RPC2
Server OS: Linux
Base (S)FTP url: (to use this feature install some ftpd and share the downloads directory of rTorrent)

Now press back button twice and Transdroid is already connected to rTorrent.


We already have now a set up and running rTorrent server with a nice webUi and GUi for Mac and Android, but if it's still not enough then keep reading for the Windows GUi tutorial wink

(Last edited by gregrice on 18 Dec 2012, 12:52)

Windows rTorrent GUI

*** work in progress ***

tao of badass wrote:

thank you!!!

I'm glad if it helps you and save your time smile
Still working on it, so if something not working perfect please be patient.

Hey gregrice,

first of all, thank you for that great tutorial. I used it on my Netgear WNDR3700 as replacement for Transmission and I must say rtorrent really is much better choice. I was having non-stop problems with router resetting while using Transmission as I'm on fiber 100mbit and as soon as it began to download something bigger/faster, the memory overflow happened and router reset. Otherwise, if I limited memory to use with Transmission, the CPU was always at 100% and route practically unaccessible.

However, I am wondering if you managed to solve that RSS automatic downloader to use with rtorrent? I am currently registered with seedbox where practically same configuration is running (rtorrent+rutorrent+plugins) and there RSS automatic download is working flawlessly. I can download the whole setup and configuration files via scp if you would need something maybe. I am really interested in setting up automatic RSS downloader at home also...

I also found this thread:
https://forum.openwrt.org/viewtopic.php?id=31294
I don't know if this is somehow related to that rutorrent RSS plugin, but it seems that it does the same... I didn't test it yet however.

I would also send you a PM, but I can't find an option here to do so. I hope you will see this thread...

Thanks in advance!

(Last edited by keglevich on 23 Mar 2013, 22:08)

gregrice wrote:

When you done all this and uncommented the "extension=json.so" line then the php-fcgi will show an error at start "PHP Warning: Module 'json' already loaded in Unknown on line 0 openwrt". I'm not sure yet what is loading it already besides the php-fcgi, but the RSS plugin gives me the same error - no matter if you installed the json or not - "Bad response from server: (500 [error,getplugins])". Also the webUi or GUis can't connect to the rTorrent.

I got the same error after installing php5-mod-json, rutorrent and rutorrent rss-plugin.
You need to set date.timezone in php.ini and install zoneinfo-core and zoneinfo-[your_region] packages.
After that rutorrent and rss-plugin works.

You don't need to uncommented the "extension=json.so" line in php.ini, it automatically includes from /etc/php5/json.ini

Thank you desper for that information. Great catch, well done! Setting date.timezone variable in php.ini really solves that issue with RSS. Now I finally have complete working setup with openwrt.

Thanks again, best regards!

I'm new to openwrt and followed these instructions for rtorrent and the gui.  Now I cannot access my openwrt gui.  The addres (192.168.1.1) goes directly to rutorrent.  Can anyone help out?  Thanks

edit -
I tried to reinstall plugins because I was getting an error, but now I just get the rutorrent screen at 192.168.1.1 and it just says "loading".  Nothing seems to be loading though.

(Last edited by jstnhickey on 18 Jan 2014, 21:22)

jstnhickey wrote:

I'm new to openwrt and followed these instructions for rtorrent and the gui.  Now I cannot access my openwrt gui.  The addres (192.168.1.1) goes directly to rutorrent.  Can anyone help out?  Thanks

edit -
I tried to reinstall plugins because I was getting an error, but now I just get the rutorrent screen at 192.168.1.1 and it just says "loading".  Nothing seems to be loading though.

Here's what I think is the reason:

Luci (the OpenWrt GUI) runs off uhttpd. You are presumably installing lighttpd, which is conflicting with uhttpd, rendering both webservers useless. Unless you can set it up yourself using php5 and uhttpd, the two probably won't work together.

I believe the transmission web gui works with Luci, so that might be a better bet for you over rtorrent?

With a combination of leechTTYtter and rtorrent, it is possible to download via RSS and have twitter tweet you when it is finished downloading.

If anyone is interested, I'll write up a short howto.

(Last edited by flippant on 4 Feb 2014, 12:30)

flippant wrote:

With a combination of leechTTYtter and rtorrent, it is possible to download via RSS and have twitter tweet you when it is finished downloading.

If anyone is interested, I'll write up a short howto.

That would be great.

i cant find rTorrent in trunk? is it removed?

It's there.

root@TheRouter:~# opkg list rtorrent
rtorrent - 0.9.3-git--1
root@TheRouter:~# 

(Last edited by flippant on 6 Feb 2014, 08:05)

Hello. Some additional packages that was necessary here (OpenWrt Attitude Adjustment 12.09-rc1):

opkg install coreutils-stat (used by rutorrent)
opkg install zoneinfo-core (to solve a php5 fatal error)
opkg install zoneinfo-southamerica (my case)

Hello, I'm new to this so please excuse my noob

tried on latest stable Barrier Breaker

at part 2 when attempting to wget the rtorrent config the link is invalid and I am unable to find a valid link elsewhere so I used someone else's and edited it and then in the process of debugging I have edited it to almost the same as the example here.

at part 4 when testing rtorrent installation i get the error "rtorrent: XMLRPC not supported"

at part 8 when testing screen -r i get the error:
"There is a screen on:
        3228.pts-0.OpenWrt      (Attached)
There is no screen to be resumed."



Game Over.

(Last edited by Xtrapolate on 3 Nov 2014, 21:37)

Xtrapolate wrote:

...
tried on latest stable Barrier Breaker

at part 2 when attempting to wget the rtorrent config the link is invalid and I am unable to find a valid link elsewhere so I used someone else's and edited it and then in the process of debugging I have edited it to almost the same as the example here.

at part 4 when testing rtorrent installation i get the error "rtorrent: XMLRPC not supported"
...
Game Over.

I got the same with the version in Barrier Breaker. But: I managed to install rtorrent on Barrier Breaker by installing the 'rtorrent-rpc' package from the current snapshot. (I'm using TP-Link Archer C5 .)

# opkg update
# opkg install rtorrent

This will install all the dependencies as well.

# opkg install xmlrpc-c-server

This is needed by the new build (and will install more packages).

Check what's the full URL of the current version of rtorrent-rpc in the snapshot repo:

https://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/packages/

For me today:

https://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/packages/rtorrent-rpc_0.9.4-git-2_ar71xx.ipk

Download the new build, remove the old one (BarrierBreaker) package, then install the new one:

# cd /root
# wget --no-check-certificate https://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/packages/rtorrent-rpc_0.9.4-git-2_ar71xx.ipk
# opkg remove rtorrent
# opkg install ./rtorrent-rpc_0.9.4-git-2_ar71xx.ipk

And probably it's worth to save (copy) the downloaded working package for later use smile

All we have to do is just download a sample config file and modify it:

# cd root
# wget --no-check-certificate -O .rtorrent.rc https://raw.githubusercontent.com/rakshasa/rtorrent/master/doc/rtorrent.rc

Let's see if it runs well:

# screen -AR
# rtorrent

That's it! smile

Ps: a big thanks to gregrice (original poster)!!!

(Last edited by chros on 3 Dec 2014, 18:31)

rutorrent has taken over luci, I mean when I try to open 192.168.1.1:80 all I see is rutorrent

and at http://192.168.1.1:9092/ I see the following error

[20.06.2016 01:45:09] WebUI started.
[20.06.2016 01:45:09] Bad response from server: (403 [error,getplugins]) <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>403 - Forbidden</title> </head> <body> <h1>403 - Forbidden</h1> </body> </html>
[20.06.2016 01:45:09] Bad response from server: (403 [error,getuisettings]) <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>403 - Forbidden</title> </head> <body> <h1>403 - Forbidden</h1> </body> </html>

The discussion might have continued from here.