linux 系統安裝aria2以及配置web端
阿新 • • 發佈:2018-12-13
1、安裝aria2c
yum install -y wget && wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && rpm -ivh epel-release-latest-7.noarch.rpm && yum install aria2
2、建立配置檔案
mkdir /etc/aria2/ && vi /etc/aria2/aria2.conf
**配置檔案內容如下:**
## '#'開頭為註釋內容, 選項都有相應的註釋說明, 根據需要修改 ## ## 被註釋的選項填寫的是預設值, 建議在需要修改時再取消註釋 ## ## 進度儲存相關 ## # 從會話檔案中讀取下載任務 #input-file=aria2.session # 在Aria2退出時儲存`錯誤/未完成`的下載任務到會話檔案 #save-session=aria2.session # 定時儲存會話, 0為退出時才儲存, 需1.16.1以上版本, 預設:0 #save-session-interval=60 ## 檔案儲存相關 ## # 檔案的儲存路徑, 預設: 當前啟動位置 #dir=/tmp/Downloads # 啟用磁碟快取, 0為禁用快取, 需1.16以上版本, 預設:16M #disk-cache=32M # 檔案預分配方式, 能有效降低磁碟碎片, 預設:prealloc # 預分配所需時間: none < falloc ? trunc < prealloc # falloc和trunc則需要檔案系統和核心支援 # NTFS建議使用falloc, EXT3/4建議trunc, MAC 下需要註釋此項 #file-allocation=none # 斷點續傳 continue=true ## 下載連線相關 ## # 最大同時下載任務數, 執行時可修改, 預設:5 #max-concurrent-downloads=5 # 同一伺服器連線數, 新增時可指定, 預設:1 max-connection-per-server=5 # 最小檔案分片大小, 新增時可指定, 取值範圍1M -1024M, 預設:20M # 假定size=10M, 檔案為20MiB 則使用兩個來源下載; 檔案為15MiB 則使用一個來源下載 min-split-size=10M # 單個任務最大執行緒數, 新增時可指定, 預設:5 #split=5 # 整體下載速度限制, 執行時可修改, 預設:0 #max-overall-download-limit=0 # 單個任務下載速度限制, 預設:0 #max-download-limit=0 # 整體上傳速度限制, 執行時可修改, 預設:0 #max-overall-upload-limit=0 # 單個任務上傳速度限制, 預設:0 #max-upload-limit=0 # 禁用IPv6, 預設:false #disable-ipv6=true # 連線超時時間, 預設:60 #timeout=60 # 最大重試次數, 設定為0表示不限制重試次數, 預設:5 #max-tries=5 # 設定重試等待的秒數, 預設:0 #retry-wait=0 ## RPC相關設定 ## # 啟用RPC, 預設:false enable-rpc=true # 允許所有來源, 預設:false rpc-allow-origin-all=true # 允許非外部訪問, 預設:false rpc-listen-all=true # 事件輪詢方式, 取值:[epoll, kqueue, port, poll, select], 不同系統預設值不同 #event-poll=select # RPC監聽埠, 埠被佔用時可以修改, 預設:6800 #rpc-listen-port=6800 # 設定的RPC授權令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 選項 #rpc-secret=<TOKEN> # 設定的RPC訪問使用者名稱, 此選項新版已廢棄, 建議改用 --rpc-secret 選項 #rpc-user=<USER> # 設定的RPC訪問密碼, 此選項新版已廢棄, 建議改用 --rpc-secret 選項 #rpc-passwd=<PASSWD> # 是否啟用 RPC 服務的 SSL/TLS 加密, # 啟用加密後 RPC 服務需要使用 https 或者 wss 協議連線 #rpc-secure=true # 在 RPC 服務中啟用 SSL/TLS 加密時的證書檔案, # 使用 PEM 格式時,您必須通過 --rpc-private-key 指定私鑰 #rpc-certificate=/path/to/certificate.pem # 在 RPC 服務中啟用 SSL/TLS 加密時的私鑰檔案 #rpc-private-key=/path/to/certificate.key ## BT/PT下載相關 ## # 當下載的是一個種子(以.torrent結尾)時, 自動開始BT任務, 預設:true #follow-torrent=true # BT監聽埠, 當埠被遮蔽時使用, 預設:6881-6999 listen-port=51413 # 單個種子最大連線數, 預設:55 #bt-max-peers=55 # 開啟DHT功能, PT需要禁用, 預設:true enable-dht=false # 開啟IPv6 DHT功能, PT需要禁用 #enable-dht6=false # DHT網路監聽埠, 預設:6881-6999 #dht-listen-port=6881-6999 # 本地節點查詢, PT需要禁用, 預設:false #bt-enable-lpd=false # 種子交換, PT需要禁用, 預設:true enable-peer-exchange=false # 每個種子限速, 對少種的PT很有用, 預設:50K #bt-request-peer-speed-limit=50K # 客戶端偽裝, PT需要 peer-id-prefix=-TR2770- user-agent=Transmission/2.77 # 當種子的分享率達到這個數時, 自動停止做種, 0為一直做種, 預設:1.0 seed-ratio=0 # 強制儲存會話, 即使任務已經完成, 預設:false # 較新的版本開啟後會在任務完成後依然保留.aria2檔案 #force-save=false # BT校驗相關, 預設:true #bt-hash-check-seed=true # 繼續之前的BT任務時, 無需再次校驗, 預設:false bt-seed-unverified=true # 儲存磁力連結元資料為種子檔案(.torrent檔案), 預設:false bt-save-metadata=true
3、啟動
aria2c --conf-path=/etc/aria2/aria2.conf
4、安裝Web UI
wget https://github.com/straightedge4life/webui-aria2/archive/master.zip && unzip webui-aria2-master.zip
把以上解壓的內容移動到nginx或者Apache的網站目錄。
如果沒有web伺服器則:
yum -y install httpd
然後把webui-aria2-master目錄內的內容複製到/var/www/html/下即可
5、開啟監聽RPC埠
aria2c --enable-rpc --rpc-listen-all
6、如果提示“Oh Snap! Could not connect to the aria2 RPC server. Will retry in 10 secs. You might want to check the connection settings by going to Settings > Connection Settings” 請依次點選:“Settings”—>“Connection Settings”---->把“Enter the port”埠號改為:6800 如果還不行請開放對應的埠
1. 開放埠命令: /sbin/iptables -I INPUT -p tcp --dport 6800 -j ACCEPT 2.儲存:/etc/rc.d/init.d/iptables save 3.重啟服務:/etc/init.d/iptables restart
附: 1、配置檔案模板 (不會改就用上面第二步中的配置模板)