Ubuntu 8.10にrTorrent + wTorrentをインストールする

私のホームサーバーは年中無休です。 そして、夜、彼は遊んでいます。 無制限のインターネットを備えたホームサーバーを読み込む方法-もちろん急流。 サーバーはLinux上にあるため、トレントクライアントはコンソールを検索し、Webインターフェイスで検索する必要があります

そして、私の視線はrTorrent + wTorrentに落ちました。 長い間、さまざまなインターネット上のグーグルは、ほとんどがこの軽量のWebサーバー(lighttpd)でこの束を上げようとしていることを認識していましたが、残念ながら、Apache用の賢明なマニュアルはありません。
まあ、私は自分のマニュアルを書いてみます

それでは始めましょう

必要なパッケージを入れます

apt-get install rtorrent screen apache2 php5-cgi php5-common php5-sqlite php5-xmlrpc sqlite unzip php5-curl

UbuntuのrtorrentパッケージはすでにDebian Etchのxmlrpcでコンパイルされているため、自分でビルドするか、テストのパッケージバージョンを使用する必要があることに注意してください。

それでは、rTorrentパッケージを設定してみましょう。 rTorrentはユーザーアカウントから起動する必要があることに注意してください。 私の場合、ランダムトイアカウントでした

/ home / randomtoyフォルダーに、次の内容の.rtorrent.rcファイルを作成します

scgi_port = localhost:5000
min_peers = 40
max_peers = 100
min_peers_seed = 10
max_peers_seed = 50
max_uploads = 15
#upload_rate = 50
directory = /home/randomtoy/torrents/doing
session = /home/randomtoy/torrents/.rtsession/
schedule = watch_directory,5,5,load_start=/home/randomtoy/torrents/watch/*.torrent
schedule = tied_directory,5,5,start_tied=
schedule = untied_directory,5,5,close_untied=
on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,/home/randomtoy/torrents/done/ ;d.set_directory=/home/randomtoy/torrents/done/"
on_start = link1,"create_link=tied,,.started"
on_stop = link1,"delete_link=tied,,.started"
on_finished = link1,"create_link=tied,,.finished"
on_erase = link1,"delete_link=tied,,.finished"
schedule = low_diskspace,5,60,close_low_diskspace=100M
#schedule = ratio,60,60,"stop_on_ratio=120,200M,2000"
port_range = 10000-10001
port_random = no
check_hash = yes
use_udp_trackers = yes
encryption = allow_incoming,try_outgoing,enable_retry
dht = auto
dht_port = 63982


すぐに次のディレクトリを作成します

急流
トレント/時計
トレント/やること
トレント/完了
トレント/ .rtsession

rtorrentを開始し、エラーがなければ継続します。 次の問題。 システムの起動時にユーザーからトレントを開始する方法は?
次の内容でrtorrentスクリプトを作成します
#!/bin/bash

### BEGIN INIT INFO
# Provides: rtorrent
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start rtorrent as a daemon
### END INIT INFO

#!/bin/sh
#############
######
#############
# This script depends on screen.
# For the stop function to work, you must set an
# explicit session directory using ABSOLUTE paths (no, ~ is not absolute) in your rtorrent.rc.
# If you typically just start rtorrent with just "rtorrent" on the
# command line, all you need to change is the "user" option.
# Attach to the screen session as your user with
# "screen -dr rtorrent". Change "rtorrent" with srnname option.
# Licensed under the GPLv2 by lostnihilist: lostnihilist _at_ gmail _dot_ com
##############
######
##############

#######################
##Start Configuration##
#######################
# You can specify your configuration in a different file
# (so that it is saved with upgrades, saved in your home directory,
# or whateve reason you want to)
#Do not put a space on either side of the equal signs eg
# user = user
# will not work
# system user to run as
user="randomtoy"

# the system group to run as, not implemented, see d_start for beginning implementation
# group=`id -ng "$user"`

# the full path to the filename where you store your rtorrent configuration
config="/home/randomtoy/.rtorrent.rc"

# set of options to run with
options=""

# default directory for screen, needs to be an absolute path
#base="/home/${user}"
base="/home/randomtoy"

# name of screen session
srnname="rtorrent"

# file to log to (makes for easier debugging if something goes wrong)
logfile="/var/log/rtorrentInit.log"
#######################
PATH=/usr/bin:/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin
DESC="rtorrent"
NAME=rtorrent
DAEMON=$NAME
SCRIPTNAME=/etc/init.d/$NAME

checkcnfg() {
exists=0
for i in `echo "$PATH" | tr ':' '\n'` ; do
if [ -f $i/$NAME ] ; then
exists=1
break
fi
done
if [ $exists -eq 0 ] ; then
echo "cannot find rtorrent binary in PATH $PATH" | tee -a "$logfile" >&2
exit 3
fi
if ! [ -r "${config}" ] ; then
echo "cannot find readable config ${config}. check that it is there and permissions are appropriate" | tee -a "$logfile" >&2
exit 3
fi
# session=`getsession "$config"`
# if ! [ -d "${session}" ] ; then
# echo "cannot find readable session directory ${session} from config ${config}. check permissions" | tee -a "$logfile" >&2
# exit 3
# fi
}
d_start() {
[ -d "${base}" ] && cd "${base}"
stty stop undef && stty start undef
su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "screen -dm -S ${srnname} 2>&1 1>/dev/null" ${user} | tee -a "$log$
# this works for the screen command, but starting rtorrent below adopts screen session gid
# even if it is not the screen session we started (eg running under an undesirable gid
#su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "sg \"$group\" -c \"screen -fn -dm -S ${srnname} 2>&1 1>/dev/null$
su -c "screen -S "${srnname}" -X screen rtorrent ${options} 2>&1 1>/dev/null" ${user} | tee -a "$logfile" >&2
}

d_stop() {
session=`getsession "$config"`
if ! [ -s ${session}/rtorrent.lock ] ; then
return
fi
pid=`cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"`
if ps -A | grep -sq ${pid}.*rtorrent ; then # make sure the pid doesn't belong to another process
kill -s INT ${pid}
fi
}

getsession() {
session=`awk '/^[[:space:]]*session[[:space:]]*=[[:space:]]*/{print($3)}' "$config"`
echo $session
}

checkcnfg
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac

exit 0



スクリプトをコピーして実行可能にし、自動ロードに追加します

cp rtorrent /etc/init.d

chmod a+x /etc/init.d/rtorrent

update-rc.d rtorrent defaults 25



これで、システムの起動時にrtorrentが画面で起動します

さて、今度は最もおいしい、Webインターフェースに進みます。 ajax wTorrentに基づいて、私が選んださまざまなウェブモールから

ダウンロードwTorrent

cd /var/www

rm -f index.html

svn co svn://canbruixa.homelinux.net/repos/trunk/wtorrent/

cd wtorrent

mv * ..

mv .* ..

cd ..

rmdir wtorrent

touch ./db/database.db

chown -R www-data:www-data db torrents tpl_c



これで、Apacheの構成になりました。

コンソールで実行する
a2enmod scgi_module

Apacheファイル/ etc / apache2 / sites-avaible / default add

SCGIMount /RPC2 127.0.0.1:5000


rtorrentとapacheを再起動します
/etc/init.d/rtorrent restart
/etc/init.d/apache2 restart


localhost / install.phpページに移動します

管理者アカウントを作成する

ローカルホストに行く

出来上がり。 wTorrent作品

Source: https://habr.com/ru/post/J48618/


All Articles