How to install rtorrent on mybookworld


What is it all about?

I managed to install a bittorrent client on the MyBook World. I chose rtorrent for its lightweightness and relative user-friendlyness. Once set up it looks like something like this. If you’re looking for a GUI bittorrent client you better look the other way.

In this article I’ll describe how to transform your Network Hard drive into a lightweight torrent box by installing:

Note that the whole process is quite long. It took me like 12 hours to compile all the sources.

Requirements

Please note that this hack voids your hard drive’s warranty. There’s a risk you brick your MyBook if you don’t know what you’re doing. Don’t blame me if something goes wrong.

Ready? Then ssh your MyBook and log in as root, and follow these step by step instructions.

pkg-config

Let’s start by pkg-config, as it is needed for other softwares to check whether a library is installed or not. The installation is trivial and shouldn’t cause any difficulties.

# cd /tmp/
# wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz
# tar -zxvf pkg-config-0.22.tar.gz
# cd pkg-config-0.22
# ./configure
# make
# make install

openSSL

Ditto…

# cd /tmp/
# wget http://www.openssl.org/source/openssl-0.9.8g.tar.gz
# tar -zxvf openssl-0.9.8g.tar.gz
# cd openssl-0.9.8g
# ./Configure gcc
# make
# make install

ncurses

A programming API to build text interfaces…

# cd /tmp/
# wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz
...

libsigc++

A C++ library…

# wget http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.0/libsigc++-2.0.17.tar.gz
...

libCurl

A library that provides URL transferts.

# wget 	http://curl.haxx.se/download/curl-7.16.4.tar.gz
...

libTorrent

libTorrent is rTorrent’s engine.

UPDATE: In the comments, Mark noticed I forgot this important step:

export PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig/

Then grab libTorrent and compile it:
# wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.11.9.tar.gz
# tar -zxvf libtorrent-0.11.9.tar.gz
# cd libtorrent-0.11.9
# ./configure

rtorrent has been reported hangy for some persons 2. The solution is to edit config.h with a text editor like vi and comment out the line:
#define USE_MADVISE 1

Change it to /* #define USE_MADVISE 1 */
And then,
# make
# make install

rTorrent

We’re almost there.

# wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.7.9.tar.gz
# tar -zxvf rtorrent-0.7.9.tar.gz
# cd rtorrent-0.7.9
# ./configure
# make
# make install

At this point you can now launch rTorrent. Type rtorrent and there might be some errors. I had the following ones:
  • rtorrent: can't load library 'libcurl.so.4'
    Do:
    ln -s /usr/local/lib/libcurl.so.4 /lib/
  • rtorrent: can't load library 'libtorrent.so.10'
    Do:
    ln -s /usr/local/lib/libtorrent.so.10 /lib/

    Link all the other possible missing libraries the same way, they are all situated in the /lib/ directory.

Screen

I first said it was impossible to install GNU Screen on a MyBook World but tcblack mentioned he managed to do it.

One thing a bit stupid now is that you can use rTorrent, but it terminates as soon as you close you terminal. Sure you can run it in the background in using rtorrent &, but then you can’t see rTorrent’s interface anymore. The solution is a terminal multiplexer, which allows you to access multiple terminal sessions. You can start rTorrent from one computer with dtach, leave the session, and then get back the window from another computer. Exactly what we need here.

# wget ftp://ftp.gnu.org/pub/gnu/screen/screen-4.0.3.tar.gz
# tar -xvf screen-4.0.3.tar.gz
# cd /tmp/myfiles/screen-4.0.3
# ./configure
Edit pty.c and surround the # include line 38 by /* */ to comment this line out.
nano pty.c
# make
# make install
# install -m 644 etc/etcscreenrc /etc/screenrc
# cp ./screen /bin

You will use dtach and rtorrent this way:

dtach -c /tmp/socket-rtorrent rtorrent

Now, what’s left?

That’s it: you just transformed you network hard drive into a download box. You’ll need to configure rtorrent according to your taste and internet connexion settings. It’s not rocket science and the documentation is well done. You can copy my .rtorrent.rc file, too.

Need more links?

Footnotes

  1. Forum thread about the MyBook World hangs and solution to avoid it.
  2. See Installing GNU Screen on your Western Digital MyBook World Edition.

Revisions

  • 27/02/2008: just restored this article which somehow got deleted :/ Comments are gone, too. Sorry about that :(
  • 20/11/2007: changed the libtorrent and rtorrent download links to their latest versions, more stable. The new version shouldn’t freeze when downloading large files (>700 MB). I also added a link that explains how to install GNU Screen instead of dtach