Here are the steps to install Transdroid when you use rTorrent on Ubuntu:
Compiling and installing rTorrent
For the ideal rTorrent/Transdroid set-up, we need to compile a fresh new version with support for 64-bit integers. A word of warning: rTorrent is primarily for the advanced Linux user. However, I hope this guide will help you through the whole process. A lot is taken from the excellent install guide for wTorrent, a web UI for rTorrent.
First install the necessary dependencies:
sudo apt-get install subversion build-essential libtool automake1.9 openssl libcurl3 libcurl3-dev libsigc++-2.0-0c2a libsigc++-2.0-dev libncurses5 libncurses5-dev libcppunit-dev
I also assume you have a running Lighttpd or Apache webserver. Now, make a working directory and change into it…
We need xmlrpc-c and xmlrpc-c-dev of version 1.07 or higher. The minimum Ubuntu version that has these is Natty, so if you are running an older version we get the .deb files manually from the Ubuntu packages site: libxmlrpc-c3-0 and libxmlrpc-c3-dev are needed and availble for i386 and amd64. Choose the packages for your architecture and place them in the working directory. Install it using aptitude. Remember to adjust the file names to your downloaded .debs:
sudo apt-get dpkg -i libxmlrpc-c3-0_1.16.32-0ubuntu3_amd64.deb
sudo apt-get dpkg -i libxmlrpc-c3-dev_1.16.32-0ubuntu3_amd64.deb
Time to install libTorrent and rTorrent. Download the latest version of both from their homepage. Adjust the file names accordingly in the next compile/install commands:
tar xvzf libtorrent-0.12.6.tar.gz
sudo make install
tar xvzf rtorrent-0.8.6.tar.gz
sudo make install
If the compiling was successful, rTorrent should now be installed and ready to use. You may try it by running ‘rtorrent’. To exit the program press Ctrl+Q. The next step is to enable the RPC functionality of rTorrent. Since I assume here we have a fresh install, you should first get a configuration file. Download it from the rTorrent website and place it in your home dir, renaming it to .rtorrent.rc:
mv rtorrent.rc ~/.rtorrent.rc
You need to add the following two lines to that configuration file:
scgi_port = 127.0.0.1:5000
To also protect incoming connections on this SCGI port, we’ll password-protect it in the next step.
The last step is to configure the web server. Lighttpd and Apache with mod_scgi are supported. I have not tested it with Lighttpd myself, but the install instructions are here. For apache you need to install and enable mod_scgi support first:
sudo apt-get install libapache2-mod-scgi
sudo a2enmod scgi
You might get warnings that you already installed/enabled this. That’s okay of course. Next you need to add the SCGI mount for rTorrent. Open up /etc/apache2/sites-available/default with superuser rights, for example:
gksudo gedit /etc/apache2/sites-available/default &
And add the following lines at the near-end of the document, just before the line that says ‘</VirtualHost>’:
SCGIMount /RPC2 127.0.0.1:5000
AuthName "rTorrent secure access"
Require user yourusername
Of course you replace ‘yourusername‘ with your own username. I named the password file (we will be creating that next) rtorrent-htpasswd and placed the file in my Documents dir, but you are free to place it anywhere you like and call it differently. Indeed that’s what we do here; set the password for your user:
htpasswd -c /home/yourusername/Documents/rtorrent-htpasswd yourusername
You may want to install wTorrent as well. Since you already have a rTorrent set-up with XML-RPC this isn’t very hard. You can get it from the wTorrent website.
Restart your webserver now to activate all the changes:
sudo /etc/init.d/apache2 restart
We’re done! Remember that you always need to have rtorrent running to be able to connect to it using Transdroid. Since rTorrent does not run as a daemon, you may want to use screen to start and control remote session of rTorrent.
Allow access from anywhere
The next step is very important if you want to use Transdroid to control rTorrent from anywhere you go and not just your home Wi-Fi network. If you have not yet opened up your web port (port 80), you will need to do so here and redirect this to your home computer. Get your local IP by looking at the output for your external network adapter (most likely eth0) from running the command:
Now go to your the manager interface of your router or ADSL modem. It will most likely have a NAT tab or settings screen. Here you will need to set up a port forward from all external traffic on port number 80 to you local computer’s IP address on the same port. There are too many routers and ADSL modems to make detailed explanations here, but you can use the website PortForward for in-depth help.
Setting up Transdroid
The final step is to set up Transdroid. Install the software from the Android Market and open up the application. You will see a message that you need to set up a server configuration first. Hit your Android device’s menu button and choose ‘Settings’. Next, click the ‘Add a sever’ button to create your first sever configuration. You can add more later, if you need to.
Now fill in all the settings. The name is totally up to you. From the type menu you choose for rTorrent of course.
The IP address is your server’s external IP address. If you do not know this, open up a browser on your Ubuntu machine and surf to whatismyip.com. It will present you the external IP address that you need in Transdroid.
The port number should be set to 80 and the SCGI folder should be ‘/RPC2’. Unless, of course, you have made a different, custom Lighttpd/Apache configuration.
Choose to enable authentication and fill in the username and password that you created.
Time to test your settings! First disconnect from the Wi-Fi network if you are connected to the local network (the one where your Ubuntu machine is in as well). This is important, because you will need to use different settings for that.
Now, hit the back button of your Android device twice to return to the main screen. It should now state that it is connecting to the sever. After a couple of seconds you should get a listing of all the active torrents in rTorrent. Rewards yourself by downloading some torrents, right from your phone. 🙂
Local Wi-Fi network access
One thing you should know when you have a Wi-Fi network at home, is that you cannot use your external IP address as described above while you are connected this way. When connected to the wireless network that your Ubuntu machine is in, you will need to use your machine’s internal IP address instead.
Easiest thing to do is to open Transdroid’s settings menu again and add a new sever configuration. Use the exact same details that you used before, but now use your Ubuntu machine’s local IP address. Of course you also want to give it a name that identifies it as being your local configuration.
Give it a test by going to the main screen and choose ‘servers‘ from the menu. You can select the other configuration from the pop-up menu. A little tip: switching servers can also be done by swiping your finger from left to right (or the other way around). No need to open the menu each time!
If Transdroid refuses to connect you, use these steps to trace the problem.
When starting rTorrent, it should say something like ‘XMLRPC initialized …’ and ‘The SCGI socket has not been bound to any address…’. If not, please enable XML-RPC in your .rtorrent.rc configuration file.
You may want to install the wTorrent web interface for rTorrent. Besides being really useful from time to time, you can also use it to tes tyour setup. If you open it (usually on http://localhost/wtorrent/) from your Ubuntu machine and it is not able to connect, then rTorrent is not started or the SCGI redirection is not set up correctly.
If you can connect to your rTorrent server using Transdroid from your inside Wi-Fi network, but cannot connect from the outside (using 3G/EDGE), then your port forwarding is not correct. Fix it by (re)creating the NAT rule on your router/ADSL modem.
Still having troubles? Use the ‘error report’ feature in Transdroid’s menu to get personal help.
Good luck and enjoy!