Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
I'm gonna try to explain this because many people get lost in the install.
That's the schema of our system when it's done:
wTorrent --> SCGI Gateway --> rtorrent
We need to set up a gateway server between wTorrent and rtorrent, that's the purpose of lighttpd or mod_scgi. In this guide I assume that you have a httpd server already set up with php and SQLite support, either lighttpd or apache.
Download xmlrpc-c 1.11 from it's website. Once you have the package downloaded follow these instructions:
tar -zxvf xmlrpc-c-1.11.00.tgz cd xmlrpc-c-1.11.00 ./configure --disable-cplusplus make make install
Ok, you should have xmlrpc-c properly installed by now, let's follow with rtorrent.
Install rtorrent with xmlrpc support
We are going to use the svn version, since it's the most updated one and probably the only one that works with wTorrent at the moment (stable and unestable releases have less xmlrpc methods and some parts of the interface might not work). Here's what we need to do:
mkdir rtorrent-svn cd rtorrent-svn svn co svn://rakshasa.no/libtorrent/trunk svn up cd trunk cd libtorrent ./autogen.sh ./configure make make install cd ../rtorrent ./autogen.sh ./configure --with-xmlrpc-c make make install`
If everything went ok you should now have rtorrent with xmlrpc interface properly installed, now let's gonna configure it, edit your .rtorrent.rc and add the following line:
scgi_port = localhost:5000
Install the scgi gateway
Here we are going to set up the gateway between wTorrent and rtorrent, there is more than one way to get this working, but here's what I recommend. If you already have a working apache server I would advise you to set up a lighttpd server in another port (like 81) as the scgi gateway, but you can also do the same with mod_scgi (but it's slower). If you have lighttpd as your httpd server you just need to add a few lines to lighttpd.conf.
Install lighttpd (I'm not going to write down what you need to do since it's a standart install). Make sure you also have installed php, php-xmlrpc, php-pdo and sqlite. Search for the server.modules section and add/uncoment the following line:
Then add this at the end of your file:
scgi.server = ( "/RPC2" => # RT_DIR ( "127.0.0.1" => ( "host" => "127.0.0.1", # Ip where rtorrent is listening "port" => 5000, # Port specified in .rtorrent.rc "check-local" => "disable" ) ) )
If you want to use auth for accesing the /RPC2 location you should create a htdigest file containing the allowed users with their passwords, copy this to a new file and execute it like ./file-name 'user' 'section name' 'password'
#!/bin/sh user=$1 realm=$2 pass=$3 hash=`echo -n "$user:$realm:$pass" | md5sum | cut -b -32` echo "$user:$realm:$hash"
Alternatively you can execute the following your prompt:
user=<YOUR_USERNAME>; pass=<YOUR_PASS>; echo $user:XML-RPC:`echo -n $user:XML-RPC:$pass | md5sum | cut -b -32` >> YOUR_USERS_FILE unset user; unset pass;
An example could be:
user=wtorrent; pass=rules; echo $user:XML-RPC:`echo -n $user:XML-RPC:$pass | md5sum | cut -b -32` >> ~/.wtorrent_users unset user; unset pass;
Search for the auth module in server.modules section of your lighttpd.conf and uncomment the line to activate it, if not present add it:
Then add this to lighttpd.conf:
auth.backend = "htdigest" auth.backend.htdigest.userfile = "/path/to/htdigest" auth.require = ( "/RPC2" => ( "method" => "basic", "realm" => "XML-RPC", "require" => "valid-user" ) )
You should also add the this line if you are already running Apache as your web server and want to use Lighttpd as a SCGI server:
server.port = 81 # RT_PORT
Using mod_scgi for apache
Install and enable mod_scgi for apache (if you don't know how to do this refer to your distribution for instructions). Add the following to httpd.conf:
SCGIMount /RPC2 127.0.0.1:5000
For auth with apache you have to create a htpasswd file, which can be done this way:
htpasswd -c /path/to/htpasswd username
After that add the following to httpd.conf
<Location /RPC2> AuthName "Private" AuthType Basic AuthBasicProvider file AuthUserFile /path/to/htpasswd Require user myrpcuser </Location>
In both cases your home.conf.php refering to rtorrent connection would look like:
define('RT_HOST','localhost'); define('RT_PORT',80); //Or 81 if using lighttpd.conf server.port option define('RT_DIR','RPC2/'); define('RT_AUTH', true); // Set to false if you have not set up auth define('RT_USER', 'user_name'); define('RT_PASSWD', 'password');
Download the release from the section below and extract it:
tar -zxvf wtorrent-alpha*.tar.gz
Enter the directory and copy the folder 'wtorrent' to your httpd server root folder, or wherever you want that your webserver is able to access.
Make your torrents, database, smarty compile and configuration folders (default torrents/, db/, tpl_c/ and conf/) writable by your web server user. You can do this with a chmod 777 or with chown.
chmod -R 777 wtorrent
Point your web browser to the url of the install.php file and follow instructions (very simple).
Delete install.php after proper installation. And if you are using lighttpd as your web server you should add the following line to your .conf file to prevent visitors from downloading your database:
url.access-deny = ("~", ".inc", ".db", ".tpl.php", ".cls.php",)
You're done, wTorrent should be succesfully installed by now. In case you want to reinstall delete/move your database (default is db/database.db) and point your web browser to the url of the install.php file again.