Rtorrent webui
Начинаем как всегда с обновления портов. Ставим нужные порты:
cd /usr/ports/www/lighttpd
снимаем все галки, нам тут ничего не надо
cd /usr/ports/lang/php5
выбираем только fastcgi
cd /usr/ports/lang/php5-extensions
ставим галку только напротив xmlrpc
cd /usr/ports/net-p2p/rtorrent
отмечаем xmlrpc
cd /usr/ports/sysutils/screen
смело снимаем все галки.
порты поставили, теперь конфиги.
cat /usr/local/etc/lighttpd.conf
server.modules = (
"mod_rewrite",
"mod_redirect",
"mod_alias",
"mod_access",
"mod_auth",
"mod_fastcgi",
"mod_scgi",
"mod_accesslog" )
server.document-root = "/usr/local/www/"
server.errorlog = "/var/log/lighttpd.error.log"
index-file.names = ( "index.php", "index.html","index.htm", "default.htm" )
server.event-handler = "freebsd-kqueue" # needed on OS X
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jar" => "application/x-java-archive",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".cpp" => "text/plain",
".log" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
"" => "application/octet-stream",
)
accesslog.filename = "/var/log/lighttpd.access.log"
url.access-deny = ("~", ".inc", ".db", ".tpl.php", ".cls.php",)
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www"
server.groupname = "www"
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/tmp/fcgi",
"bin-path" => "/usr/local/bin/php-cgi"
)
)
)
scgi.server = (
"/RPC2" =>
( "127.0.0.1" =>
(
"socket" => "/var/tmp/rtorrent_rpc.socket",
"check-local" => "disable",
"disable-time" => 0, # don't disable scgi if connection fails
)
)
)
auth.backend = "htdigest"
auth.backend.htdigest.userfile = "/usr/local/www/rtorrent/rtorrent_users"
auth.require = ( "/RPC2" =>
(
"method" => "basic",
"realm" => "XML-RPC",
"require" => "valid-user"
)
)
в /etc/rc.conf добавляем следущее:
lighttpd_enable="YES" rtorrent_enable="YES" rtorrent_args="-n -d /mnt/hdd2/p2p/bittorrent -s /mnt/hdd2/p2p/bittorrent/session" rtorrent_user="opt1k"
тут opt1k это пользователь от котрого будем пускать rtorrent, /mnt/hdd2/p2p/bittorrent путь куда будут лететь торренты по умлочанию(в веб морде можно назначать любой путь), /mnt/hdd2/p2p/bittorrent/sessions честно скажу - не знаю что оно там хранит, но подозреваю что .torrent файлы.
Сделаем стартовый скриптик для rtorrent:
cat /usr/local/etc/rc.d/rtorrent
#!/bin/sh
#
#
# PROVIDE: rtorrent
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name="rtorrent"
rcvar=`set_rcvar`
load_rc_config $name
: ${rtorrent_enable="NO"}
: ${rtorrent_args=""}
: ${rtorrent_user=""}
command="/usr/local/bin/rtorrent"
start_precmd="${name}_prestart"
start_cmd="echo \"Starting ${name}.\"; su ${rtorrent_user} -c 'screen -A -m -d -S rtorrent ${command} \
${rtorrent_args} -o scgi_local=/var/tmp/rtorrent_rpc.socket'"
start_postcmd="${name}_poststart"
rtorrent_prestart()
{
if [ -e "/var/tmp/rtorrent_rpc.socket" ]; then
rm -R /var/tmp/rtorrent_rpc.socket
fi
return 0
}
rtorrent_poststart()
{
while [ ! -e "/var/tmp/rtorrent_rpc.socket" ];
do
sleep 0.01
echo waiting for /var/tmp/rtorrent_rpc.socket creation...
done
echo done
chown www /var/tmp/rtorrent_rpc.socket
return 0
}
stop_postcmd="rm -R /var/tmp/rtorrent_rpc.socket"
run_rc_command "$1"
Теперь вебморда, взять её можно отсюда: http://vif2ne.ru/nvk/stuff/novik/rtorrent/rtorrent.tar.gz. Распакуем содержимое архива в /usr/local/www/rtorrent. Подрихтуем конфиг:
cat /usr/local/www/rtorrent/config.php <?php $uploads = './torrents'; $uploads_mode = 0777; $settings = './settings'; $scgi_host = "unix:///var/tmp/rtorrent_rpc.socket"; ?>
Создадим файлик авторизации в веб морде:
echo user_name:XML-RPC:`echo -n user_name:XML-RPC:my_pass | md5 | cut -b -32` >> \ /usr/local/www/rtorrent/rtorrent_users
Где user_name - имя пользователя и my_pass - пароль.
Э, надо бы ещё права на стартовый скрипт дать:
chmod +x /usr/local/etc/rc.d/rtorrent
Да и на веб морду:
chmod -R 755 /usr/local/www/rtorrent
Всё, пробуем:
/usr/local/etc/rc.d/lighttpd start /usr/local/etc/rc.d/rtorrent start http://host_ip/rtorrent
От себя хочу сказать спасибо автору переделки webui, к сожалению я его не предупредил о том что выкладываю линк на его труд.
По просьбам трудящихся перевод конфига rtorrent'a:
# This is an example resource file for rTorrent. Copy to # ~/.rtorrent.rc and enable/modify the options as needed. Remember to # uncomment the options you wish to enable. # Maximum and minimum number of peers to connect to per torrent. # максимальное и минимальное число пиров на каждый торрент #min_peers = 40 #max_peers = 100 # Same as above but for seeding completed torrents (-1 = same as downloading) # Тоже самое что и выше, только для сидируемых торрентов (-1 для тех значений что на скачках) #min_peers_seed = 10 #max_peers_seed = 50 # Maximum number of simultanious uploads per torrent. # Максимально число одновременных отдач на торрент #max_uploads = 15 # Global upload and download rate in KiB. "0" for unlimited. # глобальная скорость скачивания и отдачи. "0" без лимита #download_rate = 0 #upload_rate = 0 # Default directory to save the downloaded torrents. # Директория для сохранения торрентов #directory = ./ # Default session directory. Make sure you don't run multiple instance # of rtorrent using the same session directory. Perhaps using a # relative path? # Директория для хранения файлов сессий, не допускается запуск более одно rtorrent'а # с заданием одной и той же диретории. #session = ./session # Watch a directory for new torrents, and stop those that have been # deleted. #Сиотрим директорию на наличие новых торрентов для скачки, и тормозим торрент если # если .torrent файл удалён(можно по самбе накилывать и удалять, прим. автора) #schedule = watch_directory,5,5,load_start=./watch/*.torrent #schedule = untied_directory,5,5,stop_untied= # Close torrents when diskspace is low. # закрываем торренты если мало места на харде #schedule = low_diskspace,5,60,close_low_diskspace=100M #тормозим торренты если множитель отдачи достиг определённый процент #или же если достигнут лимит в байтах #или же достигнут финальный лимит сножителя отдачи в процентах # Stop torrents when reaching upload ratio in percent, # when also reaching total upload in bytes, or when # reaching final upload ratio in percent. # example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0 #schedule = ratio,60,60,"stop_on_ratio=200,200M,2000" # The ip address reported to the tracker. # айпишник сообщаемый трекеру #ip = 127.0.0.1 #ip = rakshasa.no # The ip address the listening socket and outgoing connections is # bound to. # биндим слушающий сокет и исходящии соединения на этот адрес #bind = 127.0.0.1 #bind = rakshasa.no # Port range to use for listening. # диапазон портов для прослушки #port_range = 6890-6999 # Start opening ports at a random position within the port range. #открываем порты внутри диапазоа со случайных значений #port_random = no # Check hash for finished torrents. Might be usefull until the bug is # fixed that causes lack of diskspace not to be properly reported. #проверяем хеш скаченного торента. Может быть полезно до фикса бага, #из-за которого свободное место отображается неверно. #check_hash = no # Set whetever the client should try to connect to UDP trackers. #разрешает клиенту испольование UDP трекеров #use_udp_trackers = yes # Alternative calls to bind and ip that should handle dynamic ip's. #альтернативны вызовы бинда и IP для управления динамическим адресом #schedule = ip_tick,0,1800,ip=rakshasa #schedule = bind_tick,0,1800,bind=rakshasa # Encryption options, set to none (default) or any combination of the following: # allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext # # The example value allows incoming encrypted connections, starts unencrypted # outgoing connections but retries with encryption if they fail, preferring # plaintext to RC4 encryption after the encrypted handshake # опции шифрования, по умолчанию не шифрует. #пример разрешает входящие зашифрованние соединения, начинать нешифрованные #исходящие соединения, но повторять шированными если не получилось. #Предпочтение отдаётся откытому текст вместо RC4, после неудачного шифрования # encryption = allow_incoming,enable_retry,prefer_plaintext # Enable DHT support for trackerless torrents or when all trackers are down. # May be set to "disable" (completely disable DHT), "off" (do not start DHT), # "auto" (start and stop DHT as needed), or "on" (start DHT immediately). # The default is "off". For DHT to work, a session directory must be defined. # разрешаем dht, подробнее читаем тут:http://ru.wikipedia.org/wiki/DHT # dht = auto # UDP port to use for DHT. # порт для ипсользования DHT. # dht_port = 6881 # Enable peer exchange (for torrents not marked private) #разрешить обмен пирами(если торренты не отмечены как частные) # peer_exchange = yes # # Do not modify the following parameters unless you know what you're doing. #не трогайте эти параметры если не знаете что делаете =) # Hash read-ahead controls how many MB to request the kernel to read # ahead. If the value is too low the disk may not be fully utilized, # while if too high the kernel might not be able to keep the read # pages in memory thus end up trashing. # кол-во памяти запрашиваемого у ядра, малое значение может вызвать #простой дисковой подсистемы, большое к сбросу страниц памяти. #hash_read_ahead = 10 # Interval between attempts to check the hash, in milliseconds. #интервал между попытками хеширования #hash_interval = 100 # Number of attempts to check the hash while using the mincore status, # before forcing. Overworked systems might need lower values to get a # decent hash checking rate. #кол-во попыток проверки хеша во время mincore(хер знает что это) статуса, #перед принуждением. Нагруженные системы должны использовать меньшие #значени для получения нормальной скорости проверки хеша. #hash_max_tries = 10
- Ссылка на обсуждение: http://forum.lissyara.su/viewtopic.php?f=46&t=14779
- Статья на сайте: http://www.lissyara.su/?id=1852