git clone https://github.com/aria2/aria2.git vi aria2/src/OptionHandlerFactory.cc OptionHandler* op(new NumberOptionHandler(PREF_MAX_CONNECTION_PER_SERVER, TEXT_MAX_CONNECTION_PER_SERVER, // "1", 1, 16, 'x')); "1", 1, 256, 'x')); ### 用於修改每一個服務器最大鏈接數 OptionHandler* op(new UnitNumberOptionHandler( //PREF_MIN_SPLIT_SIZE, TEXT_MIN_SPLIT_SIZE, "1M", 1_m, 1_g, 'k')); PREF_MIN_SPLIT_SIZE, TEXT_MIN_SPLIT_SIZE, "1M", 256_k, 1_g, 'k')); # 用於調整每一個文件拆分
apt-get install libgnutls28-dev nettle-dev libgmp-dev libssh2-1-dev libc-ares-dev libxml2-dev zlib1g-dev libsqlite3-dev pkg-config libcppunit-dev autoconf automake autotools-dev autopoint libtool git gcc g++ libxml2-dev make quilt libsysfs-dev -y
須要安裝這些依賴包防止編譯出現問題html
cd aria2 autoconf -i ./configure && make && make install
編譯過程當中可能出現異常 getrandom_linux.c:40:24: fatal error: sys/random.h: No such file or directory #include <sys/random.h> ^ compilation terminated. Makefile:2276: recipe for target 'getrandom_linux.lo' failed make[3]: *** [getrandom_linux.lo] Error 1 make[3]: Leaving directory '/opt/aria2/src' Makefile:2341: recipe for target 'all-recursive' failed make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory '/opt/aria2/src' Makefile:556: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/opt/aria2' Makefile:467: recipe for target 'all' failed make: *** [all] Error 2 解決方案 vim /src/getrandom_linux.c 註釋掉 /* #include <sys/random.h> */ 便可
編譯過程真的是很漫長啊 c++ 編譯果真名不虛傳. 主要仍是樹莓派性能問題
直到編譯完成 能夠經過 aria2 -D 啓動linux
mkdir ~/aria2 && touch aria2.conf && aria2.session vim aria2.conf # 基本配置 # 下載目錄 dir=/mnt/B4T/Downloads # 下載從這個文件中找到的urls, 需本身創建這個文件 # touch /home/pi/.aria2/aria2.session input-file=/root/aria2/aria2.session # 最大同時下載任務數,默認 5 max-concurrent-downloads=20 # 斷點續傳,只適用於 HTTP(S)/FTP continue=true # HTTP/FTP 配置 # 關閉鏈接若是下載速度等於或低於這個值,默認 0 #lowest-speed-limit=0 # 對於每一個下載在同一個服務器上的鏈接數,默認 1 max-connection-per-server=256 # 每一個文件最小分片大小,例如文件 20M,設置 size 爲 10M, 則用2個鏈接下載,默認 20M min-split-size=256k # 下載一個文件的鏈接數,默認 5 split=256 # BT 特殊配置 # 啓用本地節點查找,默認 false bt-enable-lpd=true # 指定最大文件數對於每一個 bt 下載,默認 100 #bt-max-open-files=100 # 單種子最大鏈接數,默認 55 bt-max-peers=128 # 設置最低的加密級別,可選全鏈接加密 arc4,默認是頭加密 plain #bt-min-crypto-level=plain # 老是使用 obfuscation handshake,防迅雷必備,默認 false bt-require-crypto=true # 若是下載的是種子文件則自動解析並下載,默認 true #follow-torrent=true bt-tracker=udp://tracker.coppersurfer.tk:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://tracker.internetwarriors.net:1337/announce,http://tracker.internetwarriors.net:1337/announce,udp://9.rarbg.to:2710/announce,udp://exodus.desync.com:6969/announce,udp://explodie.org:6969/announce,http://explodie.org:6969/announce,udp://public.popcorn-tracker.org:6969/announce,http://tracker.vanitycore.co:6969/announce,udp://tracker.vanitycore.co:6969/announce,udp://tracker1.itzmx.com:8080/announce,udp://ipv4.tracker.harry.lu:80/announce,http://tracker1.itzmx.com:8080/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.port443.xyz:6969/announce,udp://thetracker.org:80/announce,udp://open.stealth.si:80/announce,udp://open.demonii.si:1337/announce,udp://denis.stalker.upeer.me:6969/announce,udp://bt.xxx-tracker.com:2710/announce,http://tracker.port443.xyz:6969/announce,udp://tracker.torrent.eu.org:451/announce,udp://retracker.lanta-net.ru:2710/announce,udp://zephir.monocul.us:6969/announce,udp://tracker.uw0.xyz:6969/announce,udp://tracker.toss.li:6969/announce,udp://tracker.cypherpunks.ru:6969/announce,http://tracker.cypherpunks.ru:6969/announce,http://torrent.nwps.ws:80/announce,http://retracker.telecom.by:80/announce,http://open.acgnxtracker.com:80/announce,wss://ltrackr.iamhansen.xyz:443/announce,udp://tracker.iamhansen.xyz:2000/announce,https://tracker.fastdownload.xyz:443/announce,https://opentracker.xyz:443/announce,http://tracker4.itzmx.com:2710/announce,http://tracker3.itzmx.com:6961/announce,http://tracker.city9x.com:2710/announce,http://opentracker.xyz:80/announce,http://open.trackerlist.xyz:80/announce,udp://tracker2.itzmx.com:6961/announce,udp://tracker.swateam.org.uk:2710/announce,udp://tracker.kamigami.org:2710/announce,udp://tracker.ds.is:6969/announce,udp://pubt.in:2710/announce,http://tracker2.itzmx.com:6961/announce,http://tracker.torrentyorg.pl:80/announce,http://t.nyaatracker.com:80/announce,http://share.camoe.cn:8080/announce,http://retracker.mgts.by:80/announce,http://open.acgtracker.com:1096/announce,wss://tracker.openwebtorrent.com:443/announce,wss://tracker.fastcast.nz:443/announce,wss://tracker.btorrent.xyz:443/announce,udp://tracker.justseed.it:1337/announce,udp://packages.crunchbangplusplus.org:6969/announce,https://1337.abcvg.info:443/announce,http://agusiq-torrents.pl:6969/announce # 爲 BT 下載設置 TCP 端口號,確保開放這些端口,默認 6881-6999 listen-port=65298 #Set UDP listening port used by DHT(IPv4, IPv6) and UDP tracker dht-listen-port=65298 # 總體上傳速度限制,0 表示不限制,默認 0 #max-overall-upload-limit=0 # 每一個下載上傳速度限制,默認 0 #max-upload-limit=0 # 種子分享率大於1, 則中止作種,默認 1.0 #seed-ratio=1 # 作種時間大於2小時,則中止作種 seed-time=120 # RPC 配置 # 開啓 JSON-RPC/XML-RPC 服務,默認 false enable-rpc=true # 容許全部來源,web 界面跨域權限須要,默認 false rpc-allow-origin-all=true # 容許外部訪問,默認 false rpc-listen-all=true # rpc 端口,默認 6800 rpc-listen-port=6800 # 設置最大的 JSON-RPC/XML-RPC 請求大小,默認 2M #rpc-max-request-size=2M # rpc 密碼,可不設置 #rpc-passwd=raspberry # rpc 用戶名,可不設置 #rpc-user=aria2pi # 高級配置 # This is useful if you have to use broken DNS and # want to avoid terribly slow AAAA record lookup. # 默認 false disable-ipv6=true # 指定文件分配方法,預分配能有效下降文件碎片,提升磁盤性能,缺點是預分配時間稍長 # 若是使用新的文件系統,例如 ext4 (with extents support), btrfs, xfs or NTFS(MinGW build only), falloc 是最好的選擇 # 若是設置爲 none,那麼不預先分配文件空間,默認 prealloc file-allocation=none # 總體下載速度限制,默認 0 #max-overall-download-limit=0 # 每一個下載下載速度限制,默認 0 #max-download-limit=0 # 保存錯誤或者未完成的下載到這個文件 # 和基本配置中的 input-file 一塊兒使用,那麼重啓後仍可繼續下載 save-session=/root/aria2/aria2.session # 每5分鐘自動保存錯誤或未完成的下載,若是爲 0, 只有 aria2 正常退出纔回保存,默認 0 save-session-interval=300 # 若要用於 PT 下載,需另外的配置,這裏沒寫 # 遠程訪問所需token密碼 rpc-secret=xxxxx # 設置user-agent user-agent=Mozilla/5.0 (Series40; Nokia2055/03.20; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/5.5.0.0.27
https://github.com/ngosang/trackerslist 設置bt track 加速bt下載
http://www.senra.me/solutions-to-aria2-bt-metalink-download-slowly/nginx
touch /etc/init.d/aria2c vim /etc/init.d/aria2c 輸入如下
#!/bin/sh ### BEGIN INIT INFO # Provides: aria2 # Required-Start: $remote_fs $network # Required-Stop: $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Aria2 Downloader ### END INIT INFO do_start() { echo -n "Starting aria2c" su root -c "aria2c --conf-path=/root/aria2/aria2.conf -D" #這裏的路徑根據本身的來更改 } do_stop() { echo -n "Shutting down aria2c " pkill -f aria2c } do_restart() { do_stop sleep 1 do_start } case "$1" in start) do_start ;; stop) do_stop ;; status) exit $? ;; restart) do_restart ;; *) echo "Usage: service aria2c {start|stop|status|restart}" >&2 exit 1 ;; esac exit
程序自啓動 sudo update-rc.d aria2c defaultsc++
先安裝web服務器git
apt-get install nginx -y cd /var/www/html wget https://github.com/mayswind/AriaNg/releases/download/0.5.0/AriaNg-0.5.0.zip unzip AriaNg-0.5.0.zip rm -rf AriaNg-0.5.0.zip service nginx restart
至此就能夠經過 host:80 訪問 aria2 服務了, 須要配置json-rpc 配置成功後就能夠訪問github