Results 1 to 10 of 435

Thread: How-to: Installing Torrent-Flux

Threaded View

  1. #1
    Join Date
    Aug 2006
    Kubuntu 8.04 Hardy Heron

    How-to: Installing Torrent-Flux

    Important Note:
    This how-to was written for Ubuntu 6.06 (Dapper Drake), for manually installing torrentflux.

    However, torrentflux has since been added to the repositories. Thus, installation should now be much simpler. You can just go to the Synaptic package manager (Applications > Add/Remove) and install it. (Use Adept on Kubuntu.) On the commandline, you can go:

    sudo aptitude install torrentflux
    That replaces steps 3 and 4a from the guide. The rest of the guide details other aspects of getting torrentflux installed and working. You can also use the entire guide (including steps 3 and 4a) if you want to do a manual install for some reason.

    I've had several friends ask about how to get torrentflux working, so I'm posting this how-to to in case anyone else finds it useful.

    Torrentflux is a neat open-source bit-torrent application. The interesting thing about it is that it runs entirely as a web-application. This means that you can access it remotely, from anywhere, using a web-browser. You can initiate, monitor, and manage your bit-torrent downloads while away from your computer.

    The only 'catch' is that you need to be running a full webserver (including PHP and MySQL) for this to work. Luckily it's rather simple to get this working in Linux. If you're running Ubuntu, you should have no problem getting this to work.

    It may seem like 'overkill' to install a whole LAMP environment just for torrentflux, however you may soon discover that there are many neat things you can do with a functional LAMP stack. Torrent-flux is only one example.

    Step 1: Get a functional LAMP stack.

    To get a 'LAMP' stack running (Linux Apache Mysql Php), you just install the packages "apache2", "php5" and "mysql-server". You can do this using Synaptic (Ubuntu) or Adept (Kubuntu), or on the command line:
    $ sudo aptitude install apache2
    $ sudo aptitude install php5
    $ sudo aptitude install mysql-server
    $ sudo aptitude install php5-mysql
    Once these are installed, you should be able to test it by pointing your web-browser to:

    You should see a web-page, not an error message. (You may see a simple web-dir listing with "apache2-default" in it... that's normal.) To test if PHP is working properly, just create a simple test page. For instance, create a file:
    $ sudo nano /var/www/test.php
    And put in this text:
      <title>Test Page</title>
    Test page<br />
    	echo 'If you can see this text, then PHP is working.';
    Then go to http://localhost/test.php
    If you see the "...then PHP is working" message then all is well.

    Since your PHP/MySQL interface will eventually be world-accessible, it makes sense to put some security in place. By default MySQL starts with no password, so you should certainly set one:
    $ mysqladmin -uroot password 'new-password'
    (Note: if you're ever having trouble coming up with good passwords, install and run a simple commandline program called "pwgen" ... it will suggest strong passwords that are reasonably easy to remember.)

    Step 2: Make sure you can access your webserver.

    A common stumbling block in getting a LAMP stack fully functional is that port 80 is blocked. This may be because the Internet Service Provider (ISP) is blocking it, or because your router's firewall is blocking it. To test whether or not you are blocked, first find out your world-facing ("external") IP address. You can do this in any number of ways, such as visiting sites like:

    Then test your setup by using a web browser to check:

    (Where the x's are your IP address, of course.) If you see the same apache page in both cases, then everything is working. If in the second case you get an erorrt, then somewhere along the line port 80 is being blocked. It could be your ISP, or the firewall in your router (if any).

    2.a Opening up port 80 on a router.

    If you have a router, you should log into it and open up port 80. First find out your local IP address (the one inside your local network). To do this just type:
    $ ifconfig
    Among other things, you should see something like "inet addr:" (usually in the first block of output, marked "eth0"). That is your internal IP address.

    Then access your router's administration mode. Typically you access your router by using a web-browser and going to "" or "" or some other "special address" like that. You will need to find the documentation for your specific router. You will probably also have to enter a username and password to get access to the router admin page.

    Once there, you will need to find a section marked "Application & Gaming" or "Port Forwarding" or something similar. In this section, you should set up a new rule along the lines of:
    name: http
    port start: 80
    port end: 80
    type (TCP/UDP/Both): Both
    Forward to:
    Enabled: Yes
    Needless to say, you should replace the "" in the above example with the internal IP address you determined previously. You may need to restart the router for changes to take effect (simply unplugging it for a few seconds should work).

    Then you should test again by visiting your *external* IP address:

    2.b Using a non-standard port.
    If the above did not work, then it is likely that port 80 is being blocked by your ISP. Many residential ISPs will block port 80 (the standard port for http web requests), so you may need to use a non-standard port. Doing so is relatively simple, however. First edit the configuration for your webserver:
    $ sudo nano /etc/apache2/apache2.conf
    And add a line that says:
    Listen 8080
    The "8080" is the non-standard port we will use. You can pick any port you want, as long as it is greater than 1024 (low ports are reserved and probably also blocked). You need to restart apache for hte change to take effect:
    $ sudo /etc/init.d/apache2 restart
    Then modify your router to allow port 8080 to be forwarded to your computer. Use the guidelines given above (section 2.a), except put "8080" instead of "80".

    After doing this, test your webserver by going to:

    In both cases you should get to your apache page, like before. If this doesn't work then go back over the steps and double-check what you've done. It may also be that your router doesn't support port-forwarding properly. In some cases you can "flash the firmware" on your router to fix the problem.

    Step 3: Get Torrent-Flux

    Now you can go download torrentflux:

    The files are hosted by SourceForge:

    Once the file is downloaded, you can untar it in the usual way:
    $ tar -xvzf torrentflux_2.1.tar.gz
    Inside the newly-created "torrentflux_2.1/" directory, you will find a file called "INSTALL" with detailed instructions of what to do next. We'll now go through those steps.

    Step 4: Install Torrent-Flux

    4.a Copy files.
    Torrent-flux is 'simply' a bunch of PHP files (server-interpreted web-files). For them to work, all you really need to do is copy them into your web-folder:
    $ sudo mkdir /var/www/torrentflux/
    $ sudo chown user:user /var/www/torrentflux/
    $ cd ~/Desktop/torrentflux_2.1/html/
    $ cp -r * /var/www/torrentflux/
    Instead of user:user you should put your username and group. (They are usually the same, and are simply the name you login with.) The above "cd" command will vary depending on where you untared the files.

    4.b MySQL.
    We also need MySQL setup properly. Create a database for torrentflux:
    $ mysqladmin -uroot -p create torrentflux
    (You'll need to enter the MySQL password you set previously.) Now go into the "sql" sub-directory in torrentflux (depends on where you untared torrentflux, of course):
    $ cd ~/Desktop/torrentflux_2.1/sql
    And upload the torrentflux structure to MySQL:
    $ mysql -uroot -p torrentflux < mysql_torrentflux.sql
    If you don't like using MySQL on the commandline, you can install a program called "phpmyadmin" that gives you easy web-browser access to all of the functionality in MySQL. Once installed, you access it by pointing your web-browser to: http://localhost/phpmyadmin/

    Now you need to tell torrentflux the password you set for your MySQL system. So you edit the file:
    $ sudo nano /var/www/torrentflux/config.php
    Near the top of the file, you'll see lines that read:
    $cfg["db_user"] = "root";        // username for your MySQL database
    $cfg["db_pass"] = "";            // password for database
    You can modify the "db_pass" line with the password you selected before.

    4.c New MySQL User
    For added security/control, you may prefer to give torrentflux a "non-root" MySQL access. This can be important if you have lots of different applications all using MySQL. To do this, you can use "phpmyadmin" or enter these commands one at a time:
    $ mysql -uroot -p
    mysql> use mysql;
    mysql> INSERT INTO user (Host,User,Password) VALUES('localhost','torfluxuser',PASSWORD('secret'));
    mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON torrentflux.* TO 'torfluxuser'@'localhost';
    mysql> exit;
    Of course instead of 'secret' you should use better password. Now you edit the torrentflux configuration:
    $ sudo nano /var/www/torrentflux/config.php
    And update the lines:
    $cfg["db_user"] = "torfluxuser";        // username for your MySQL database
    $cfg["db_pass"] = "secret";            // password for database
    Obviously you can call your torrentflux user whatever you want, and set the password to whatever you like. Just make sure that the entry in MySQL and in torrentflux match!

    4.d First login.
    Now you can go to your torrentflux page, using a web-browser:

    On your first login you the username and password you supply will be the "administrator account" for torrentflux. Make sure you rememeber the password! (It doesn't have to match the MySQL password you created before.)

    You should then be taken to a page where you can configure torrentflux. In particular, the first line (path) will be marked with an error:
    "Path is not Writable -- make sure you chmod +w this path"
    You need to change permissions on the download folder:
    $ sudo chmod 777 /var/www/torrentflux/downloads/
    You should look over the rest of the settings too. Note that "Port Range" is an important parameter for efficient bit-torrent. You should pick some range (like 45000-46000), and then open up the corresponding range on your router (if any). By allowing connections on that range, you will be able to connect to a larger swarm during downloading, which increases download speed considerably.

    Step 5: Dynamic IP

    If you have a static IP address, you can skip this step. However most home users have a dynamic IP, meaning that it changes every so often (whenever your ISP feels like it, which may be every day or every couple of months). Thus to connect to your torrentflux remotely, you won't know what IP address to go to. A convenient solution is to use a "domain redirect" service. Basically this service will give you an easy to remember alias, like "" which will get you to your machine. In order to have the IP conveniently updated, there are programs that can update your domain redirect automatically.

    There are companies that offer free domain redirection services. An extensive list can be found here:
    The two most popular are DynDNS:
    and noip:

    This tutorial will use "noip" as an example. Similar procedures would apply to other services. I've used noip for quite awhile now, and their service is excellent. You can create a new account:

    Then you can login to "Your No-IP" and go "Add" to create a new host. You get to select the prefix (whatever you want) and select a list of domains from those that No-IP manages. You can then enter your current IP address (usually auto-detected). Let's say you selected "". After adding the new host (and waiting a few minutes), you should be able to access your torrentflux using:
    (if you used a custom port, above).

    Of course the real problem with a dynamic IP is that it changes without notice. For this, No-IP provides a piece of software (go to the "Download" section and select "Linux/BSD/Unix"):
    As before, you need to untar the file, and enter the new directory:
    $ tar -xvzf noip-duc-linux.tar.gz
    $ cd noip-2.1.3/
    If you are running an "i686 machine" (i.e.: any recent standard desktop PC), then do this:
    $ cp binaries/noip2-Linux noip2
    $ sudo make install
    And answer the questions (using the email/password that you created the noip account with). The update interval is in minutes (default 30 minutes is fine).

    If you are not running an i686 machine (PowerPC, etc.) then you will need to compile the program. If you don't have compilers installed, then install them:
    $ sudo aptitude install build-essential
    To compile, while in the "noip2-2.1.3/" direction, just do:
    $ make
    $ sudo make install
    In either case, you can now run noip by typing:
    $ sudo noip2
    To make sure that noip starts everytime the computer boots, edit the file "rc.local" in the "/etc/" directory (note that there is another version of rc.local in "/etc/init.d" but that's not the one you want to edit!):
    $ sudo nano /etc/rc.local
    And add a line:
    /usr/local/bin/noip2 &
    Be sure to put this line *before* the "exit 0" line at the end!

    Now noip will always be running when the computer is turned on, and it will update the your domain name frequently, so that when you go to "" you get to your own pesonal torrentflux application.

    Step 6: Adding Search Modules
    Another neat feature of torrentflux is that it centralizes your torrent searching. You can add modules to torrentflux that enable it to use the search facilities on a number of different trackers. A few modules are given as examples. Other modules are are available on the torrentflux forums:

    To add a new module, simply download the file, and move it into the "searchEngines" folder:
    $ mv module.php /var/www/searchEngines/
    Hopefully this how-to will be of use to others. I followed these steps on a fresh install of Kubuntu 6.06 and it worked fine.
    Last edited by kebes; September 3rd, 2007 at 02:28 AM. Reason: typo in "cd" command

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts