【轉】【Centos】centos 安裝libtorrent/rtorrent


1.下載編譯時需要的軟件
yum install gcc gcc-c++ m4 make automake libtool pkgconfig perl openssl-devel ncurses-devel cppunit-devel
 
2.下載 curl, libsigc++, libtorrent 和 rtorrent
wget https://curl.haxx.se/download/curl-7.60.0.tar.gz
wget http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.10/libsigc++-2.10.0.tar.xz
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.3.tar.gz
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.3.tar.gz
 
3.編譯安裝 curl
 
tar -xvzf curl-7.60.0.tar.gz
cd curl-7.60.0
./configure
make
make install
 
4.編譯安裝 libsigc++
xz -d libsigc++-2.10.0.tar.xz
tar -xvf libsigc++-2.10.0.tar
cd libsigc++-2.10.0
./configure
make
make install
 
5.編譯安裝 libtorrent
tar -xvzf libtorrent-0.13.3.tar.gz
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
cd libtorrent-0.13.3
rm -f scripts/{libtool,lt*}.m4
./autogen.sh
./configure
make
make install
 
5.源碼安裝 libtorrent(另一種安裝方法)
wget https://codeload.github.com/arvidn/libtorrent/tar.gz/libtorrent-1_1_7
這里下載下來文件如果沒有后綴,可以自己加上 libtorrent-1_1_7.tar.gz
tar -zxvf libtorrent-1_1_7.tar.gz
cd libtorrent-1_1_7
sh ./autogen.sh
./configure
make && make install
 
 
6.編譯安裝 rtorrent
 
tar -xvzf rtorrent-0.9.3.tar.gz
cd rtorrent-0.9.3
rm -f scripts/{libtool,lt*}.m4
./autogen.sh
./configure
make
make install
 
7.配置
vi  /root/.rtorrent.rc

# ---------------------------------------- 
# rtorrent 配置文檔
# 存放位置:~  (使用者home) 
# ---------------------------------------- 
# 每 torrent 最小/最大連接數
min_peers = 500 
max_peers = 5000

# 每 torrent 最大上傳數
max_uploads = 1000

# 上傳和下傳速度限制,設0=無限制.(單位 KB/s) 
download_rate = 0 
upload_rate = 2000

#隨機 port 范圍 
port_range = 19000-55000

# 下載文件編碼
encoding_list = UTF-8

# 下載存放目錄
directory = /home/bt/download

# 快取存放目錄 
session = /home/bt/session

# torrent 存放目錄 和 排程設定 
# 放在此目錄的中的 torrent 會自動加入列表 
schedule = watch_directory,5,5,load_start=/home/bt/torrent/*.torrent

# DHT  
dht = on

# DHT port 
dht_port = 50000

 
8.操作方法 
⑴. 方向鍵 : ↑,↓,←,→ 
⑵. Torrent 開始下載 : Ctrl + S (Screen下用法為: Ctrl+ a + s) 
⑶. Torrent 暫停下載 : Ctrl + D 
⑷. Torrent 停止下載 : Ctrl + K 
⑸. 清除Torrent下載列表 : [法1] 在停止狀態使用Ctrl + D, [法2] 在下載完成連續執行 Ctrl+D 二次 
⑹. 限定最大上傳速度 : [增加]a / s / d [減少] z / x /c 
⑺. check file hash : Ctrl + R 
⑻. 離開rtorrent : Ctrl+ q (Screen下用法為 : Ctrl+ a + q)
 
9.使用screen
因為 rtorrent 是終端命令行軟件,終端一關掉程序也會停止,搭配 screen 可以解決這個問題。 screen 就是把終端下軟件放到背景執行,即使終端關掉,程序仍在執行,下次還可以叫回來。
安裝:
yum install screen
vi  ~/.screenrc
 

# .screenrc 簡易設定

########################################## 
#               環境設定                 # 
##########################################

# screen 的 escape 鍵,下熱鍵指令前的「前導按鍵組合」 
# 預設值為 ^aa,即 <Ctrl> + <a> 
# 可隨喜好更改,例:^zz 代表 <Ctrl> + <z> 
escape ^aa

# 是否啟動時顯示歡迎訊息?on:顯示 off:不顯示 
startup_message off

# 是否顯示錯誤提示?on:顯示 off:不顯示 
vbell off

autodetach on

shell -$SHELL

allpartial off

defc1 off

defencoding utf8

########################################## 
#           Buttom Status Bar        
##########################################

caption always "%{=u .d} %-w%<%{=ub .B}%n %t%{=u .d}%+w "

hardstatus alwaysignore 
# hardstatus alwayslastline "%{= .K} [%l]%<%=%{= .W}@%H %=%{= .y} %Y %M %d(%D) %{= .m} %C %A"

########################################## 
#           顏色設定             # 
##########################################

term xterm 
termcapinfo xterm "Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm"

# allow bold colors - necessary for some reason 
attrcolor b ".I" 
attrcolor i "+b"

# erase background with current bg color 
defbce on

########################################## 
#           綁定功能熱鍵設定             # 
########################################## 
# 格式: 
# bindkey [按鍵組合碼] [功能] 
# bind [單一英文按鍵] [功能] 

# 說明: 
# bindkey 直接描述一種按鍵組合,例如:<ctrl> + 方向鍵右→,需使用「按鍵碼」。 
# bind    按了 escape 鍵之后,要接續的單一英文按鍵,區分大小寫。 
# screen 常用預設功能熱鍵: 
# 注1:需先按 escape 鍵「前導按鍵組合」,才能輸入功能熱鍵。 
# 注2:以下功能熱鍵有區分大小寫。 
# ======================================================== 
# d   中斷當前 screen,下次可以用 screen -r 命令恢復。 
# c   開新視窗。 
# K   殺掉目前所在視窗。(大寫K) 
# 0-9 在視窗編號 0~9 之間快速切換。 
# n   下一個視窗。 
# p   上一個視窗。 
# S   分割屏幕,在一個屏幕下容納多個視窗。(大寫S) 
# TAB 在分割的屏幕之間切換。 
# X   暫時鎖定,輸入密碼才能解除。副作用:關閉所有分割出的屏幕。(大寫X) 
# [   進入復制模式,用上下左右移動光標,空白鍵選中開始點選,再次按空白鍵結束點選。 
# ]   貼上「復制模式」時拷貝的字串。 
# ?   呼叫 screen 的幫助文件。 
# :   進入screen的命令行。 
# ========================================================

############### 
#  跳轉視窗   # 
############### 
# 說明: 
# next:下一個 , prev 上一個

bindkey "^[O5C" next 
bindkey "^[O5D" prev

bindkey "^[[C" next 
bindkey "^[[D" prev

bindkey "^[[1;5D" prev 
bindkey "^[[1;5C" next

bindkey "^[[5D" prev 
bindkey "^[[5C" next

 

screen 用法如下:

    1. 把配置文件存成.screenrc放在home目錄下。 
    2. 執行screen 
    3. 你就會看到只有一個page 的screen 
    4. 成功

    screen的命令大多是先按Ctrl + a 之后再按command,以下用C-a-?表示

    * C-a-c : 開一個新的page 
    * C-a-p : 回到上一個page 
    * C-a-n : 到下一個page 
    * C-a-d : 離開screen,但是不關掉screen 
    * C-a-ESC : 進入buffer模式,可以用方向鍵和Page up and down瀏覽 
    * C-a-k : 殺掉一個page 
    * C-a-[1-9]: 跑到第#個page
 

大小寫有區分,screen 只接受小寫的指令,此外直接 Ctrl + 方向鍵左右,也能切換 page

離開終端機時,要記得 Ctrl+a 然后 d 
離開 screent (仍在背景執行) 
下次叫回來,打指令 screen -r 就可叫回來

 

原文地址:http://blog.sina.com.cn/s/blog_40ce02d7010173p5.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM