Bear一直以為raspberry pi對於非開發者、一般用戶最具吸引力的行為
不是拿來當影音機上盒(xmbc),就是當BT下載器了
而今Bear將介紹如何拿來當個稱職的BT下載器
不是拿來當影音機上盒(xmbc),就是當BT下載器了
而今Bear將介紹如何拿來當個稱職的BT下載器
為什麼說很適合呢?
想想看,拿一台一般PC開機24小時,這是多麼耗電的行為
雖說,PC同時可以做許多事,但使用者也不可能連續使用PC超過24小時吧
再者是PT站的玩家,有個省電且24*7工作的種子盒,不也是很方便的事 ?
說到BT下載器,總是需要一個BT客戶端軟體
RPI是使用Unix-like的系統,那就從這邊著手吧
如果有注意到題圖的話
Bear選擇的是rTorrent (with libTorrent)
選擇理由很單純,只因為作者Jari Sundell對此的目標是"a focus on high performance and good code"
沒錯,高效能且優異;再者用終端機執行BT客戶端不也頗潮嗎(大誤)
不多說,開始動手做吧
首先,需要一個裝好系統的PI
(如何裝系統參考這裡)
更新套件庫吧
sudo apt-get update
安裝編譯xmlrpc、rTorrent、libTorrent時使用的編譯工具
其中rTorrent、libTorrent是rTorrent客戶端分成兩個專案處理
至於為什麼要分開,可能就得問作者了
xmlrpc是遠端程序呼叫的工具,簡單的說,就是想用網頁控制rTorrent
sudo apt-get install gcc libncurses5-dev libsigc++-2.0-dev libssl-dev subversion
想想看,拿一台一般PC開機24小時,這是多麼耗電的行為
雖說,PC同時可以做許多事,但使用者也不可能連續使用PC超過24小時吧
再者是PT站的玩家,有個省電且24*7工作的種子盒,不也是很方便的事 ?
說到BT下載器,總是需要一個BT客戶端軟體
RPI是使用Unix-like的系統,那就從這邊著手吧
如果有注意到題圖的話
Bear選擇的是rTorrent (with libTorrent)
選擇理由很單純,只因為作者Jari Sundell對此的目標是"a focus on high performance and good code"
沒錯,高效能且優異;再者用終端機執行BT客戶端不也頗潮嗎(大誤)
不多說,開始動手做吧
首先,需要一個裝好系統的PI
(如何裝系統參考這裡)
更新套件庫吧
sudo apt-get update
安裝編譯xmlrpc、rTorrent、libTorrent時使用的編譯工具
其中rTorrent、libTorrent是rTorrent客戶端分成兩個專案處理
至於為什麼要分開,可能就得問作者了
xmlrpc是遠端程序呼叫的工具,簡單的說,就是想用網頁控制rTorrent
sudo apt-get install gcc libncurses5-dev libsigc++-2.0-dev libssl-dev subversion
取得xmlrpc原始碼進行編譯與安裝
(SVN是一種版本控制的工具,簡單說就是去抓別人開發中的原始碼)
svn checkout http://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/advanced xmlrpc-c
進入下載好的資料夾xmlrpc-c
cd ./xmlrpc-c
取得編譯需要的關聯文件
./configure
開始編譯
make
編譯完安裝
sudo make install
上述動作可能需要一些時間
(SVN是一種版本控制的工具,簡單說就是去抓別人開發中的原始碼)
svn checkout http://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/advanced xmlrpc-c
進入下載好的資料夾xmlrpc-c
cd ./xmlrpc-c
取得編譯需要的關聯文件
./configure
開始編譯
make
編譯完安裝
sudo make install
上述動作可能需要一些時間
接下來下載、編譯和安裝libTorrent
..在*nix系統表示上一個目錄
cd ../
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.3.tar.gz
wget是下載網站上的檔案的指令
tar -xvzf ./libtorrent-0.13.3.tar.gz
tar是打包、壓縮與解壓縮
(感謝讀者Ted指出錯誤)
cd ./libtorrent -0.13.3./configure
make
sudo make install
當然編譯需要些時間
..在*nix系統表示上一個目錄
cd ../
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.3.tar.gz
wget是下載網站上的檔案的指令
tar -xvzf ./libtorrent-0.13.3.tar.gz
tar是打包、壓縮與解壓縮
(感謝讀者Ted指出錯誤)
cd ./libtorrent -0.13.3./configure
make
sudo make install
當然編譯需要些時間
再來就是rTorrent
依樣畫葫蘆
cd ../
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.3.tar.gz
tar -zxvf ./rtorrent-0.9.3.tar.gz
cd ./rtorrent
./configure --with-xmlrpc-c=/usr/local/bin/xmlrpc-c-config
因為打算採用網頁管理方式,所以在編譯前要記得指定xmlrpc
make
sudo make install
到這邊就完成了安裝了
依樣畫葫蘆
cd ../
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.3.tar.gz
tar -zxvf ./rtorrent-0.9.3.tar.gz
cd ./rtorrent
./configure --with-xmlrpc-c=/usr/local/bin/xmlrpc-c-config
因為打算採用網頁管理方式,所以在編譯前要記得指定xmlrpc
make
sudo make install
到這邊就完成了安裝了
接下來,稍微設定一下rTorrent吧
從剛剛編譯完成的rTorrent資料夾中有預設的設定檔
抓來用吧
cp ./doc/rtorrent.rc ~/.rtorrent.rc
cd ~
~是指該帳號的家目錄,如果帳號是pi,那就是/home/pi/;另外“ . ”在前方為隱藏檔
編輯剛剛複製的設定檔吧
vim ./.rtorrent.rc
紅字部分記得依需求更改
從剛剛編譯完成的rTorrent資料夾中有預設的設定檔
抓來用吧
cp ./doc/rtorrent.rc ~/.rtorrent.rc
cd ~
~是指該帳號的家目錄,如果帳號是pi,那就是/home/pi/;另外“ . ”在前方為隱藏檔
編輯剛剛複製的設定檔吧
vim ./.rtorrent.rc
紅字部分記得依需求更改
#======================================================
# 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.
# 檔案語系設定,原設定檔無此選項,建議補上
encoding_list = UTF-8
# Maximum and minimum number of peers to connect to per torrent.
# 每個torrent的最大/最小連接數
min_peers = 40
max_peers = 100
# Same as above but for seeding completed torrents (-1 = same as downloading)
# 完成的torrent的最大/最小連接數
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 = /home/pi/[Where]
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
# 放置各個torrent設定目錄,請自行決定位置
session = /home/pi/[Wherer is the session]
# Watch a directory for new torrents, and stop those that have been
# deleted.
# 擺置此目錄的torrent會自動執行下載,5表示每5分鐘檢查一次,請自行決定位置
schedule = watch_directory,5,5,load_/home/pi/[Where is the torrent]/*.torrent
#schedule = untied_directory,5,5,stop_untied=
# Close torrents when diskspace is low.
# 當硬碟空間剩餘多少時,停止下載
schedule = low_diskspace,5,60,close_low_diskspace=100M
# The ip address reported to the tracker.
# Server的IP跟域名,不知道可以不用設
#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.
# rtorrent對外埠口
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.
# 檢查完成torrent的HASH檔
#check_hash = no
# Set whether the client should try to connect to UDP trackers.
# 是否使用UDP trackers
use_udp_trackers = yes
# Alternative calls to bind and ip that should handle dynamic ip's.
#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
#
# 加密連線
#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
dht = auto
# UDP port to use for DHT.
# DHT的對外埠口
dht_port = 6881
# Enable peer exchange (for torrents not marked private)
# 啟用peer交換
peer_exchange = yes
#===========================================
# 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.
# 檔案語系設定,原設定檔無此選項,建議補上
encoding_list = UTF-8
# Maximum and minimum number of peers to connect to per torrent.
# 每個torrent的最大/最小連接數
min_peers = 40
max_peers = 100
# Same as above but for seeding completed torrents (-1 = same as downloading)
# 完成的torrent的最大/最小連接數
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 = /home/pi/[Where]
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
# 放置各個torrent設定目錄,請自行決定位置
session = /home/pi/[Wherer is the session]
# Watch a directory for new torrents, and stop those that have been
# deleted.
# 擺置此目錄的torrent會自動執行下載,5表示每5分鐘檢查一次,請自行決定位置
schedule = watch_directory,5,5,load_/home/pi/[Where is the torrent]/*.torrent
#schedule = untied_directory,5,5,stop_untied=
# Close torrents when diskspace is low.
# 當硬碟空間剩餘多少時,停止下載
schedule = low_diskspace,5,60,close_low_diskspace=100M
# The ip address reported to the tracker.
# Server的IP跟域名,不知道可以不用設
#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.
# rtorrent對外埠口
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.
# 檢查完成torrent的HASH檔
#check_hash = no
# Set whether the client should try to connect to UDP trackers.
# 是否使用UDP trackers
use_udp_trackers = yes
# Alternative calls to bind and ip that should handle dynamic ip's.
#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
#
# 加密連線
#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
dht = auto
# UDP port to use for DHT.
# DHT的對外埠口
dht_port = 6881
# Enable peer exchange (for torrents not marked private)
# 啟用peer交換
peer_exchange = yes
#===========================================
上述設定就自行依需求更改
當然還有更複雜的設定方式,這部分就留給各位研究了
對了,編輯完別忘了存檔
接著可以試著啟動看看
rtorrent
如果發現啟動不了
出現類似下面的提示:
rtorrent: error while loading shared libraries: libtorrent.so.17: cannot open shared object file: No such file or directory
這可能是lib檔的相關路徑出錯
手動除錯吧
sudo vim /etc/ld.so.conf
如果裡面只有include /etc/ld.so.conf.d/*.conf 那就是lib檔路徑沒設定好
補上藍字
include /etc/ld.so.conf.d/*.conf
/usr/lib
/usr/local/lib
然後更新
sudo ldconfig
再執行看看吧
當然還有更複雜的設定方式,這部分就留給各位研究了
對了,編輯完別忘了存檔
接著可以試著啟動看看
rtorrent
如果發現啟動不了
出現類似下面的提示:
rtorrent: error while loading shared libraries: libtorrent.so.17: cannot open shared object file: No such file or directory
這可能是lib檔的相關路徑出錯
手動除錯吧
sudo vim /etc/ld.so.conf
如果裡面只有include /etc/ld.so.conf.d/*.conf 那就是lib檔路徑沒設定好
補上藍字
include /etc/ld.so.conf.d/*.conf
/usr/lib
/usr/local/lib
然後更新
sudo ldconfig
再執行看看吧
咦!這樣不是終端機一關閉,rtorrent也跟著關閉嗎?
放心!接下來將要介紹背景處理與網頁控制
請大家耐心等待下篇教學!
參考資料:(1)、(2)、(3)、(4)
點選前往RPI : BT下載教學<下篇>
喜歡這篇文章嗎? 趕快加入Takobear粉絲團吧!
放心!接下來將要介紹背景處理與網頁控制
請大家耐心等待下篇教學!
參考資料:(1)、(2)、(3)、(4)
點選前往RPI : BT下載教學<下篇>
喜歡這篇文章嗎? 趕快加入Takobear粉絲團吧!