Sunday, April 2, 2006

How to install TorrentFlux on Ubuntu Linux

TorrentFlux is a PHP based BitTorrent client. Now that I have a server, may as well use that as a seeder/downloader all the time. I'm using an updated version of Flight5 Ubuntu Dapper Drake 6.06.

The prerequisite is LAMP (Linux Apache Mysql PHP). So let's install that first.

Install Apache 2:

$sudo apt-get install apache2

Now type http://myComputerName/apache2-default/ to test that it works. You should get the test page.

Install MySQL:

$sudo apt-get install mysql-server

After that, run this script to initialize MySQL and don't forget to change the root password. This root is NOT the same as the root user on your Linux machine:

$sudo mysql_install_db
$mysqladmin -u root password MyNewPassword

Install the latest version of PHP, which at the present moment is 5:

$sudo apt-get install php5

Let's restart Apache just for fun and to make sure all the setting are loaded properly:

$sudo /etc/init.d/apache2 restart

If you don't already have BitTorrent, then install that as well:

$sudo apt-get install bittorrent

Now create a folder to host your torrentflux.

roy@ubuntuserver:~$cd /var/www
$sudo mkdir torrentflux

Now go and download Torrentflux from http://www.torrentflux.com

and follow the instruction in the INSTALL file.

$cd downloads/torrentflux_2.0
roy@ubuntuserver:~/downloads/torrentflux_2.0
$sudo cp -R html/* /var/www/torrentflux/

Ok, so now we have to add a database to MySQL. I'm going to install PHPMyAdmin because it's easy and nice to configure.

$sudo apt-get install phpmyadmin

or you can do things command line style:

roy@ubuntuserver:~/downloads/torrentflux_2.0/sql$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32 to server version: 5.0.18-Debian_8.1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>create database torrentflux;
Query OK, 1 row affected (0.00 sec)

Now exit MySQL, and again, you can run the following script from PHPMyAdmin, or from the commandline:

mysql>\q
Bye

$mysql torrentflux < torrentflux.sql -u root -p
Enter password:

Now I'm going to make my default torrent directory and chmod 777 to make it *fully* accessable. Don't to this in your root directory:

$mkdir /mnt/raid/roy/other/torrent
$chmod 777 /mnt/raid/roy/other/torrent

Now edit the torrentflux config.php file located in the /var/www/torrentflux directory to reflect this change. The variable to edit is $cfg["path"]

I also edited the line:

$cfg["db_user"] = "user"; // username for your MySQL database

to

$cfg["db_user"] = "root"; // username for your MySQL database

I also updated the password variable $cfg["db_pass"].

Now copy the TF_BitTornado directory to your /usr/local/ directory. Or anywhere, so long as you update the config.php file. And then set the 2 python files to executable.

$pwd
/home/roy/downloads/torrentflux_2.0
$sudo cp -R TF_BitTornado /usr/local/TF_BitTornado
$cd /usr/local/TF_BitTornado
$chmod +x btphptornado.py
$chmod +x btshowmetainfo.py

Now restart MySQL and Apache just to make sure that if we ever reboot in the future, we don't get any surprises. Plus, this way we know all our config files are being read again.

root@ubuntuserver:/etc/mysql# /etc/init.d/mysql stop
Stopping MySQL database server: mysqld.
root@ubuntuserver:/etc/mysql# /etc/init.d/mysql start
Starting MySQL database server: mysqld.
Checking for crashed MySQL tables in the background.
root@ubuntuserver:/etc/mysql# /etc/init.d/apache2 restart
* Forcing reload of apache 2.0 web server...

Now you should be able to go to your server's name on your LAN and type:

http://ubuntuserver/torrentflux/

And you will get the login prompt. Login and do your thing. Remember though that if you are downloading from a private tracker, you will have to download and save the torrent seed to your hard drive, and then "upload" it in torrentflux.

Enjoy!

UPDATE: I can't select where to download the file!! This sucks. If I don't find a workaround, and I need to write a hack. I'll be pissed. I don't have time for this. I think I've written Hello World once in PHP. So seriously. I don't have time for this.

Posted by boredottawa at April 2, 2006 01:26 PM
Comments

looks complicated

Posted by: Bauub at April 3, 2006 09:15 AM

Yes. We're back to 1999 Linux. heh. Actually, it's not that complicated, but it could be simplified. That and this app is missing key features which pisses me off.

Posted by: roy at April 3, 2006 04:16 PM

Anything requiring more than 2 command lines to install is complicated.

Posted by: Brennan at April 3, 2006 04:28 PM