使用chihaya 搭建tracker服务器(Debian)

仅做尝试。在此记录一下。
之前有一个很完整的教程,但是博主删帖了。后来再次搭建的时候总是报错。所以自己也记录一下。

[title]先安装会使用的工具[/title]

1、安装vim。

sudo apt update
sudo apt install vim

2、安装GIT。

apt install git

 

[title]安装golang[/title]

毕竟chihaya是基于golang的。所以先安装golang是必要的。

wget https://golang.google.cn/dl/go1.19.1.linux-amd64.tar.gz
tar -xvf go1.19.1.linux-amd64.tar.gz
mv go /usr/local/
#修改配置文件
vi ~/.bashrc
#在~/.bashrc末尾添加以下内容并保存
export GO_HOME=/usr/local/go/
export GO_PATH=$HOME/go
export PATH=${GO_HOME}/bin:$GO_PATH/bin:$PATH
#继续运行命令
#生效.bashrc
source ~/.bashrc   [title]编译chiaya[/title]
#编译
git clone https://github.com/chihaya/chihaya.git
cd chihaya
go build ./cmd/chihaya
mv chihaya /usr/bin
#按自己需求修改相关配置
mv ./dist/example_config.yaml /etc/chihaya.yaml
cd ..

[title]创建chihaya服务[/title]


cat </etc/systemd/system/chihaya.service
[Unit]
Description=chihaya server
    
[Service]
User=root
ExecStart=/usr/bin/chihaya --config /etc/chihaya.yaml
Restart=on-abort
LimitCORE=infinity
LimitNOFILE=infinity
LimitNPROC=infinity
    
[Install]
WantedBy=multi-user.target
EOF

[title]启动chihaya服务[/title]

systemctl enable /etc/systemd/system/chihaya.service
systemctl start chihaya

[title]一些常用命令[/title]

systemctl status chihaya #查看服务状态
systemctl stop chihaya #停止服务
systemctl restart chihaya #重启服务

[title]其他[/title]

制作种子时填入http://IP:6969/announce或udp://IP:6969/announce

也可以做好解析后把IP换成域名自带统计地址http://IP:6880