Hey all,
I spent quite a bit of time getting the most recent rtorrent (0.7.9) working on my nas, so I've documented the process here for any of you wanting the same. Also, I am too new a user to post urls, so please correct them appropriately.
First, make sure you have gained root shell access and have installed at least libc6-dev and gcc. Follow the instructions here: www_infrant_com/forum/viewtopic.php?t=14903
Second, we'll need to install quite a few packages. This should be all you need, please let me know if I've forgotten any.
- Code: Select all
$ apt-get install coreutils pkg-config g++ libncurses-dev libssl-dev libsigc++-2.0-dev curl libcurl3-dev screen
Also, due to a failure in one of the install scripts, we need to create the file /usr/lib/pkg-config/libcurl.pc. It should look like this:
- Code: Select all
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libcurl
Description: Get files from online servers
Version: 7.13.2
Libs: -L${libdir} -lcurl
Cflags: -I${includedir}/curl
Now we should be ready to download and install libtorrent and rtorrent. Compiling libtorrent takes about a half hour; rtorrent itself takes over an hour, so be prepared. To install, run these commands:
- Code: Select all
$ wget libtorrent_rakshasa_no/downloads/libtorrent-0.11.9.tar.gz
$ tar -xvvzf libtorrent-0.11.9.tar.gz
$ cd libtorrent-0.11.9
$ ./configure sparc-linux
$ make
$ make install
$ cd ..
$ wget libtorrent_rakshasa_no/downloads/rtorrent-0.7.9.tar.gz
$ tar -xvvzf rtorrent-0.7.9.tar.gz
$ cd rtorrent-0.7.9
$ ./configure sparc-linux
$ make
$ make install
$ cd ..
At this point, you should have rtorrent installed and ready to go. To allow easy torrent management, however, you'll have to do a bit more work. Decide which share you want the torrents to be on ("media" in my case), and create directories (we'll configure rtorrent later).
- Code: Select all
$ mkdir /c/media/bt
$ mkdir /c/media/bt/torrents
$ mkdir /c/media/bt/incomplete/
Now, create a new user (blazingice, for example) under which to run rtorrent.
- Code: Select all
$ useradd -g nogroup blazingice
$ mkdir /home/blazingice
$ chown blazingice:nogroup /home/blazingice /c/media/bt /c/media/bt/torrents /c/media/bt/incomplete
Now, all files created by this user will be owned by blazingice and the "nogroup" group. Since the shares themselves run in the "nogroup" group, you should be able to read, move, or delete the newly created files from the network share.
Finally, we can set up rtorrent. We will do this by creating /home/blazingice/.rtorrentrc. Mine looks like this:
- Code: Select all
# Watch a directory for new torrents, restart torrents that have been
# copied back and stop those that have been deleted.
schedule = watch_directory,10,10,"load_start=/c/media/bt/torrents/*.torrent,d.set_directory=/c/media/bt/incomplete"
schedule = tied_directory,10,10,start_tied=
schedule = untied_directory,10,10,close_untied=
# When the torrent finishes, it executes "mv -n <base_path> ~/Download/"
# and then sets the destination directory to "~/Download/". (0.7.7+)
on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,/c/media/bt/ ;d.set_directory=/c/media/bt/"
# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=100M
# Stop torrents after seeding to 100%
schedule = ratio,60,60,"stop_on_ratio=100,50M,300"
Now rtorrent will watch media//bt/torrents for new torrents and begin downloading them immediately. The incomplete files will be in media//bt/incomplete/, and when done, rtorrent will move the files to media//bt/. If you're wanting to customize further, go visit rtorrent's site at libtorrent_rakshasa_no/. We, however, are almost done!
We want the files created by rtorrent to be readable and writable by both blazingice and anyone in the torrents group. To do this, create a shell script (/home/blazingice/start-rtorrent) that we'll use to launch rtorrent. It should look like this:
- Code: Select all
#!/bin/bash
umask 002
rtorrent
Now make it executable:
- Code: Select all
$ chmod +x start-rtorrent
Now, we're ready to launch rtorrent! We'll use screen to detach from the terminal:
- Code: Select all
$ screen
$ su - blazingice
$ /home/blazingice/start-rtorrent
You're done! Simply drop torrents onto bt/torrents/ on the share and rtorrent will snap them up, download them, and place the completed files in media//bt/! You will be able to move, copy, and delete the final files through the network share from there.
I hope this howto has cleared up some things... My NAS seems to still be working fine, but I'm not responsible if yours breaks horribly while following this guide. Please let me know if you run into any problems!
blazingice
Edit: Removed some complexity in the user setup.