Page 1 of 44 12311 ... LastLast
Results 1 to 10 of 433

Thread: How-to: Installing Torrent-Flux

  1. #1
    Join Date
    Aug 2006
    Beans
    923
    Distro
    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:

    Code:
    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.

    Introduction
    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:
    Code:
    $ 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:
    http://localhost/

    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:
    Code:
    $ sudo nano /var/www/test.php
    And put in this text:
    Code:
    <html>
    <head>
      <title>Test Page</title>
    </head>
    <body>
    Test page<br />
    <?php 
    	echo 'If you can see this text, then PHP is working.';
    ?>
    </body>
    </html>
    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:
    Code:
    $ 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:
    http://www.ipaddressworld.com/

    Then test your setup by using a web browser to check:
    http://localhost/
    http://xxx.xxx.xxx.xxx/

    (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:
    Code:
    $ ifconfig
    Among other things, you should see something like "inet addr:192.168.1.101" (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 "http://192.168.1.1/" or "http://192.168.15.1/" 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:
    Code:
    name: http
    port start: 80
    port end: 80
    type (TCP/UDP/Both): Both
    Forward to: 192.168.1.101
    Enabled: Yes
    Needless to say, you should replace the "192.168.1.101" 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:
    http://xxx.xxx.xxx.xxx/


    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:
    Code:
    $ sudo nano /etc/apache2/apache2.conf
    And add a line that says:
    Code:
    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:
    Code:
    $ 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:
    http://localhost:8080/
    http://xxx.xxx.xxx.xxx:8080/

    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:
    http://www.torrentflux.com/

    The files are hosted by SourceForge:
    http://prdownloads.sourceforge.net/t...ar.gz?download

    Once the file is downloaded, you can untar it in the usual way:
    Code:
    $ 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:
    Code:
    $ 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:
    Code:
    $ 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):
    Code:
    $ cd ~/Desktop/torrentflux_2.1/sql
    And upload the torrentflux structure to MySQL:
    Code:
    $ 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:
    Code:
    $ sudo nano /var/www/torrentflux/config.php
    Near the top of the file, you'll see lines that read:
    Code:
    $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:
    Code:
    $ mysql -uroot -p
    mysql> use mysql;
    mysql> INSERT INTO user (Host,User,Password) VALUES('localhost','torfluxuser',PASSWORD('secret'));
    mysql> FLUSH PRIVILEGES;
    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:
    Code:
    $ sudo nano /var/www/torrentflux/config.php
    And update the lines:
    Code:
    $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:
    http://localhost/torrentflux/

    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:
    Code:
    $ 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 "user.example.com" 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:
    http://www.technopagan.org/dynamic/#TheList
    The two most popular are DynDNS:
    http://www.dyndns.com/services/dns/dyndns/
    and noip:
    http://www.no-ip.com/services/manage...namic_dns.html

    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:
    http://www.no-ip.com/newUser.php

    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 "user.no-ip.info". After adding the new host (and waiting a few minutes), you should be able to access your torrentflux using:
    http://user.no-ip.info/torrentflux/
    or
    http://user.no-ip.info:8080/torrentflux/
    (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"):
    http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
    As before, you need to untar the file, and enter the new directory:
    Code:
    $ 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:
    Code:
    $ 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:
    Code:
    $ sudo aptitude install build-essential
    To compile, while in the "noip2-2.1.3/" direction, just do:
    Code:
    $ make
    $ sudo make install
    In either case, you can now run noip by typing:
    Code:
    $ 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!):
    Code:
    $ sudo nano /etc/rc.local
    And add a line:
    Code:
    /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 "http://user.no-ip.info/torrentflux/" 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:
    http://www.torrentflux.com/forum/

    To add a new module, simply download the file, and move it into the "searchEngines" folder:
    Code:
    $ mv module.php /var/www/searchEngines/
    Conclusion
    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

  2. #2
    Join Date
    Dec 2005
    Location
    Vancouver, BC
    Beans
    283
    Distro
    Hardy Heron (Ubuntu Development)

    Re: How-to: Installing Torrent-Flux

    I get this error, after doing this howto, I am using the dapper server edition,

    HTML Code:
    Fatal error: Call to undefined function mysql_connect() in /var/www/adodb/drivers/adodb-mysql.inc.php on line 354

  3. #3
    Join Date
    Apr 2005
    Location
    Exeter, UK
    Beans
    12
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: How-to: Installing Torrent-Flux

    Code:
    $ sudo aptitude install php5-mysql
    Should sort you out.

  4. #4
    Join Date
    Sep 2006
    Location
    Vancouver, BC, Canada
    Beans
    30
    Distro
    Ubuntu 6.10 Edgy

    Re: How-to: Installing Torrent-Flux

    Hmmm... I am getting the same error, and i made sure that i have all necessary components
    Fatal error: Call to undefined function mysql_connect() in
    /var/www/torrentflux/adodb/drivers/adodb-mysql.inc.php on line 354
    I am running PHP5 and Apache2, I am sure that mysql can be accessed (i am also running Gallery1 so i am sure that it is running fine.)

    Anyone have any ideas what i may be forgetting?

  5. #5
    Join Date
    Sep 2006
    Location
    Vancouver, BC, Canada
    Beans
    30
    Distro
    Ubuntu 6.10 Edgy

    Re: How-to: Installing Torrent-Flux

    Problem solved, I did a little digging around and found this:
    Fatal error: Call to undefined function: mysql_connect() in /var/www/html/adodb/drivers/adodb-mysql.inc.php on line 354
    This means that your version of php can't connect to the mysql database. Usually installing a package like php-mysql will solve this although if it doesn't then open your php.ini file and find the line like extension=mysql.so, remove the comment from in front, and then restart your webserver.
    from the official FAQ which can be found here:

    http://www.torrentflux.com/forum/ind...ic,1451.0.html

    So i did the following:
    sudo gedit /etc/php5/apache2/php.ini
    to remove the comment from the extension=mysql.so (line 565) and restart apache.
    sudo /etc/init.d/apache2 restart

  6. #6
    Join Date
    Aug 2006
    Beans
    5

    Re: How-to: Installing Torrent-Flux

    if i try do go to http://localhost/test.php, obtain this message

    Code:
     Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
     
     Warning: Unknown: Failed opening '/var/www/test.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
    if i try
    Code:
    sudo /etc/init.d/apache2 start
    * Starting apache 2.0 web server...                                   
    apache2: Could not determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    httpd (pid 6243) already running
                                                                                                                           [ ok ]
    please, i'm very newbie, any ideas???

    tks a lot

  7. #7
    Join Date
    Jun 2006
    Beans
    Hidden!

    Re: How-to: Installing Torrent-Flux

    Thanks for this How-To. Works like a charm

  8. #8
    Join Date
    Nov 2006
    Beans
    3

    Exclamation Re: How-to: Installing Torrent-Flux

    Hi another newb here, everything worked fine for me until after the login page i get this error

    Debug SQL is on.

    SQL: INSERT INTO tf_log ( USER_ID, FILE, ACTION, IP, IP_RESOLVED, USER_AGENT, TIME ) VALUES ( 'usernamehere', '/torrentflux/index.php', 'HIT', '::1', 'ip6-localhost', null, '1163138870' )


    Database error: Column 'user_agent' cannot be null

    Always check your database variables in the config.php file.
    Any ideas?

  9. #9
    Join Date
    Nov 2006
    Beans
    111

    Re: How-to: Installing Torrent-Flux

    Hi all, I have a problem.

    When I browse to http://localhost/test.php, firefox tries to save the php file and doesn't load it in the browser like it should. What could be the problem? I installed php5 and php5-mysql so I don't know why things won't work.

  10. #10
    Join Date
    Oct 2006
    Location
    Maribor, Slovenia
    Beans
    132
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: How-to: Installing Torrent-Flux

    There is a problem with your apache modules config or something.

    Post your /var/log/apache2/error.log



    JB

Page 1 of 44 12311 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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