New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

HOWTO:TorrentFlux, php-based interface for bittorrent client

How are you using your Bubba? Got ideas for a cool modification? Share!
bjorn
Posts: 88
Joined: 03 Jan 2007, 09:02

HOWTO:TorrentFlux, php-based interface for bittorrent client

Post by bjorn »

Hi all,

i just wanted to share that i've successfully been using torrentflux on my bubba. howto is some posts down...

torrentflux is a set of PHP-scripts using a mysql backend to give a graphical interface to the python-client bittornado. It is capable of queueing torrents, limiting up/down speeds, setting share-ratios and resuming halted downloads.

It is a bit resource-heavy since it runs through python, but if i limit my concurrent downloads to 2 or 3 at the time, it works really well.

Check it out![/url]

/Bjorn
Last edited by bjorn on 17 Feb 2007, 09:30, edited 2 times in total.
doraemon
Posts: 9
Joined: 01 Feb 2007, 18:09
Location: Oslo, Norway

Post by doraemon »

Interesting...
doraemon
Posts: 9
Joined: 01 Feb 2007, 18:09
Location: Oslo, Norway

Post by doraemon »

Sorry for asking, but does this mean I have to install MySQL, Python and a PHP module for Apache (ref. the system requirements)? Or is anything of this already up and running on the Bubba?
bjorn
Posts: 88
Joined: 03 Jan 2007, 09:02

Post by bjorn »

Howto install TorrentFlux 2.3 on Bubba.

Note: Use this at your own risk!. I might have made a typo which could render your system unusable, and I take no responsability for damage caused by following this howto. You have been warned.

Browse to bubba and create a useraccount and allow ssh-login for it, follow Bubba-usermanual for this. I created a user called "bjorn" and this will be used as example throuout this howto.

Download torretflux_2.3.tar.gz from http://www.torrentflux.com/ and save it as /home/bjorn/torrentflux_2.3.tar.gz on Bubba.

Connected to Bubba through SSH, login as your user.

become root

Code: Select all

su
backup files that we change if something goes wrong

Code: Select all

 cp /etc/apt/sources.list /etc/apt/sources.list.backup
 cp /etc/sudoers /etc/sudoers.backup
there are many file editors available, "vi" or "nano" are two good examples, "nano" would perhaps be better for beginners.
enable debian sarge repositories by editing /etc/apt/sources.list and remove comments ("#"-sign) for 3 top rows

Code: Select all

vi /etc/apt/sources.list
Allow user "bjorn" to use the command "sudo" by adding the row "bjorn ALL=(ALL) ALL" to /etc/sudoers

Code: Select all

visudo
leave root:

Code: Select all

exit
unpacked archive

Code: Select all

tar zxvf /home/bjorn/torrentflux
update bubbas apt-system with new information

Code: Select all

 sudo apt-get update
install nessesary software with the following (the packages has a number of requirements, apt will prompt you to install them as well):

Code: Select all

 sudo apt-get install mysql-server php4-mysql python
set password for mysql-root user (default is blank-password, and not recomended!)

Code: Select all

 mysqladmin -u root -p password my_secret_password
login to mysql as mysql-root:

Code: Select all

 mysql -u root -p
run the following commands in mysql-client to create database, user and populate with data from torrentflux script (edit the below to use desired username and password):

Code: Select all

 create database torrentflux;
 grant all on torrentflux.* to 'tf_user'@'localhost' identified by 'tf_password';
 flush privileges;
 use torrentflux;
 source /home/bjorn/torrentflux_2.3/sql/mysql_torrentflux.sql;
 quit;
edit the file /home/bjorn/torrentflux_2.3/html/config.php and insert values for database connection.

Code: Select all

vi /home/bjorn/torrentflux_2.3/html/config.php
move files into webserver-documentroot

Code: Select all

 sudo mv /home/bjorn/torrentflux_2.3/html/ /var/www/html/tf
make the webserver-user owner of files

Code: Select all

 sudo chown -R www-data.www-data /var/www/html/tf
stop then start apache (a "force-reload" is done while running the apt-get install command above but for some reason this did not register mysql-support properly).

Code: Select all

sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
created a directory where to store downloads from torrentflux:

Code: Select all

 sudo mkdir -p /home/storage/torrentflux
make folder writeable for all users

Code: Select all

 sudo chmod -R 777 /home/storage/torrentflux
That should be it!
Browse to http://bubba/tf/ and enter your desired username and password. The first user to do this will become administrator and will be directly taken to the settings-screen.

Change the "path" to /home/storage/torrentflux/
make sure you forward a port-range for your bubba in your firewall/router, having open connection to the specified ports will greatly enhance your bittorrent experience.
I choosed to enable the "Queue manager" and run with default thread-settings.

/Bjorn
Last edited by bjorn on 20 Feb 2007, 15:27, edited 2 times in total.
tor
Posts: 703
Joined: 06 Dec 2006, 12:24
Contact:

Post by tor »

NIce article bjorn,

One minor comment. Don't use plain vi when editing /etc/sudoers. There is a special command for doing this visudo which does basic sanity checks and avoids concurent edits.

Other than that i can only say, nice stuff. Do you mind if we use this in our upcomming page with tips and tricks on Bubba?

/Tor
Co-founder OpenProducts and Ex Excito Developer
bjorn
Posts: 88
Joined: 03 Jan 2007, 09:02

Post by bjorn »

Good point, completely forgot about visudos excistance, thanks!

Changed to use "visudo" instead of "vi /etc/sudoers".

Use the howto in any way you see fit, and change it if you find necessary. I doubt it will give me the Nobel-prize anyways... :-)

/Bjorn
Johnny
Posts: 50
Joined: 20 Feb 2007, 14:42
Location: Sweden

Post by Johnny »

Thanks for a great HOWTO....but I got lost at the SQL-database.

When writing the commando:

source /home/MYUSERNAME/torrentflux_2.3/sql/mysql_torrentflux.sql;

I get the following error:

mysql> source /home/MYUSERNAME/torrentflux_2.3/sql/mysql_torrentflux.sql;
ERROR 1046: No Database Selected

When logging on via ftp I can see the "mysql_torrentflux.sql"-file in the right place.

What's wrong?

/Johnny
bjorn
Posts: 88
Joined: 03 Jan 2007, 09:02

Post by bjorn »

Damn, my bad!

I missed a command amongst the sql-statments...

before the "source"-thingy you'd need to run

Code: Select all

 use torrentflux;
I'll update the howto appropriately
Johnny
Posts: 50
Joined: 20 Feb 2007, 14:42
Location: Sweden

Post by Johnny »

Hi bjorn!

Thanks for your fast reply. I added the command and got passed it with success. Only now I got stucked when editing the config.php file. I change it where I thought I was supposed to, it now looks like this:

------------------------------------------------------------------------------------
$cfg["db_type"] = "mysql"; // mysql, postgres7 view adodb/drivers/
$cfg["db_host"] = "localhost"; // DB host computer name or IP
$cfg["db_name"] = "torrentflux"; // Name of the Database
$cfg["db_user"] = "MYUSERNAME"; // username for your MySQL database
$cfg["db_pass"] = "MYPASSWORD"; // password for database
------------------------------------------------------------------------------------

I then saved it and kept going with the rest of your instruction. But now when I try to login I get the following error:

------------------------------------------------------------------------------------
Warning: mysql_connect(): Access denied for user: 'MYUSERNAME@localhost' (Using password: YES) in /var/www/html/tf/adodb/drivers/adodb-mysql.inc.php on line 355

TorrentFlux Database/SQL Error
Database error: Access denied for user: 'MYUSERNAME@localhost' (Using password: YES)

Always check your database variables in the config.php file.
------------------------------------------------------------------------------------

I then tried to change the config.php file. First I couldn't find it where it used to be, but then I guessed I moved it to /var/www/html/tf but there I'm not allowed to edit the file.

Could you please help me out here, as I'm not used to do this kind of stuff :(

What's the correct values for the config.php file?

/Johnny
Johnny
Posts: 50
Joined: 20 Feb 2007, 14:42
Location: Sweden

Post by Johnny »

Hi again!

I fixed the problem I had. I guess I need to start learning to read between the lines :D

The problem occured because I had not entered the same username and password in the .php file as I had done in the sql file. After changing the php file with the command sudo nano /var/www/html/tf/config.php, I was able to do this and now it seems to work.

/Johnny
John W
Posts: 62
Joined: 17 Jan 2007, 11:47

Post by John W »

Thanks alot for this howto. :) I just managed to install it with success.

// John W
Johnny
Posts: 50
Joined: 20 Feb 2007, 14:42
Location: Sweden

How do I update the search engines?

Post by Johnny »

Anyone know how to update the search engines?

Apparently the Piratebay search engine has been updated from 1.05 to 1.06

http://www.torrentflux.com/forum/index. ... 125.0.html

But I'm not sure how to update this.....anyone knows?
spoodie
Posts: 21
Joined: 24 Jan 2007, 13:32

Post by spoodie »

Got this working over the weekend and been testing it and all is well, my new Bubba now does everything I want it to.

Thanks bjorn! :D
edit: Oh and thanks anyone else that helped improve the process.
bjorn
Posts: 88
Joined: 03 Jan 2007, 09:02

Post by bjorn »

I removed my apache and mysql and installed LightTP and SQLite instead. Torrentflux works great and feels a bit faster, although i don't have any actual mem/cpu-usage details to compare the two...

There's also some discussions on the torrentflux-forums on using "transmission" which is a C++ bittorrent-client instead of the default bittornado-client. This would probably render much better performance than changeing web/db-server.

/Bjorn
JohanJ
Posts: 32
Joined: 21 Sep 2007, 09:15

Post by JohanJ »

bjorn wrote:I removed my apache and mysql and installed LightTP and SQLite instead. Torrentflux works great and feels a bit faster, although i don't have any actual mem/cpu-usage details to compare the two...

There's also some discussions on the torrentflux-forums on using "transmission" which is a C++ bittorrent-client instead of the default bittornado-client. This would probably render much better performance than changeing web/db-server.

/Bjorn
is it possible to upgrade the guide with this ?
Locked