[macOS] Aria2 安裝與設定

安裝 Aria2 並且產生設定檔

$ brew install aria2
$ cd ~
$ mkdir .aria2
$ cd .aria2
$ touch aria2.conf

打開設定檔

$ open 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=/Users/xxx/Downloads
#檔案快取, 使用內建的檔案快取, 如果你不相信Linux核心檔案快取和磁碟內建快取時使用, 需要1.16以上版本
#disk-cache=0
#另一種Linux檔案快取方式, 使用前確保您使用的核心支援此選項, 需要1.15以上版本(?)
#enable-mmap=true
#檔案預先分配, 能有效降低檔案碎片, 提高磁碟效能. 缺點是預先分配時間較長
#所需時間 none < falloc ? trunc « prealloc, falloc和trunc需要檔案系統和核心支持
file-allocation=prealloc

上面下載路徑的「/Users/xxx/Downloads」可以改為任何你想要的絕對路徑,也可以自行設定連線密碼。

啟動 Aria2 於指令列背景

$ aria2c --conf-path="/Users/xxxxxx/.aria2/aria2.conf" -D

設定一個 WEB 介面

$ git clone https://github.com/ziahamza/webui-aria2
$ cd webui-aria2 
$ open index.html

即可開始使用 aria2

發表在 NEWS