天天看點

CentOS6搭建aria2+webUI

1、安裝rpmforge源

wget -c http://repository.it4i.cz/mirrors/repoforge/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm           

複制

    注意:centos7的rpmforge源在這裡:

    http://repository.it4i.cz/mirrors/repoforge/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

2、安裝Aria2伺服器端

yum install aria2           

複制

3、Aria2配置檔案

    建立Aria2配位檔案夾:

mkdir /etc/aria2           

複制

    建立Aria2配置檔案:

vi /etc/aria2/aria2.conf           

複制

    配置檔案内容如下:

#使用者名

#rpc-user=user

#密碼

#rpc-passwd=passwd

#上面的認證方式不建議使用,建議使用下面的token方式

#設定加密的密鑰

#rpc-secret=token

#允許rpc

enable-rpc=true

#允許所有來源, web界面跨域權限需要

rpc-allow-origin-all=true

#允許外部通路,false的話隻監聽本地端口

rpc-listen-all=true

#RPC端口, 僅當預設端口被占用時修改

rpc-listen-port=6800

#最大同時下載下傳數(任務數), 路由建議值: 3

max-concurrent-downloads=5

#斷點續傳

continue=true

#同伺服器連接配接數

max-connection-per-server=5

#最小檔案分片大小, 下載下傳線程數上限取決于能分出多少片, 對于小檔案重要

min-split-size=10M

#單檔案最大線程數, 路由建議值: 5

split=10

#下載下傳速度限制

max-overall-download-limit=0

#單檔案速度限制

max-download-limit=0

#上傳速度限制

max-overall-upload-limit=0

#單檔案速度限制

max-upload-limit=0

#斷開速度過慢的連接配接

#lowest-speed-limit=0

#驗證用,需要1.16.1之後的release版本

#referer=*

#檔案儲存路徑, 預設為目前啟動位置

dir=/root/downloads

#檔案緩存, 使用内置的檔案緩存, 如果你不相信Linux核心檔案緩存和磁盤内置緩存時使用, 需要1.16及以上版本

#disk-cache=0

#另一種Linux檔案緩存方式, 使用前確定您使用的核心支援此選項, 需要1.15及以上版本(?)

#enable-mmap=true

#檔案預配置設定, 能有效降低檔案碎片, 提高磁盤性能. 缺點是預配置設定時間較長

#所需時間 none < falloc ? trunc << prealloc, falloc和trunc需要檔案系統和核心支援

file-allocation=prealloc

4、背景啟動Aria2

aria2c --conf-path=/etc/aria2/aria2.conf -D           

複制

5、搭配Aria2 Web-ui

    安裝git:

yum install -y git           

複制

    下載下傳wei-ui:

git clone https://github.com/ziahamza/webui-aria2           

複制

    在webui-aria2目錄下運作:

python -m SimpleHTTPServer 9999           

複制

    開放9999端口:

/sbin/iptables -I INPUT -p tcp --dport 9999 -j ACCEPT
/etc/init.d/iptables save
service iptables restart           

複制