Debianでrtorrent + wtorrentバンドルをインストールして設定する

habrahabrでは、ホームサーバーを作成する問題が繰り返し議論されています。 したがって、検索を使用すると、このトピックに関するいくつかの優れた記事を簡単に見つけることができます。 そこで、特に、なぜこれがすべて必要なのかを学びます。

しかし、残念なことに、インターネット上に掲載された記事のどれも、Debianシステム(またはほぼ同じUbuntu)にrtorrent + wtorrentバンドルをインストールする問題を完全に開示していません。 主な困難は、いくつかの明らかな「落とし穴」ではありません。



-Debianには、最新バージョンのrtorrent / libtorrentと互換性のないライブラリの古いバージョンのパッケージが含まれています。

-既存のマニュアルとハウツーには、このバンドルをlighttpdサーバーにインストールする方法に関する情報のみが含まれています。これは必ずしも便利ではありません(たとえば、Apacheで実行するほうがよいホームサーバーにサイトがいくつかあります)。

-インストールのすべての微妙な点を考慮したマニュアルはありません。



このような状況を考えると、このマニュアルは「コピー&ペースト」のスタイルで書かれています。これは、rtorrent / wtorrentを使いこなすという困難な作業に役立つことを願っています。



「クリーンな」Debian 4.0を置きました。 次に、ルートの下のコンソールに必要なパッケージを配置します。



apt-get install apache-common apache2-utils autoconf automake \

autotools-dev binutils build-essential bzip2 ca-certificates comerr-dev \

cpp cpp-4.1 dpkg-dev file g++ g++-4.1 gawk gcc gcc-4.1 libapache-mod-php5 \

libapr1 libaprutil1 libc6-dev libcurl3 libcurl3-openssl-dev libexpat1 \

libidn11 libidn11-dev libkadm55 libkrb5-dev libmagic1 libncurses5-dev \

libneon26 libpcre3 libpq4 libsigc++-2.0-dev libsqlite0 libsqlite3-0 \

libssl-dev libssp0 libstdc++6-4.1-dev libsvn1 libtool libxml2 linux-kernel-headers \

lynx m4 make mime-support ntp ntpdate openssl patch libapache2-mod-scgi\

perl perl-modules php5 php5-cgi php5-common php5-sqlite pkg-config screen








Apacheについてチャットする:



a2enmod suexec

a2enmod scgi








残りはソートされません。 まず、xmlrpcをインストールします。



cd

svn co xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/stable xmlrpc-c

cd xmlrpc-c

./configure --disable-cplusplus

make

make install







次のc-ares:



cd

wget c-ares.haxx.se/c-ares-1.6.0.tar.gz

tar xzf c-ares-1.6.0.tar.gz

cd c-ares-1.6.0

./configure

make

make install








さらにlibcurl:



cd

wget curl.haxx.se/download/curl-7.19.3.tar.gz

tar xzf curl-7.19.3.tar.gz

cd curl-7.19.3

./configure --enable-ares

make

make install








これで、libtorrentとrtorrentをビルドできます。



cd

mkdir rtorrent

cd rtorrent

svn co svn://rakshasa.no/libtorrent/trunk

svn up

cd trunk

cd libtorrent

./autogen.sh

./configure

make

make install

cd ../rtorrent

./autogen.sh

./configure --with-xmlrpc-c

make

make install








ユーザーrtを追加し、あらゆる種類のサービスフォルダーを作成します。



useradd rt

cd /home/rt

mkdir ./torrents

mkdir ./torrents/watch

mkdir ./torrents/doing

mkdir ./torrents/done

mkdir ./.rtsession

chown rt:rt /home/rt -R

chmod 777 /home/rt/torrents -R








rtorrentの起動スクリプトを作成し、自動ロードに追加します。



cd

wget re-hash.ru/pub/rtorrent.tgz

tar xzf rtorrent.tgz

cp rtorrent /etc/init.d

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

update-rc.d rtorrent defaults 25








rtorrentの構成ファイルを作成します。



nano /home/rt/.rtorrent.rc







そこで次のように書きます:



scgi_port = localhost:5000

min_peers = 40

max_peers = 1000

min_peers_seed = 10

max_peers_seed = 50

max_uploads = 15

directory = /home/rt/torrents/doing

session = /home/rt/.rtsession

schedule = watch_directory,5,5,load_start=/home/rt/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/rt/torrents/done/ ;d.set_directory=/home/rt/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

port_range = 63963-63963

port_random = no

check_hash = yes

use_udp_trackers = yes

encryption = allow_incoming,try_outgoing,enable_retry

dht = auto

dht_port = 63982








ルーターがある場合は、rtorrentを搭載したサーバーのポート63963と63982を開く必要があります。

次に、ファイル/etc/apache2/apache.confを編集し、次の行をどこかに追加します。



SCGIMount /RPC2 127.0.0.1:5000



<VirtualHost *:80>

SuexecUserGroup rt rt

ServerName torrent

#ServerAlias www.torrent

DocumentRoot /var/www/torrent/www

CustomLog /var/www/torrent/access.log combined

ErrorLog /var/www/torrent/error.log

<Directory "/var/www/torrent/www">

Options FollowSymLinks Includes MultiViews

AllowOverride All

Order allow,deny

Allow from all

</Directory>

#ScriptAlias /cgi-bin/ "/var/www/torrent/cgi-bin/"

</VirtualHost>








次に、wtorrentをインストールします。 これを行うには、次を実行します。



mkdir /var/www/torrent/www

cd /var/www/torrent/www

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

mv * ..

cd ..

rmdir wtorrent

mkdir data

nano ./conf/home.conf.php








ファイル./conf/home.conf.phpに以下を書きます:



<?php

define( 'URL', 'http://torrent/' );

define( 'BASE', 'http://torrent/' );

define( 'DB_FILE', 'db/database.db');

define( 'RT_HOST', 'localhost');

define( 'RT_PORT', 80);

define( 'RT_DIR', 'RPC2/');

define( 'RT_AUTH', false);

define( 'RT_USER', '');

define( 'RT_PASSWD', '');

define( 'NO_MULTICALL', true);

define( 'DIR_TORRENTS', 'torrents/');

define( 'DIR_EXEC', '/var/www/torrent/www');

define( 'PERM_TORRENTS', 0777);

define( 'DIR_DOWNLOAD', '/home/rt/doing');

define( 'DIR_LANG', 'home/lang/' );

define( 'DIR_TPL', 'home/tpl/' );

define( 'DIR_TPL_COMPILE', 'tpl_c/' );

define( 'DIR_TPL_HTML', 'home/html/' );

define( 'DIR_BACKUP', 'backup/' );

define( 'DIR_UPLOAD', 'torrents/');

define( 'TITLE', 'wTorrent' );

define( 'META_TITLE', 'rTorrent web interface' );

define( 'META_KEYWORDS', 'rtorrent xmlrpc interface php web html' );

define( 'META_DESCRIPTION', 'rtorrent web inrface using xmlrpc' );

define( 'DIR_CSS_DETALLS', 'home/css/detalls.css' );

define( 'DIR_CSS_ESTIL', 'home/css/estil.css' );

define( 'DIR_JS', 'home/js/javasc.js' );

define( 'DIR_JSHADE', 'home/js/shadedborder.js' );

define( 'DIR_JSPROTO', 'home/js/prototype.js' );

define( 'DIR_SCRIPTACULOUS','home/js/scriptaculous/scriptaculous.js');

define( 'DIR_FAVICO', 'favicon.ico' );

define( 'DIR_IMG', 'home/img/' );

define( 'SRC_INDEX', 'index.php' );

define( 'SCRAMBLE', false);

define( 'APP', 'wTorrent' );

require_once( 'lib/inc/includes.inc.php' );

autoload( 'lib/cls/', 'cls/', 'home/cls/' );

ini_set( 'include_path', DIR_EXEC );

?>








次に、必要なすべてのフォルダーとファイルのアクセス許可を書き込みます。



chown -R rt:rt /var/www/torrent/www

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

chmod data 755

touch ./db/database.db








すべてが機能するためには、サーバーを再起動することをお勧めします。 ローカルマシンからWebインターフェイスにアクセスする場合は、次の行を追加します。



127.0.0.1 torrent







/ etc / hostsファイルに。 別のマシンからインターフェースにアクセスする場合は、上記の行をホスト上のホストに追加し、127.0.0.1をrtorrentのマシンのIPに置き換えます。



再起動後、ブラウザでtorrent / install.php URLを開き、インストールを完了します。 もちろん、ユーザー名とパスワードを除くすべてをデフォルトで残すことができます。 インストール後、ファイル/var/www/torrent/www/install.phpを強制終了することを忘れないでください。



何かを忘れたら、コメントで答えます。 このマニュアルに関する建設的なコメントに感謝します。



All Articles