Rutorrent
From Fastsh.it
Contents |
[edit] Step 1 - Dependencies
You'll probably already have everything except subversion, but just to be sure...
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libsigc++-2.0-0c2a libsigc++-2.0-dev libncurses5 libncurses5-dev ncurses-base subversion php5-common php5-cgi php5-curl php5-xmlrpc build-essential make gcc autoconf libwww-dev libwww0 curl libcurl3 libcurl4-openssl-dev libtool
[edit] Step 2 - Web server
You'll need a web server set up to serve PHP. If you don't have one already, follow this tutorial.
[edit] Step 3 - rutorrent
Navigate to the web root
cd /var/www
and download rutorrent
wget http://rutorrent.googlecode.com/files/rutorrent-3.2.tar.gz
and extract it
tar xzf rutorrent-3.2.tar.gz
and remove the extracted archive
rm rutorrent-3.2.tar.gz
and rutorrent is now installed. You should now be able to access it at http://<SUBDOMAIN>.fastsh.it/rtorrent.
Step 4 - Configuration
Go to rutorrent and click on the tab called "Logger". There'll be an error that says rutorrent can't communicate with rtorrent. There might also be an error that mentions xmlrpc-c; if so, you'll need to compile rtorrent with xmlrpc-c.
To enable communication between rutorrent and rtorrent, we'll need the RPC plugin for rutorrent. To install it, simply
cd /var/www/rtorrent/plugins/
wget http://rutorrent.googlecode.com/files/rpc-3.2.tar.gz
tar xzf rpc-3.2.tar.gz
rm rpc-3.2.tar.gz
and reload the rutorrent page.
Next, we need to edit the rtorrent configuration file
nano ~/.rtorrent.rc
Look for a line similar to "scgi_port = localhost:5000". If it doesn't exist, create it. If it's slightly different, change it.
All your torrents should now be visible in rutorrent.
[edit] Recompiling rtorrent with xmlrpc-c
Only do this if there's an error message that mentions xmlrpc-c in the "Logger" tab of rutorrent, and/or if torrents larger than 2GB are shown as having negative size.
First we need to download xmlrpc-c with subversion...
mkdir ~/sources && mkdir ~/sources/xmlrpc-c
cd ~/sources/xmlrpc-c
svn checkout http://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/stable xmlrpc-c
then compile and install it
cd xmlrpc-c
./configure
make
sudo make install
Now for rtorrent+libtorrent...
mkdir ~/sources/rtorrent
cd ~/sources/rtorrent
svn co svn://rakshasa.no/libtorrent/trunk
cd trunk
svn up
cd libtorrent
To install libtorrent:
./autogen.sh
./configure
make
sudo make install
And rtorrent:
cd ../rtorrent
./autogen.sh
./configure --with-xmlrpc-c
make
sudo make install
Check if rtorrent is working by typing 'rtorrent' in the shell (PuTTY / Terminal).
If it says
rtorrent: error while loading shared libraries: libtorrent.so.11: cannot open shared object file: No such file or directory
then do
sudo su -c 'echo "include /usr/local/lib" >> /etc/ld.so.conf && sudo ldconfig'
and try again. Close rtorrent (Ctrl+q).
Make sure your ~/.rtorrent.rc file is in order - there are plenty of rtorrent tutorials in this forum, and links to config files used by support members elsewhere in the forum. Use the search tool.
Start rtorrent again with a different command:
screen rtorrent
and exit without quitting it by pressing Ctrl+a, Ctrl+d. This leaves rtorrent running in the background, where rutorrent can connect to it.
[edit] Plugins
There are a number of plugins availabe for rutorrent. Installing them is as simple as downloading and extracting them in /var/www/rtorrent/plugins, with this:
cd /var/www/rtorrent/plugins
wget <PLUGIN LINK>
tar xzf <PLUGIN FILENAME>
rm <PLUGIN FILENAME>
- RPC (download) - enables communication between rutorrent and rtorrent without changing server configuration
- erasedata (download) - provides option to delete data as well as .torrent (only deletes the data, not the containing folder)
- darkpal (download) - dark theme; screenshot
- choose (download) - allows interactive file-system navigation when choosing download directory, etc
- create (download) - enables .torrent creation (see below)
- trafic (download) - provides graphs of traffic usage
- RSS (download) - enables downloading with RSS feeds (I couldn't get this to work on my VPS; if it doesn't work for you, use rssdler instead)
- edit (download) - enables editing of tracker lists
- throttle (download) - enables selective throttling
- retrackers (download) - automatically adds certain trackers to all torrents (don't use this with private trackers)
- cookies (download) - provides rtorrent with user-specified cookies for trackers that don't use a passkey in the download link
- search (download) - allows customization of search engines
- scheduler (download) - enables speed-based scheduling
- autotools (download) - enables moving files when complete
- datadir (download) - allows changing of the directory that torrents are downloaded to
- tracklabels (download) - automatically labels torrents with the tracker name
[edit] Creating torrents with rutorrent
On its own, the 'create' plugin can't create .torrents where any of the files are larger than 2 GB. To get around this, we need to install a program called 'createtorrent', and tell the 'create' plugin to use that to the the creation.
First, to install createtorrent:
mkdir ~/sources/createtorrent
cd ~/sources/createtorrent
wget http://www.createtorrent.com/createtorrent-1.1.4.tar.gz
tar xzf createtorrent-1.1.4.tar.gz
cd createtorrent-1.1.4
./configure
make
sudo make install
The command which createtorrent will then reveal that createtorrent is located at /usr/local/bin/createtorrent. Now, we need to tell the 'create' plugin that we've installed createtorrent...
nano /var/www/rtorrent/plugins/create/conf.php
Use Ctrl+k to delete everything, then copy and paste this:
<?php
$useExternal = true;
$pathToCreatetorrent = '/usr/local/bin/createtorrent';
?>
Then Ctrl+x, y, enter, and everything is set up and (hopefully) working.
Note that any settings changed in rutorrent that pertain to rtorrent will only last until rtorrent is restarted; if you want to make them permanent, you have to edit the ~/.rtorrent.rc file.
[edit] Password protection
Thanks to thejestre for this part
So, you've taken the time to follow Scribe's tutorial on how to install rutorrent and have it up and running. Great, now you can access it from any web browser. But so can anyone else who has your ip address. Oh No!
The following is how to put a password on a directory if you are using the apache2 program that came pre-installed on your VPS. In this case we will be requiring a password for anyone who wants to view the rtorrent directory.
Note: When creating the password file for Apache, you can use ANY username and password. It does not have to be your fastsh.it username or ssh password. In fact, it SHOULDN'T be your fastsh.it password!
Create a place to store a password file that is NOT in the /var/www directory tree.
sudo mkdir /home/apachepass
Create a password file. The password will be encrypted. Be sure to edit this next command to match your user name.
Where it says 'thejestre' put your desired user name.
sudo htpasswd -c /home/apachepass/passwdfile thejestre
It will ask you for a password and verify it.
Next, we change the ownership and permissions of passwdfile so that Apache can read from it:
sudo chown www-data:www-data /home/apachepass/passwdfile
sudo chmod 0660 /home/apachepass/passwdfile
Create a .htaccess file in the rutorrent directory. This file lets Apache know we want to protect this directory.
nano /var/www/rtorrent/.htaccess
Put this in the file, then save, and quit.
- Where it says 'thejestre' replace with the user name you used to create passwdfile!!!
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /home/apachepass/passwdfile
Require user thejestre
Backup httpd.conf:
sudo cp /etc/apache2/httpd.conf /etc/apache2/httpd.old
Edit httpd.conf
sudo nano /etc/apache2/httpd.conf
Add this:
- Remember to change 'thejestre' to your user name.
<Directory /var/www/rtorrent>
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/apachepass/passwdfile
AllowOverride All
Require thejestre
</Directory>
For me, the above is all I have in httpd.conf. Yours may be different.
Restart Apache so changes take effect:
sudo /etc/init.d/apache2 restart
Test it. In a web browser open:
YourServerName.Fastsh.it/rtorrent
It should ask for a password.
That's it! Let me know if I have any typos above. I walked through this and got most of the data from here: [1] I've condensed it and made it into the Fastsh.it version.
Constructive criticism is also appreciated ;). EDIT: Thanks to Scribe for the response below. I have fixed the error.
