Linux Console 下的 BT 操作
在 Fecora Core 1 安裝 BitTorrent 4.20.9 在 Linux Console 下載 BitTorrent-shared file 在自己的 Web 站臺發(fā)佈自製種子
在 Fecora Core 1 安裝 BitTorrent 4.20.9
安裝
Python 2.4
wget
http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tar.bz2tar jxf Python-2.4.3.tar.bz2
cd Python-2.4.3
./configure
make
make install
安裝
zope.interfacewget
http://www.zope.org/Products/ZopeInterface/3.0.1final/ZopeInterface-3.0.1.tgztar zxf ZopeInterface-3.0.1.tgz
cd ZopeInterface-3.0.1
python setup.py install
安裝
Twistedwget
http://tmrc.mit.edu/mirror/twisted/Twisted/2.4/Twisted-2.4.0.tar.bz2tar jxf Twisted-2.4.0.tar.bz2
cd Twisted-2.4.0
python setup.py install
安裝 python.crypto
wget
http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gztar zxf pycrypto-2.0.1.tar.gz
cd pycrypto-2.0.1
python setup.py install
安裝
BitTorrent 4.20.9
wget
http://download.bittorrent.com/dl/BitTorrent-4.20.9.tar.gztar zxf BitTorrent-4.20.9.tar.gz
cd BitTorrent-4.20.9
python setup.py install
在 Linux Console 下載 BitTorrent-shared file
bittorrent-console --save_in /path/to/save_file http://somewhere.of.internet/somefile.torrent
常用參數備忘
參數 說(shuō)明 範例
--max_upload_rate 限制最大上載頻寬 (B/s) --max_upload_rate 10
--max_download_rate 限制最大下載頻寬 (B/s) --max_download_rate 100
--save_in 下載檔案存放路徑
(預設: ~/Desktop/BitTorrent Downloads) --save_in ~/downloads
--save_as 下載檔案另存檔名 --save_as myname.iso
--save_incomplete_in 未下載完成的檔案存放路徑
(預設: ~/.bittorrent/incomplete) --save_incomplete_in /tmp
--language 設定語(yǔ)系 --language zh_TW
其他備忘
使用 bittorrent-curses 替代 bittorrent-console 指令 (參數相同), 可獲得較佳的視覺(jué)效果 背景執行 bittorrent-console 下載: 於指令最後加上 > /dev/null 2>&1 & 即可
在自己的 Web 站臺發(fā)佈自製種子
Server 端操作 (with Apache HTTP Server)
啟用 BitTorrent tracker
bittorrent-tracker --port 6969 --dfile /tmp/dstate > /dev/null 2>&1 &
產(chǎn)生 .torrent 檔案
maketorrent-console \
--use_tracker http://your.web.host:6969/announce \
/path/to/shared_file
將 .torrent 檔案置入站臺目錄
mv /path/to/file.torrent /var/www/html
於 Apache HTTP Server 設定檔加入 .torrent File Type
vi httpd.conf
AddType application/x-bittorrent .torrent
killall -HUP httpd
產(chǎn)生種子
bittorrent-console \
--save_in /path_of_shared_file/ \
/var/www/html/file.torrent
開(kāi)放防火牆
iptables -A INPUT -p tcp --dport 6969 -j ACCEPT
iptables -A INPUT -p tcp --dport 6881:6889 -j ACCEPT
Client 端操作
以任一種 BitTorrent Client 開(kāi)啟 URL: http://your.web.host/file.torrent 即可
參考資料:
nixCraft Tips & Tricks - Archive: Linux> Command line BitTorrent clientFreespire Wiki - Download Help: Tips for using BitTorrent & Troubleshooting相關(guān)資源:
維基百科 - BitTorrentWindows 平臺最好用的 BitTorrent Client - BitComet跨平臺 BitTorrent Client - AzureusPosted by Jamyy at 2006年08月29日 12:54
Trackback Pings
TrackBack URL for this entry:
http://cha.homeip.net/cgi-bin/mt/mt-tb.cgi/224
Comments
請問(wèn)關(guān)于bittorrent-tracker的作用是追蹤什么信息?
與Windows相比,Linux+Bittorrent的下載速度很慢。這與Bittorrent自身有關(guān)繫嗎?
Posted by: Ivan at 2006年09月11日 15:16
您好!
Tracker 的是指運行於伺服器上的一個(gè)軟體,負責分配頻寬(bandwidth),而不是用於分享檔案的所有人包括種子同peer的ul與dl都依賴(lài)Tracker來(lái)分配頻寬。
這個(gè)軟體能夠追蹤到底有多少人同時(shí)在下載同一個(gè)文件??蛻?hù)端連上tracker伺服器,就會(huì )獲得一個(gè)下載人員的名單,根據這個(gè),BT會(huì )自動(dòng)連上別人的機器進(jìn)行下載。
(引用自: http://www.btzonebt.com/airways/viewthread.php?tid=57844)
Linux 的 BT 比 Windows 的慢? 真的嗎? 不好意思, 雖然我寫(xiě)了這篇關(guān)於 Linux BT 的文章, 但我還真沒(méi)在 Linux 實(shí)際使用過(guò) BT... :P
用搜尋引擎查了一下, 似乎找不到關(guān)於 Linux BT 比較慢的內容. 不過(guò), 就一般使用 BT 軟體的觀(guān)點(diǎn)而言, 會(huì )影響下載速度的不外乎是「防火牆」(未開(kāi)放 tcp port 6881 ~ 6889) 和「網(wǎng)路設置」 (BT 本身允許的上載頻寬太小、其他會(huì )影響傳輸速度的網(wǎng)路設定) 的問(wèn)題, 也許您可以朝這些方向進(jìn)行調整.
Posted by: Jamyy at 2006年09月11日 15:42
您好~
謝謝您的囬答。
其實(shí)關(guān)于Linux下的BT軟件我試了幾個(gè)。
用C寫(xiě)的Libbt(libbt-1.05)和ctorrent(ctorrent-1.3.4)
還有就是這個(gè)Python寫(xiě)的BitTorrent。
比較了一下下載速度,髮現好像BitTorrent的速度稍快,不過(guò)也隻有幾個(gè)KB。而前面兩個(gè)用C寫(xiě)的軟件幾乎沒(méi)有下載速度。而且好像每次都是剛啓動(dòng)的時(shí)候會(huì )有個(gè)很快的下載速度,但是在瞬間就降為0。之后就沒(méi)有任何反應。
我檢查了port是打開(kāi)的,而防火牆我也是關(guān)閉的~
Posted by: Ivan at 2006年09月14日 15:25
您好!
關(guān)於防火牆的部份,
除非您的電腦直接擁有 Public IP, 否則只有開(kāi)放自己本身的防火牆是不夠的.
如果您是透過(guò) IP 分享器上網(wǎng), 那麼就得在 IP 分享器中設置 Virtual Server 或 Port Forwarding, 將 TCP 6881 ~ 6889 port 指向內部 BT 電腦.
如果您是透過(guò)自行架設的 Linux NAT 上網(wǎng), 就在 Linux NAT 設置 iptables:
iptables -t nat -A PREROUTING -p tcp --dport 6881:6889 -j DNAT --to-destination 192.168.1.2
其中, 192.168.1.2 係指內部 BT 電腦 IP, 以上一樣是 Port Forwarding 的意思.
簡(jiǎn)而言之, 就是設定成從外部連結您的 Public IP:6881 就能直接連入 BT 電腦.
P2P 這玩意真的是越多人分享, 下載速度就越快 (或者說(shuō)越能以穩定的進(jìn)度下載成功)
熱門(mén)的檔案或許一兩天就能下載完成, 冷門(mén)的東西也許掛上一個(gè)禮拜也不見(jiàn)得下載得成. 我覺(jué)得這才是真正影響下載速度的因素... :)
Posted by: Jamyy at 2006年09月14日 23:19
Hi
I want to make an auto tracker to my PHP web server, but the following command cannot put in to background:
bittorrent-console case28.pdf.torrent > /dev/null 2>&1 &
Posted by: Tao at 2006年11月10日 17:59
應該是操作錯誤所致. 請將 "> /dev/null 2>&1 &" 拿掉, 以查看錯誤訊息.
如果您要產(chǎn)生種子, 請記得使用 --save_in 參數, 將其指向檔案所在的路徑.
Posted by: Jamyy at 2006年11月13日 10:32
Hi~
透過(guò)google 找到這
我是想問(wèn)問(wèn)有關(guān)Azureus 的問(wèn)題
因為我在RH9 上使用 Azureus , 我也發(fā)生了連線(xiàn)一段時(shí)間
Azureus 跳出了 類(lèi)似 127.0.0.1:6881 disconnection 的字眼(詳細有點(diǎn)忘了) 然後全部下載跟上傳都停止了.
Router 方面我是有開(kāi) virtual server and Special App
但是我在想我是不是也要打開(kāi)iptable 加上
iptables -A INPUT -p tcp --dport 6881:6889 -j ACCEPT
這一串, 因為我感覺(jué)我好像是被自己的防火牆 檔下來(lái)了.
Posted by: RL at 2006年12月06日 11:16
我在 Fedora Core 6 使用 Azureus 2.5.0.0
IP 分享器不做 Virual Server
甚至在 FC6 本機設置 iptables -A INPUT -p tcp --dport 6881:6889 -j DROP 都沒(méi)有發(fā)生你說(shuō)的問(wèn)題
謝謝你告訴我這個(gè)好用的 BT 軟體 :)
Posted by: Jamyy at 2006年12月06日 13:54
from:
http://cha.homeip.net/blog/archives/2006/08/linux_console_b.html#more