顯示具有 rtorrent 標籤的文章。 顯示所有文章
顯示具有 rtorrent 標籤的文章。 顯示所有文章

12月 14, 2013

Transdroid:透過 Android 裝置管理 torrent

Transdroid - Manage your torrents from your Android device

軟體的設定重點只有兩步:

1. 主機 IP 位址

2. 與 torrent 溝通使用的 SCGI 名稱:通常是 RPC2
在 Server 上與這個參數有關的地方共兩處:
(a) web server 裡面 scgi 設定項目
(b) .rtorrent.rc 檔內的 scgi_port 參數

12月 13, 2013

Debian 第一次設定 rtorrent 就上手

零、概念:
User / Browser -->Web Server-->rutorrent--scgi:5000--> rtorrent
前端叫:rutorrent (這是 php 寫成的網頁)
後端叫:rtorrent (兩者差一個"u"字 別搞錯了)

使用者用瀏覽器操作 UI 介面,訊號透過 SCGI 傳到後端的 rtorrent 程式。
一、安裝 web server、php、rtorrent、screen
 # apt-get install lighttpd rtorrent php5-cgi screen
Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  The following NEW packages will be installed:
    lighttpd php5-cgi php5-common rtorrent spawn-fcgi
  After this operation, 23.4 MB of additional disk space will be used.

二、啟用 php 模組
# vim /etc/lighttpd/conf-enabled/15-fastcgi-php.conf
server.modules += ( "mod_fastcgi" )
fastcgi.server += ( ".php" =>
  ((
      "bin-path" => "/usr/bin/php-cgi",
      "socket" => "/var/run/lighttpd/php.socket",
      "max-procs" => 1,
      "bin-environment" => (
          "PHP_FCGI_CHILDREN" => "0",
          "PHP_FCGI_MAX_REQUESTS" => "10000"
      ),
      "bin-copy-environment" => (
              "PATH", "SHELL", "USER"
      ),
      "broken-scriptfilename" => "enable"
   ))
)

三、開啟 Web Server 上的 SCGI 通道 (使用 Port 5000,連線名稱 RPC2)
# vim /etc/lighttpd/conf-enabled/20-bt.conf
server.modules += ( "mod_scgi" )
scgi.server = (
"/RPC2"=>
 (
 "127.0.0.1" =>
  (
   "host" => "127.0.0.1",
   "port" => 5000,
   "check-local" => "disable"
  )
 )
)

四、建立「家目錄」網頁鏈結(假設用戶 jack) 並重新啟動 Web Server
# ln -s /home/jack /var/www/jack
# /etc/init.d/lighttpd restart
* Stopping web server lighttpd             [ OK ]
* Starting web server lighttpd             [ OK ]

五、接下來請用一般用戶(jack)權限,我們要開始設定 Web UI 部份。
$ cd ~
$ wget http://dl.bintray.com/novik65/generic/rutorrent-3.6.tar.gz
$ tar -zxvf rutorrent-3.6.tar.gz
$ chmod -R 777 ./rutorrent/share/
$ mkdir /tmp /bt  /bt/session

六、設定使用者 rtorrent 環境檔案:.rtorrent.rc
$ vim ~/.rtorrent.rc
# Maximum and minimum number of peers to connect to per torrent.
min_peers = 20
max_peers = 60

# Same as above but for seeding completed torrents
min_peers_seed = 1
max_peers_seed = 1

# Maximum number of simultanious uploads per torrent.
max_uploads = 1

# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 1500
upload_rate = 1

# Default directory to save the downloaded torrents.
directory = ./

# Default session directory.
session = ./session

# For Web UI (Rutorrent @ SCGI port 5000)
scgi_port = localhost:5000
encoding_list = UTF-8

# Watch a directory for new torrents
schedule = watch_directory,5,5, "load_start=./*.torrent, d.set_custom1=./../tmp"
system.method.set_key = event.download.finished,move_complete,"execute=mv,-u,$d.get_base_path=,$d.get_custom1=;"

# Enable DHT.
dht = on
dht_port = 6778

# Enable peer exchange
peer_exchange = yes

七、執行 rtorrent 並用 screen 丟在背景執行 (Ctrl+a d)
$ screen
$ cd bt
~/bt$ rtorrent

八、設定結束了。上傳種子有兩種方式:
(a) 透過網頁 http://x.x.x.x/jack/rutorrent/ 進行種子上傳。
(b) 透過 FTP 將種子上傳到 ~/bt/ 目錄下。
九、請記得:rtorrent 一定要在 screen 裡面執行,才能確保 torrent 運作不中斷。

9月 12, 2013

在 Debian 7 環境下執行 rTorrent 0.8.6

Debian 7 "Wheezy" 預設安裝的 rTorrent 版本是:0.9.2

陸續測了幾回合,穩定性都不是很理想,只要下載的檔案數一多,程式整個就炸掉了(Segmentation fault)。想裝回 Debian 6 上的舊版(ver 0.8.6) 又擔心套件庫大亂。最後只好研究一下 rTorrent 這個 package 到底封裝了什麼。

出乎意料地單純,檔案分佈在三個資料夾中:
/usr/bin/rtorrent
/usr/share/doc/rtorrent/NEWS.Debian.gz
/usr/share/doc/rtorrent/changelog.Debian.gz
/usr/share/doc/rtorrent/copyright
/usr/share/doc/rtorrent/examples/fixSession080.py.gz
/usr/share/man/man1/rtorrent.1.gz
那何不先裝新版的 rTorrent 後,再抽換舊版的執行檔?反正關鍵程式只有一個。

1. 所以先裝上 0.9.2 版的 rTorrent,讓 apt 套件庫認定已經安裝該軟體:
# apt-get install rtorrent
2. 取得舊版 v0.8.6 的 rTorrent 及其相依套件:
# dpkg -i libssl0.9.8_0.9.8o-4squeeze14_i386.deb
# dpkg -i libtorrent11_0.12.6-2_i386.deb
# ar x rtorrent_0.8.6-1_i386.deb ( 然後再解開 data.tar.gz 可取得執行檔 )
3. 最後把舊版的 rTorrent 拷到 /usr/bin/ 目錄下面。整個大功告成。

12月 02, 2012

我的 rtorrent.rc

2021 (rtorrent 0.9.7)

# rtorrent (version 0.9.X)
# directory tree [~/bt/session] && [~/bt/unfinished] && [~/done]

# Maximum and minimum number of peers to connect to per torrent.
throttle.min_peers.normal.set = 20
throttle.max_peers.normal.set = 70

# Same as above but for seeding completed torrents (-1 = same as downloading)
throttle.min_peers.seed.set = 1
throttle.max_peers.seed.set = 1

# Maximum number of simultanious uploads per torrent.
throttle.max_uploads.set = 1

# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 2048
upload_rate = 1

# Default directory to save the downloaded torrents.
directory.default.set = ~/bt/unfinished

# Default session directory. Make sure you don't run multiple instance
session.path.set = ~/bt/session
schedule2 = watch_directory,5,5,load.start=~/bt/*.torrent

# Move finished file to [done] directory
method.insert = d.get_finished_dir, simple, "cat=~/done/,$d.custom1="
method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"
method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.get_finished_dir="

# Close torrents when disk-space less than 1000M.
schedule2 = low_diskspace,5,60,close_low_diskspace=1000M

# For web UI -- rutorrent
encoding_list = UTF-8
scgi_port = 127.0.0.1:5000

2012

# Maximum and minimum number of peers to connect to per torrent.
min_peers = 20
max_peers = 70

# Same as above but for seeding completed torrents
min_peers_seed = 1
max_peers_seed = 1

# Maximum number of simultanious uploads per torrent.
max_uploads = 1

# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 700
upload_rate = 2

# Default directory to save the downloaded torrents.
directory = ./

# Default session directory.
session = ./session

# Watch a directory for new torrents.
schedule = 
  watch_directory,5,5, 
  "load_start=./*.torrent, d.set_custom1=./../Download"

# Move completed files to Directory [custom1]
system.method.set_key = 
  event.download.finished,move_complete,
  "execute=mv,-u,$d.get_base_path=,$d.get_custom1=;"

# Enable DHT support for trackerless torrents.
dht = on
dht_port = 6778

# Enable peer exchange (for torrents not marked private)
peer_exchange = yes

12月 03, 2010

rutorrent web ui rtorrent

rutorrent 官方網站

1. 設定 lighttpd
新增 20-bt.conf 設定檔於 /etc/lighttpd/conf-enabled 下面,
server.modules += ( "mod_scgi" )
scgi.server = (
"/RPC1"=>
(
"127.0.0.1" =>
(
"host" => "127.0.0.1",
"port" => 5000,
"check-local" => "disable"
)
),

"/RPC2"=>
(
"127.0.0.1" =>
(
"host" => "127.0.0.1",
"port" => 5001,
"check-local" => "disable"
),
)
)
2. 設定 rtorrent.rc ,其中 scgi 的 port 要與 RPC1 對到
scgi_port = localhost:5000
encoding_list = UTF-8
on_erase = rm_files,"execute=rm,-rf,$d.get_base_path="
directory = ~/bt
3. 解開 rutorrent 的 tar 壓縮,設定 [share] 目錄權限
4. 重新啟動 lighttpd 並用 screen 把 rtorrent 跑起來。
5. 透過網頁就可存取 rtorrent 了。

(注意) 這邊的 RPC2 是提供另一個用戶使用,第二個使用者可以透過 RPC2 來跟後端溝通。