Total Pageviews

Saturday, 2 July 2016

用xbt_tracker建立自己的tracker服务器

以下是centos6.x下的搭建过程

一、安装依赖环境

yum install boost-devel gcc-c++ mysql-devel subversion

二、用svn获得xbt_tracker

cd /home
svn co https://svn.code.sf.net/p/xbtt/code/trunk/xbt/misc xbt/misc
svn co https://svn.code.sf.net/p/xbtt/code/trunk/xbt/Tracker xbt/Tracker
cd xbt/Tracker
./make.sh
如果出现command not found使用yum install svn -y安装svn
cp xbt_tracker /home/xbt_tracker/
cp xbt_tracker.conf.default /home/xbt_tracker/
cp xbt_tracker.sql /home/xbt_tracker/
cd /home/xbt_tracker/
mv xbt_tracker.conf.default xbt_tracker.conf

三、建立数据库

mysql -uroot -p密码
CREATE USER 'xbt_tracker'@'localhost' IDENTIFIED BY '你的密码';
GRANT USAGE ON * . * TO 'xbt_tracker'@'localhost' IDENTIFIED BY '你的密码';
CREATE DATABASE IF NOT EXISTS `xbt_tracker` ;
GRANT ALL PRIVILEGES ON `xbt_tracker` . * TO 'xbt_tracker'@'localhost';

四、导入数据库&编辑conf文件

cd ../xbt/Tracker
mysql -u数据用户名 -p数据库密码 xbt_tracker < xbt_tracker.sql
cd ../xbt_tracker
vim xbt_tracker.conf
修改数据库连接设置
mysql_host = localhost  #数据库地址
mysql_user = xbt_tracker  #数据库用户名
mysql_password = qazzaq123  #数据库密码
mysql_database = xbt_tracker  数据库名

五、向数据库写入xbt_tracker的设置

mysql -u root -p 你的密码
use xbt_tracker
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 ('full_scrape','0');
insert into xbt_config values ('gzip_debug','1');
insert into xbt_config values ('gzip_scrape','1');
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 ('offline_message','');
insert into xbt_config values ('pid_file ','xbt_tracker.pid');
insert into xbt_config values ('read_config_interval','60');
insert into xbt_config values ('read_db_interval','60');
insert into xbt_config values ('redirect_url','');
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_users','xbt_files_users');
insert into xbt_config values ('table_scrape_log','xbt_scrape_log');
insert into xbt_config values ('table_users','');
insert into xbt_config values ('write_db_interval','15');

启动xbt_tracker


./xbt_tracker