Torrentflux on a FreeBSD box.

Sometimes while I’m at work I remember I need to download certain things at home (especially torrents) and I don’t wanna wait until I get home because I usually forget (and remember again the next day at work .. and so on) :-) .

So, after playing a little bit with FreeNAS (and see it has a web based torrent client) I’ve decided to install a web based torrent client (torrentflux) on my FreeBSD router, at home. Here’s how I did it

Step 1. – install a web server (I went with lighttpd because of the low memory usage but you can install any web server like: apache, nginx, etc).

  • cd /usr/ports/www/lighttpd
  • make all install clean

Step 2. – install php

  • cd /usr/ports/lang/php5
  • make all install clean

Step 3. – install torrentflux

  • cd /usr/ports/net-p2p/torrentflux
  • make all install clean

Step 4. – configure lighttpd

  • echo ‘lighttpd_enable=”YES”‘ >> /etc/rc.conf
  • vi /usr/local/etc/lighttpd.conf

and make it lool like this:

  • server.modules = (
  • “mod_rewrite”,
  • “mod_redirect”,
  • “mod_alias”,
  • “mod_fastcgi”,
  • “mod_proxy”,
  • “mod_accesslog” )
  • server.document-root = “/home/www/”
  • server.errorlog = “/var/log/lighttpd.error.log”
  • index-file.names = ( “index.php”, “index.html”,
  • mimetype.assign = (
  • “.torrent” => “application/x-bittorrent”,
  • “.css” => “text/css”,
  • “.html” => “text/html”,
  • “.htm” => “text/html”,
  • # default mime type
  • “” => “application/octet-stream”,
  • )
  • accesslog.filename = “/var/log/lighttpd.access.log”
  • url.access-deny = ( “~”, “.inc” )
  • $HTTP["url"] =~ “\.pdf$” {
  • server.range-requests = “disable”
  • }
  • static-file.exclude-extensions = ( “.php”, “.pl”, “.fcgi” )
  • server.pid-file = “/var/run/lighttpd.pid”
  • fastcgi.server = ( “.php” =>
  • ( “localhost” =>
  • (
  • “socket” => “/var/run/lighttpd/php-fastcgi.socket”,
  • “bin-path” => “/usr/local/bin/php-cgi”
  • )
  • )
  • )
  • alias.url = ( “/tf/” => “/usr/local/www/data/tf/” )

create the log files:

  • touch /var/log/lighttpd.access.log
  • touc /var/log/lighttpd.error.log
  • chown www /var/log/lighttpd.*

start the webserver

  • /usr/local/etc/rc.d/lighttpd start

Step 5.  - configure torrentflux:

  • su -m www -c ‘sqlite /usr/local/share/torrentflux/data/.database/tf.db < torrentflux.sqlite’

Now you can open a browser, type http://yourdomain/tf/ and login username: admin password: admin and change the password, set the download directory etc.