"; */ ?>

Install rtGui on Ubuntu

rtorrent project logortGui is a web based front end for rTorrent – the Linux command line BitTorrent client. It’s written in PHP and uses XML-RPC to communicate with the rTorrent client.

There are several guides on how to install rtGui on Ubuntu or just POL (Plain Old Linux), but all of them seem to be missing one or two things to make them complete.

Here I went from scratch, step by step to install rtGui on Ubuntu (actually KUbuntu, and to be more specific linuxMCE but it would not matter in this case, since this guide is for any more or less recent Ubuntu distro). I tried to make this guide as complete as possible so it does not miss any installation steps, and if you have any questions/comments, you are welcome to post them in comments section. Now sit back, relax and… let’s get to work! :)

Step 1.  Install PHP with XML-RPC and a SCGI apache module:

sudo apt-get install php5 php5-xmlrpc libapache2-mod-scgi

Step 2. Edit Apache default server config:

sudo vi /etc/apache2/sites-enabled/000-default

(If you are using linuxMCE, edit /etc/apache2/sites-enabled/pluto file instead)
Add the following lines, above the last “</VirtualHost>” (or download example from http://rtgui.googlecode.com/files/000-default ):

LoadModule scgi_module /usr/lib/apache2/modules/mod_scgi.so
SCGIMount /RPC2 127.0.0.1:5000

Restart apache:

sudo apache2ctl restart

Step 3. Create .rtorrent.rc file – see http://libtorrent.rakshasa.no/browser/trunk/rtorrent/doc/rtorrent.rc?rev=latest or download example from http://rtgui.googlecode.com/files/.rtorrent.rc and save to your home directory – ~/.rtorrent.rc

* make sure .rtorrent.rc has this line:

scgi_port = 127.0.0.1:5000

Step 4. Create directories for rtorrent to use, and change the ownership to the user that runs rtorrent:

mkdir /Torrents /Torrents/Downloading /Torrents/Downloading/rtorrent.session
/Torrents/Complete /Torrents/TorrentFiles /Torrents/TorrentFiles/Auto
chown username /Torrents /Torrents/Downloading /Torrents/Downloading/rtorrent.session
/Torrents/Complete /Torrents/TorrentFiles /Torrents/TorrentFiles/Auto

* here “username” is the user who will run rtorrent 

Step 5. Instal XML-RPC library:

sudo apt-get install libxmlrpc-c3-dev
sudo apt-get install libxmlrpc-c3

Step 6. Install latest version of both – libtorrent & rtorrent:

NOTE: Depending on packages installed on the system, you might need these dependencies:

sudo apt-get install libncurses5-dev libsigc++-2.0-dev libcurl4-openssl-dev build-essential

Download latest version (X.Y.Z) of libtorrent from http://libtorrent.rakshasa.no/downloads/ into /usr/local/ directory:

wget http://libtorrent.rakshasa.no/downloads/libtorrent-X.Y.Z.tar.gz
sudo tar xvf libtorrent-X.Y.Z.tar.gz
cd libtorrent-0.11.1
 
sudo ./configure
sudo make
sudo make install

Download rtorrent latest version (X.Y.Z) from http://libtorrent.rakshasa.no/downloads/ in /usr/local/ directory.

wget http://libtorrent.rakshasa.no/downloads/rtorrent-X.Y.Z.tar.gz
sudo tar xvf rtorrent-X.Y.Z.tar.gz
cd rtorrent-X.Y.Z
 
sudo ./configure --with-xmlrpc-c
sudo make
sudo make install

* make sure  you configure rtorrent with “–with-xmlrpc-c” option

After the above 6 steps we are ready to install rtGui (and other GUIs for rtorrent: wTorrent, etc..)

Step 7. Install rtGui:

Download rtgui from http://code.google.com/p/rtgui/downloads/list
Extract files to webserver directory:

sudo tar xvzf ~/rtgui-0.2.3.tgz -C /var/www

* 0.2.3 is the current version at the moment of writing

You can edit “/var/www/rtgui/config.php” if you’d like to change rtGui default settings. Most of the time you don’t have to.

*** Step 8. Start rtorrent:

rtorrent

Step 9. Done! :) Open your browser, and go to http://localhost/rtgui/

*** (!) Since rtGui talks to rtorrent via XML-RPC gateway, rtorrent has to be started – otherwise rtGui has nobody to talk to :) In case rtorrent is not started when you accessing rtGui via web browser, you would get:

Warning: file_get_contents(http://localhost/RPC2) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /var/www/rtgui/functions.php on line 10

This is because there is nobody listening on port 5000 – remember the line “scgi_port = 127.0.0.1:5000″ in .rtorrent.rc? We have configured rtorrent with ” –with-xmlrpc-c” option, hence when rtorrent is up and running it will listen on “scgi_port” (in this case 5000) and will be able to handle XML-RPC requests/responses.

Happy rTorrenting!