立即注册【分享大片】 登录
BluRayCD Forum 返回首页

kmvodys的个人空间 https://forum.bluraycd.com/?3 [收藏] [复制] [RSS]

日志

XBT Tracker Installation 服务器安装配置教程

已有 2189 次阅读2013-10-26 04:35 |个人分类:安装配置|系统分类:服务器| Tracker, 服务器

目前开源的Bt tracker项目有:
官方Tracker为 www.bittorrent.com/ 使用python语言
windows下的tracker www.bitcomet.com/tracker/index-zh.htm
xbtt.sf.net 的c++ tracker http://xbtt.sourceforge.net/
另外介绍一个论坛:http://www.isohunt.com/forum/

Using Unix/Linux

The XBTT must be compiled from source on Unix/Linux. You need shell and root access to compile and run XBTT. You also need the following packages:
boost-devel
mysql-devel
gcc-c++
subversion

To install this required packages you can run the following commands in your server:
Installing the required packages on Debian
1.apt-getinstall cmake g++ libboost-date-time-dev libboost-dev \
2.libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev \
3.libboost-serialization-dev libmysqlclient15-dev make subversion zlib1g-dev

Installing the required packages on CentOS, Fedora or Red Hat
1.yum install boost-devel gcc-c++ mysql-devel subversion

If for some reason the boost libraries are still on the old version, you can do the following:
Install Boost manually
1.cd/usr/local/src/
2.wget http://sourceforge.net/projects/boost/files/boost/1.44.0/boost_1_44_0.tar.gz/download
3.tar xvzf boost_1_44_0.tar.gz
4.cd boost_1_44_0
4./bootstrap.sh
5./bjam install
Then create a folder in your server and type the following:
1.svn co http://xbt.googlecode.com/svn/trunk/xbt/misc xbt/misc
2.svn co http://xbt.googlecode.com/svn/trunk/xbt/Tracker xbt/Tracker
3.cd xbt/Tracker
4./make.sh
 After the server is compiled you will have a xbt_tracker binary under xbt/Tracker. Copy this binary into the directory where you will run XBTT along with the xbt_tracker.conf.default that is on the same folder. You will end up with two files in your xbt directory: the xbt_tracker and the xbt_tracker.conf.default. Rename the xbt_tracker.conf.default to xbt_tracker.conf.
we are using /home/xbt_tracker as an example
1.cp xbt_tracker /home/xbt_tracker/
2.cp xbt_tracker.conf.default /home/xbt_tracker/
3.cp xbt_tracker.sql /home/xbt_tracker/
4.cd/home/xbt_tracker/
5.mv xbt_tracker.conf.default xbt_tracker.conf

We now need to create a database to be used with XBTT. You can use phpMyAdmin of the mysql command to create it. See the example below using the mysql client:
1.CREATE USER IDENTIFIED BY 'my_tracker_password';
2.GRANT USAGE ON * . * TO IDENTIFIED BY 'my_tracker_password';
3.CREATE DATABASE IF NOT EXISTS `xbt_tracker` ;
4.GRANT ALL PRIVILEGES ON `xbt_tracker` . * TO ;

After the database is created we need to import the default sql that we previously copied into our xbt_tracker home directory. Just type the following command in the shell of your server:
1.mysql -uxbt_tracker -pmy_tracker_password xbt_tracker < xbt_tracker.sql

Ok, the default database schema (xbt_tracker.sql) is imported into the database we have created. All that is left is to configure XBTT to use it. To do so, edit the xbt_tracker.conf in the xbt_tracker home directory and use the following (change the values to fit you need. We are going to use the ones from the previous commands):
1.mysql_host = localhost
2.mysql_user = xbt_tracker
3.mysql_password = my_tracker_password
4.mysql_database = xbt_tracker

We have now concluded the installation of XBTT on our server. So let's start it. To do it just type:
1./xbt_tracker

You now have XBTT running on the default port 2710. To customize it please read the XBTT Configuration page. To see how you can always start XBTT when your server starts please check the General Tips page.

如果遇到编译的时候数据库出问题,通常情况下都是

../misc/sql/database.h:9  server.h:10, connection.cpp:8:   
../misc/sql/sql_result.h:14:25: err:mysql/mysql.h:....

这表示找不到你自己安装的Mysql,需要定义下数据库的地址

cd ../misc       
ln -s /usr/local/mysql/include/mysql mysql
/usr/local/mysql/include/这个地址,是我的MYSQL安装地址.

./xbt_tracker  
提示如下错误.
./xbt_tracker: error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory   
还是库问题.
ll /usr/local/mysql/lib/ |grep libmysqlclient.so.15
echo "/usr/local/mysql/lib/" >> /etc/ld.so.conf

OK.编译是过了,
mkdir -p /tmp/tracker
cp ./xbt_tracker /usr/local/bin/
然后我们在MYSQL的数据库里建立xbt_config表,将如下信息导入.
insert into xbt_config values ('announce_interval', '1800');
insert into xbt_config values ('anonymous_connect', '1');
insert into xbt_config values ('anonymous_announce', '1');
insert into xbt_config values ('anonymous_scrape', '1');
insert into xbt_config values ('auto_register', '1');
insert into xbt_config values ('clean_up_interval', '60');
insert into xbt_config values ('daemon', '1');
insert into xbt_config values ('debug', '0');
insert into xbt_config values ('gzip_announce', '1');
insert into xbt_config values ('gzip_debug', '1');
insert into xbt_config values ('gzip_scrape', '1');
insert into xbt_config values ('listen_check', '0');
insert into xbt_config values ('listen_ipa', '*');
insert into xbt_config values ('listen_port', '2710');
insert into xbt_config values ('log_access', '0');
insert into xbt_config values ('log_announce', '0');
insert into xbt_config values ('log_scrape', '0');
insert into xbt_config values ('pid_file', 'xbt_tracker.pid');
insert into xbt_config values ('read_config_interval', '300');
insert into xbt_config values ('read_db_interval', '60');
insert into xbt_config values ('redirect_url', '');
insert into xbt_config values ('scrape_interval', '0');
insert into xbt_config values ('table_announce_log', 'xbt_announce_log');
insert into xbt_config values ('table_files', 'xbt_files');
insert into xbt_config values ('table_files_updates', 'xbt_files_updates');
insert into xbt_config values ('table_files_users', 'xbt_files_users');
insert into xbt_config values ('table_ipas', 'xbt_ipas');
insert into xbt_config values ('table_scrape_log', 'xbt_scrape_log');
insert into xbt_config values ('table_users', 'xbt_users');
insert into xbt_config values ('update_files_method', '1');
insert into xbt_config values ('write_db_interval', '60');

insert into xbt_config values ('listen_port', '2710');这项是控制端口的,我改成8080的.
insert into xbt_config values ('listen_port', '8080');

下面你会发现所有可能的配置选项,并在该xbt_config表的默认值。
名字:auto_register
描述:如果启用,它将使种子就跟踪自动注册。
默认值:0(禁用)

名字:anonymous_connect
描述:如果启用,将允许任何人(匿名)来访问跟踪。
默认值:1(启用)

名字:anonymous_announce
描述:如果启用,将允许任何人(匿名)公布的跟踪。
默认值:1(启用)

名字:anonymous_scrape
描述:如果启用,将允许任何人(匿名),以刮的跟踪。
默认值:1(启用)

名字:守护进程
描述:如果启用该服务器将作为守护进程运行(在后台)。
默认值:1(启用)

名字:调试
描述:如果启用该服务器也将在调试模式下运行(去http://tracker:port/debug看到调试信息)。
默认值:0(禁用)

名字:full_scrape
描述:如果启用该服务器将成为全刮到客户端。
默认值:0(禁用)

名字:gzip_debug
描述:如果启用该服务器将gzip压缩(压缩)的调试页面。
默认值:1(启用)

名字:gzip_scrape
描述:如果启用该服务器将gzip压缩(压缩)刮页。
默认值:1(启用)

名字:log_access
描述:如果启用该服务器将创建一个与所有访问到服务器的文件。该文件将被命名为(xbt_tracker_raw.log)
默认值:0(禁用)

名字:log_announce
描述:如果启用该服务器将记录所有进入宣布宣布表(xbt_announce_log)。
默认值:0(禁用)

名字:log_scrape
描述:如果启用该服务器将记录所有进入刮表公布(xbt_scrape_log)。
默认值:0(禁用)

名字:announce_interval
描述:默认宣布间隔(以秒为单位),将里面的torrent文件。
默认值:1800(30分钟)

名字:clean_up_interval
描述:(以秒),默认的间隔清理那些标记删除种子。
默认值:60(1分钟)

名字:read_config_interval
描述:(以秒计),其中的XBT二进制默认间隔将重新读取它的配置(从xbt_tracker.conf文件)。
默认值:60(1分钟)

名字:read_db_interval
描述:(以秒计),其中的XBT二进制默认间隔将重新读取它的配置(从xbt_config表)。
默认值:60(1分钟)

名字:scrape_interval
描述:(以秒),默认的间隔中,一个新的刮是允许的。
默认值:0(擦伤之间没有新的最短时间)

名字:write_db_interval
描述:(以秒计),其中的XBT二进制将更新其数据库的默认值。
默认值: 15

名字:column_files_completed
描述:在xbt_files_users表的'完成'字段的默认值。
默认值:完成

名字:column_files_fid
描述:在xbt_files_users表中的'国际数字'字段的默认值。
默认值:国际数字

名字:column_files_leechers
描述:在xbt_files_users表的'leechers'字段的默认值。
默认值:leechers

名字:column_files_seeders
描述:在xbt_files_users表的'播种机'字段的默认值。
默认值:播种机

名字:column_users_uid
描述:在xbt_files_users和xbt_users表中'的UID'字段的默认值。
默认值:的UID

名字:offline_message
描述:脱机信息将出现在客户端程序。
默认值:空。如果指定的信息跟踪系统将offine。

名字:pid_file
描述:文件中的跟踪器将存储在PID(进程ID)。
默认值:空

名字:query_log
描述:其中的XBT二进制日志所有查询文件名的。
默认值:空

名字:redirect_url
描述:该网址在客户端重定向,如果他/她试图访问浏览器通过一个正常的跟踪网址。
默认值:

名字:table_announce_log
描述:为announce_log表的默认值
默认值:xbt_table_prefix(在xbt_tracker.conf)+ announce_log

名字:table_deny_from_hosts
描述:为deny_from_hosts表的默认值。
默认值:xbt_table_prefix(在xbt_tracker.conf)+ deny_from_hosts

名字:table_files
描述:这些文件的表的默认值。
默认值:xbt_table_prefix(在xbt_tracker.conf)+文件

名字:table_files_users
描述:为files_users表的默认值。
默认值:xbt_table_prefix(在xbt_tracker.conf)+ files_users

名字:table_scrape_log
描述:为scrape_log表的默认值。
默认值:xbt_table_prefix(在xbt_tracker.conf)+ scrape_log

名字:table_users
描述:为用户表的默认值。
默认值:xbt_table_prefix(在xbt_tracker.conf)+用户

名字:torrent_pass_private_key
描述:默认torrent通过私钥。
默认值:一个27字符的随机字符串

名字:listen_ipa
描述:为的XBT跟踪IP地址。
默认值:空。它将运行在所有可用的IP的。

名字:listen_port
描述:端口,其中XBT跟踪运行。
默认值:2710(TCP和UDP)

insert into xbt_config values ('auto_register', '1');这项是自动注册的,也就是说不用你允许就可以用.
自动注册 Auto Register  
If auto_register is on, the tracker will track any torrent. If it's off, the tracker will only track torrents (identified by info_hash) that are in the xbt_files table.
insert into xbt_files (info_hash, mtime, ctime) values ('<info_hash>', unix_timestamp(), unix_timestamp()); // insert
update xbt_files set flags = 1 where info_hash = '<info_hash>'; // delete

服务脚本:

vi /etc/init.d/xbtt

--------------------------------------------------------------------------------

#!/bin/sh
#
# Simple shell script to run the XBT Tracker
#
# A simple hack of an existing Debian GNU/Linux /etc/init.d/* script
#

set -e

# *** CHANGE THE BELOW DEFAULT VALUES TO REFLECT YOUR SYSTEM ***

# Defaults
TRACKERDIR=/usr/local/src/xbtt/Tracker
DAEMON=/home/xbt_tracker
CONFFILE=/home/xbt_tracker.conf
PIDFILE=/home/xbt_tracker.pid
USER=tracker

# Sanity checks -- note you'll get no output from the first two if they error!
test -f $DAEMON || exit 0
test -r $CONFFILE || exit 0

if ! id $USER >/dev/null 2>&1 then
  echo "$0: $USER user does not exist! You probably should run this as a regular user or your Apache user."
  exit 1
fi

# Insist the config file is chmod 600 and owned by the correct user
if [ "`stat -c '%U %a' $CONFFILE 2>/dev/null`" != "$USER 600" ]; then
  chown -h $USER $CONFFILE
  chmod -f 0600 $CONFFILE
fi

case "$1" in
  start)
   echo -n "Starting BitTorrent tracker: XBT Tracker"
   if start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -u $USER -a /bin/su -- -c "cd $TRACKERDIR; $DAEMON" $USER; then
     echo "."
   else
     echo " (failed)."
     exit 1
   fi
;;
  stop)
   echo -n "Stopping BitTorrent tracker: XBT Tracker"
   if start-stop-daemon -K -o -q -p $PIDFILE -x $DAEMON -u $USER; then
     echo "."
   else
     echo " (failed)."
     exit 1
   fi
;;
  force-reload|restart)
   echo -n "Restarting BitTorrent tracker: XBT Tracker"
   if ! start-stop-daemon -K -o -q -p $PIDFILE -x $DAEMON -u $USER; then
     echo " (failed on stop)."
     exit 1
   fi
   sleep 1
   if start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -u $USER -a /bin/su -- -c "cd $TRACKERDIR; $DAEMON" $USER; then
     echo "."
   else
     echo " (failed on start)."
     exit 1
   fi
;;
  *)
   echo "Usage: /etc/init.d/xbtt {start|stop|restart|force-reload}"
   echo "  start - starts XBT Tracker service"
   echo "  stop  - stops XBT Tracker service"
   echo "  restart, force-reload - starts a new XBT Tracker service"
   exit 1
;;
esac
exit 0

--------------------------------------------------------------------------------

wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
tar -xzf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
cd ~/src/apps/sys-utils/start-stop-daemon-IR1_9_18-2
gcc start-stop-daemon.c -o start-stop-daemon
cp start-stop-daemon /usr/local/sbin/
chmod +x /usr/local/sbin/start-stop-daemon
chmod 755 /etc/init.d/xbtt

announce地址:

http://ipaddress:8080/announce
状态查看地址:

http://ipaddress:8080/statis
状态内容如下:
leechers 5110
seeders 949
peers 6059
torrents 233 
announced 4858589
announced http  4648048 95 %
announced udp 210541 4 %
scraped full 0
scraped 712
scraped http 632 88 %
scraped udp 80 11 % 
up time 9.0 days 
anonymous connect 1
anonymous announce 1
anonymous scrape 1
auto register 1
full scrape 1
read config time 47 / 60
clean up time 30 / 60
read db files time 24 / 60
read db users time 16 / 60
write db files time 7 / 60
write db users time 60 / 60

在apache在指定需拟站点:
目录是xbtt目录里的Tracker/htdocs
cd /usr/local/src/xbtt/Tracker/htdocs

vi xbt_config.php
<?php
        $mysql_host = 'localhost';
        $mysql_user = '数据库用户';
        $mysql_pass = '数据库密码';
        $mysql_db = '数据库名称';
?>

mv xbt_files.php index.php
重起APACHE,然后打开.
http://ipaddress/index.php
OK .
在做种的时候加入如下地址,让别人测测吧.
http://ipaddress:8080/announce
udp://ipaddress:8080/announce

http://www.visigod.com/xbt-tracker/installation

路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册【分享大片】

小黑屋|手机版|Archiver|4K蓝光论坛

GMT+8, 2024-12-22 17:01

Copyright © 2001-2021, Gadaddy Cloud.

返回顶部