You are not logged in.

#1 2005-07-31 11:55:31

Father
Member
From: Australia
Registered: 2004-06-01
Posts: 209

[Network] TorrentFlux php based torrent client

Here is a PKGBUILD for torrent flux, unfortunately a fair bit of it is hard coded. I'll clean it up soon with some bash scripting.

The PKGBUILD is hard coded to lighttpd atm, but it can run with apache (which its designed for, but i dont want to have its footprint on my server) with the addition of a few if statements which i dont have time to add atm.. i will later


I had to use cactus' php-cgi package
http://wiki.archlinux.org/index.php/Lig … celeration
http://e.solarblue.net/index.php/arch-repo/

you dont need to worry about the SSL bits.. just follow:

4 Lighttpd Installation
6 FastCGI and PHP with eAcceleration

once php is working with all the fastcgi / eaccelerator addons, then start worrying about torrentflux

Things to do to get it working
- install lighttpd, fastcgi, mysql,
- uncomment the mysql.so extension in /etc/php.ini
- change the username and password in /home/lighttpd/html/config.php
  default username is "root"
  default password is ""
- probably some other things, mainly just following the non-ssl part of cactus wiki


Errors i encountered

-If you receive 500 - Internal Server Error.. your php isnt setup properly
test php with the test script on cactus wiki page linked above.

-if you get a blank page with torrentflux, mysql isnt working with php. enable the extension in /etc/php by uncommenting ;extension=mysql.so

if you get

Could not use database torrentflux: Access denied for user ''@'localhost' to database 'torrentflux'
Check your database settings in the config.php file

do as it says, check your /home/lighttpd/html/config.php file..
you may have to edit the mysql username and password
the defaults are usually username = "root" password = ""

PKGBUILD

# Contributor: Adam Griffiths adam_griffithsAATTdart.net.au
pkgname=torrentflux
pkgver=1.5
pkgrel=1
pkgdesc="TorrentFlux is a FREE PHP based Torrent client that runs on a web server. Manage all of your Torrent downloads through a convenient web interface from anywhere."
url="http://www.torrentflux.com/"
depends=('lighttpd' 'mysql' 'php' 'php-cgi_cactus' 'fcgi' 'eaccelerator' 'bittornado>=0.3.7')
# php-cgi
# fast-cgi
# eaccelerator
#'bittorrent>=3.4.2'
#'bittornado>=0.3.7'
#'lighttpd'
#'apache'
conflicts=()
install=(torrentflux.install)
source=(http://dl.sourceforge.net/torrentflux/$pkgname-$pkgver.tar.gz)
md5sums=(a39885f7a068643674902c3effd4c2f7)


# Install Variables
TORRENTFLUX_INSTALL=home/lighttpd/html
TORRENT_PATH=srv/torrents
TORRENT_PHP_PATH=home/lighttpd/html/btfiles

HTTP_USER=lighttpd
HTTP_GROUP=lighttpd

# BitTorrent Clients
TORRENT_LAYER=BitTornado
#TORRENT_LAYER=BitTorrent

#if ( $TORRENT_LAYER == BitTornado )
        TORRENT_PHP_FILE=btphptornado.py
#else
#       TORRENT_PHPH_FILE=btphptorrent.py
#fi
TORRENT_PHP_METAFILE=btshowmetainfo.py


build()
{
        cd $startdir/src/$pkgname_$pkgver

        # Make all of our directories now
        mkdir -p $startdir/pkg/$TORRENTFLUX_INSTALL
        mkdir -p $startdir/pkg/$TORRENT_PATH
        mkdir -p $startdir/pkg/$TORRENT_PHP_PATH

        # Copy our html / php files
        cp -R $startdir/src/$pkgname_$pkgver/html/* $startdir/pkg/$TORRENTFLUX_INSTALL

        # copy our SQL table so that we can add it on installation
        cp -R $startdir/src/$pkgname_$pkgver/sql $startdir/pkg/$TORRENTFLUX_INSTALL/

        # Copy Torrent layer
        cp -R $startdir/src/$pkgname_$pkgver/TF_$TORRENT_LAYER/* $startdir/pkg/$TORRENT_PHP_PATH

        # Enable execution of our Torrent layer
        chmod 775 $startdir/pkg/$TORRENT_PHP_PATH/{$TORRENT_PHP_FILE,$TORRENT_METAFILE}

        # Make our directory torrent directory writable by our server
        chown -R $HTTP_USER.$HTTP_GROUP $startdir/pkg/$TORRENT_PATH
        # this must be 777
        chmod -R 777 $startdir/pkg/$TORRENT_PATH

        # Own everything
        chown -R $HTTP_USER.$HTTP_GROUP $startdir/pkg/$TORRENTFLUX_INSTALL
        chmod -R 755 $startdir/pkg/$TORRENTFLUX_INSTALL


        # Edit our config.php to point to our new settings


        # update btphptornado.py and btshowmetainfo.py
        # $cfg["btphpbin"] = "/usr/local/TF_BitTornado/btphptornado.py";
        # $cfg["btshowmetainfo"] = "/usr/local/TF_BitTornado/btshowmetainfo.py";
        sed -i "s\/usr/local/TF_BitTornado/btphptornado.py/$TORRENT_PHP_PATH/$TORRENT_PHP_FILE\" $startdir/pkg/$TORRENTFLUX_INSTALL/config.php
        sed -i "s\/usr/local/TF_BitTornado/btshowmetainfo.py/$TORRENT_PHP_PATH/$TORRENT_PHP_METAFILE\" $startdir/pkg/$TORRENTFLUX_INSTALL/config.php

        # Update our torrent path
        # $cfg["path"] = "/usr/local/torrent/";
        sed -i "s\/usr/local/torrent//$TORRENT_PATH\" $startdir/pkg/$TORRENTFLUX_INSTALL/config.php

        # Update our torrent ports
        # $cfg["minport"] = "49160"; // BitTorrent default is 6881
        # $cfg["maxport"] = "49300"; // BitTorrent default is 6999
        sed -i "s\491606881\" $startdir/pkg/$TORRENTFLUX_INSTALL/config.php
        sed -i "s\493006999\" $startdir/pkg/$TORRENTFLUX_INSTALL/config.php
}

torrentflux.install

TORRENTFLUX_INSTALL=home/lighttpd/html

post_install()
 {
        # Create a database in mysql
        mysqladmin create torrentflux

        mysql torrentflux < /$TORRENTFLUX_INSTALL/sql/torrentflux.sql
        rm -rf /$TORRENTFLUX_INSTALL/sql

        echo "----------------------------"
        echo "Edit '/home/lighttpd/html/config.php' to set your torrentflux"
        echo "settings."
        echo ""
        echo "Make sure you set your database username and password in"
        echo "the config.php file, the mysql defaults are"
        echo "username='root' password=''"
        echo "(note, this is NOT system root, but mysql root"
        echo ""
        echo "The first time you access the application, you"
        echo "will be prompted for a user/password -- this is when you will"
        echo "set the SUPER ADMIN user and password by what you enter."
        echo "For example, you pull the site up for the first time, you will"
        echo "be prompted to login and if you put in user: 'goombah' and"
        echo "password: 'iama' then your super admin user account will"
        echo "be set to goombah/iama"
        echo "----------------------------"
}

pre_remove()
{
        # Drop our database
        mysqladmin -f drop torrentflux
}

op=$1
shift

$op $*

Offline

Board footer

Powered by FluxBB