把Orange Pi打造成多功能下载机
安装 aria2
sudo apt install aria2 -y
Reading package lists... 0% Reading package lists... 100% Reading package lists... Done Building dependency tree... 0% Building dependency tree... 0% Building dependency tree... 50% Building dependency tree... 50% Building dependency tree... 66% Building dependency tree... 90% Building dependency tree Reading state information... 0% Reading state information... 0% Reading state information... Done The following packages were automatically installed and are no longer required: libpython-dev libpython2.7-dev python2.7-dev Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: libc-ares2 libssh2-1 The following NEW packages will be installed: aria2 libc-ares2 libssh2-1 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 1,168 kB of archives. After this operation, 4,696 kB of additional disk space will be used. [33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Connecting to ports.ubuntu.com (91.189.88.150)][0m[33m 0% [Connecting to ports.ubuntu.com (91.189.88.150)][0m[33m 0% [Connecting to ports.ubuntu.com (91.189.88.150)][0m[33m 0% [Connecting to ports.ubuntu.com (91.189.88.150)][0m[33m 0% [Waiting for headers][0m[33m 0% [Waiting for headers][0m Get:1 http://ports.ubuntu.com xenial-security/main arm64 libc-ares2 arm64 1.10.0-3ubuntu0.2 [28.7 kB] [33m 0% [1 libc-ares2 1,189 B/28.7 kB 4%][0m[33m 0% [1 libc-ares2 1,189 B/28.7 kB 4%][0m[33m 0% [1 libc-ares2 2,629 B/28.7 kB 9%][0m[33m 0% [1 libc-ares2 2,629 B/28.7 kB 9%][0m[33m 0% [1 libc-ares2 2,629 B/28.7 kB 9%][0m[33m 0% [1 libc-ares2 2,629 B/28.7 kB 9%][0m[33m 0% [1 libc-ares2 2,629 B/28.7 kB 9%][0m[33m 0% [1 libc-ares2 2,629 B/28.7 kB 9%][0m[33m 1% [1 libc-ares2 8,389 B/28.7 kB 29%][0m[33m 1% [1 libc-ares2 8,389 B/28.7 kB 29%][0m[33m 1% [1 libc-ares2 8,389 B/28.7 kB 29%][0m[33m 1% [1 libc-ares2 8,389 B/28.7 kB 29%][0m[33m 1% [1 libc-ares2 12.7 kB/28.7 kB 44%] 2,076 B/s 9min 16s[0m[33m 1% [1 libc-ares2 12.7 kB/28.7 kB 44%] 2,076 B/s 9min 16s[0m[33m 1% [1 libc-ares2 17.0 kB/28.7 kB 59%] 2,076 B/s 9min 14s[0m[33m 1% [1 libc-ares2 17.0 kB/28.7 kB 59%] 2,076 B/s 9min 14s[0m[33m 1% [1 libc-ares2 19.9 kB/28.7 kB 69%] 2,076 B/s 9min 12s[0m[33m 1% [1 libc-ares2 19.9 kB/28.7 kB 69%] 2,076 B/s 9min 12s[0m[33m 1% [1 libc-ares2 19.9 kB/28.7 kB 69%] 2,076 B/s 9min 12s[0m[33m 1% [1 libc-ares2 19.9 kB/28.7 kB 69%] 2,076 B/s 9min 12s[0m[33m 9% [Working] 2,076 B/s 9min 8s[0m[33m 9% [Connecting to ports.ubuntu.com (91.189.88.150)] 2,076 B/s 9min 8s[0m[33m 9% [Waiting for headers] 2,076 B/s 9min 8s[0m Get:2 http://ports.ubuntu.com xenial-security/universe arm64 libssh2-1 arm64 1.5.0-2ubuntu0.1 [58.8 kB] [33m 9% [2 libssh2-1 9,829 B/58.8 kB 17%] 2,076 B/s 9min 3s[0m[33m 12% [2 libssh2-1 44.4 kB/58.8 kB 75%] 2,076 B/s 8min 47s[0m[33m 19% [Working] 2,076 B/s 8min 40s[0m Get:3 http://ports.ubuntu.com xenial/universe arm64 aria2 arm64 1.19.0-1build1 [1,080 kB] [33m 20% [3 aria2 6,206 B/1,080 kB 1%] 2,076 B/s 8min 37s[0m[33m 22% [3 aria2 34.3 kB/1,080 kB 3%] 16.9 kB/s 1min 1s[0m[33m 24% [3 aria2 71.7 kB/1,080 kB 7%] 16.9 kB/s 59s[0m[33m 27% [3 aria2 114 kB/1,080 kB 11%] 16.9 kB/s 57s[0m[33m 30% [3 aria2 161 kB/1,080 kB 15%] 16.9 kB/s 54s[0m[33m 34% [3 aria2 217 kB/1,080 kB 20%] 16.9 kB/s 50s[0m[33m 39% [3 aria2 291 kB/1,080 kB 27%] 16.9 kB/s 46s[0m[33m 46% [3 aria2 387 kB/1,080 kB 36%] 16.9 kB/s 40s[0m[33m 54% [3 aria2 511 kB/1,080 kB 47%] 16.9 kB/s 33s[0m[33m 66% [3 aria2 675 kB/1,080 kB 63%] 16.9 kB/s 23s[0m[33m 80% [3 aria2 887 kB/1,080 kB 82%] 16.9 kB/s 11s[0m[33m 100% [Working] 16.9 kB/s 0s[0m Fetched 1,168 kB in 35s (32.9 kB/s) Selecting previously unselected package libc-ares2:arm64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 43250 files and directories currently installed.) Preparing to unpack .../libc-ares2_1.10.0-3ubuntu0.2_arm64.deb ... Unpacking libc-ares2:arm64 (1.10.0-3ubuntu0.2) ... Selecting previously unselected package libssh2-1:arm64. Preparing to unpack .../libssh2-1_1.5.0-2ubuntu0.1_arm64.deb ... Unpacking libssh2-1:arm64 (1.5.0-2ubuntu0.1) ... Selecting previously unselected package aria2. Preparing to unpack .../aria2_1.19.0-1build1_arm64.deb ... Unpacking aria2 (1.19.0-1build1) ... Processing triggers for libc-bin (2.23-0ubuntu10) ... Processing triggers for man-db (2.7.5-1) ... Setting up libc-ares2:arm64 (1.10.0-3ubuntu0.2) ... Setting up libssh2-1:arm64 (1.5.0-2ubuntu0.1) ... Setting up aria2 (1.19.0-1build1) ... Processing triggers for libc-bin (2.23-0ubuntu10) ...
配置aria2.conf
我们假设下载文件放在 /media/Downloads
目录中
mkdir -p /media/Downloads touch /media/Downloads/aria2.session
新建 /etc/aria2.conf
文件
## '#'开头为注释内容, 选项都有相应的注释说明, 根据需要修改 ## ## 被注释的选项填写的是默认值, 建议在需要修改时再取消注释 ## ## 文件保存相关 ## # 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置 dir=/media/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 ## 进度保存相关 ## # 从会话文件中读取下载任务,得先新建,否则会启动失败 input-file=/media/Downloads/aria2.session # 在Aria2退出时保存`错误/未完成`的下载任务到会话文件,得先新建,否则会启动失败 save-session=/media/Downloads/aria2.session # 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0 #save-session-interval=60 ## 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
这样可以通过 aria2c --conf-path="/etc/aria2.conf"
来让Aria2应用该z配置。
若想让 aria2
以Daemon的方式运行,则可以加上 -D
参数,像这样
sudo aria2c --conf-path="/etc/aria2.conf" -D
你要是嫌指定 --conf-path
参数太麻烦,那么可以创建一个 $HOME/.aria2/aria2.conf
的软链接
mkdir -p ~/.aria2 ln -s /etc/aria2.conf ~/.aria2/aria2.conf
这样就可以省略 --conf-path
参数了
sudo aria2c -D
安装aria2 web前端
安装apache
sudo apt install apache2 -y
Reading package lists... 0% Reading package lists... 100% Reading package lists... Done Building dependency tree... 0% Building dependency tree... 0% Building dependency tree... 50% Building dependency tree... 50% Building dependency tree... 66% Building dependency tree... 91% Building dependency tree Reading state information... 0% Reading state information... 0% Reading state information... Done The following packages were automatically installed and are no longer required: libpython-dev libpython2.7-dev python2.7-dev Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 Suggested packages: www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom ufw The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Need to get 1,341 kB of archives. After this operation, 6,016 kB of additional disk space will be used. [33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Working][0m[33m 0% [Connecting to ports.ubuntu.com][0m Get:1 http://ports.ubuntu.com xenial/main arm64 libapr1 arm64 1.5.2-3 [71.1 kB] [33m 1% [1 libapr1 14.1 kB/71.1 kB 20%][0m[33m 6% [Working][0m Get:2 http://ports.ubuntu.com xenial/main arm64 libaprutil1 arm64 1.5.4-1build1 [67.4 kB] [33m 7% [2 libaprutil1 4,096 B/67.4 kB 6%][0m[33m 13% [Working][0m Get:3 http://ports.ubuntu.com xenial/main arm64 libaprutil1-dbd-sqlite3 arm64 1.5.4-1build1 [9,656 B] [33m 13% [3 libaprutil1-dbd-sqlite3 8,428 B/9,656 B 87%][0m[33m 16% [Working][0m Get:4 http://ports.ubuntu.com xenial/main arm64 libaprutil1-ldap arm64 1.5.4-1build1 [8,358 B] [33m 16% [4 libaprutil1-ldap 4,282 B/8,358 B 51%][0m[33m 18% [Working][0m Get:5 http://ports.ubuntu.com xenial/main arm64 liblua5.1-0 arm64 5.1.5-8ubuntu1 [88.7 kB] [33m 19% [5 liblua5.1-0 14.4 kB/88.7 kB 16%][0m[33m 26% [Working][0m Get:6 http://ports.ubuntu.com xenial-security/main arm64 apache2-bin arm64 2.4.18-2ubuntu3.5 [769 kB] [33m 27% [6 apache2-bin 14.7 kB/769 kB 2%][0m[33m 40% [6 apache2-bin 242 kB/769 kB 31%][0m[33m 52% [6 apache2-bin 440 kB/769 kB 57%][0m[33m 64% [6 apache2-bin 648 kB/769 kB 84%][0m[33m 74% [Working][0m Get:7 http://ports.ubuntu.com xenial-security/main arm64 apache2-utils arm64 2.4.18-2ubuntu3.5 [78.3 kB] [33m 74% [7 apache2-utils 5,585 B/78.3 kB 7%][0m[33m 81% [Working][0m Get:8 http://ports.ubuntu.com xenial-security/main arm64 apache2-data all 2.4.18-2ubuntu3.5 [162 kB] [33m 81% [8 apache2-data 8,192 B/162 kB 5%][0m[33m 93% [Waiting for headers][0m Get:9 http://ports.ubuntu.com xenial-security/main arm64 apache2 arm64 2.4.18-2ubuntu3.5 [86.7 kB] [33m 93% [9 apache2 14.0 kB/86.7 kB 16%][0m[33m 100% [Working] 215 kB/s 0s[0m Fetched 1,341 kB in 24s (55.3 kB/s) Selecting previously unselected package libapr1:arm64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 43324 files and directories currently installed.) Preparing to unpack .../libapr1_1.5.2-3_arm64.deb ... Unpacking libapr1:arm64 (1.5.2-3) ... Selecting previously unselected package libaprutil1:arm64. Preparing to unpack .../libaprutil1_1.5.4-1build1_arm64.deb ... Unpacking libaprutil1:arm64 (1.5.4-1build1) ... Selecting previously unselected package libaprutil1-dbd-sqlite3:arm64. Preparing to unpack .../libaprutil1-dbd-sqlite3_1.5.4-1build1_arm64.deb ... Unpacking libaprutil1-dbd-sqlite3:arm64 (1.5.4-1build1) ... Selecting previously unselected package libaprutil1-ldap:arm64. Preparing to unpack .../libaprutil1-ldap_1.5.4-1build1_arm64.deb ... Unpacking libaprutil1-ldap:arm64 (1.5.4-1build1) ... Selecting previously unselected package liblua5.1-0:arm64. Preparing to unpack .../liblua5.1-0_5.1.5-8ubuntu1_arm64.deb ... Unpacking liblua5.1-0:arm64 (5.1.5-8ubuntu1) ... Selecting previously unselected package apache2-bin. Preparing to unpack .../apache2-bin_2.4.18-2ubuntu3.5_arm64.deb ... Unpacking apache2-bin (2.4.18-2ubuntu3.5) ... Selecting previously unselected package apache2-utils. Preparing to unpack .../apache2-utils_2.4.18-2ubuntu3.5_arm64.deb ... Unpacking apache2-utils (2.4.18-2ubuntu3.5) ... Selecting previously unselected package apache2-data. Preparing to unpack .../apache2-data_2.4.18-2ubuntu3.5_all.deb ... Unpacking apache2-data (2.4.18-2ubuntu3.5) ... Selecting previously unselected package apache2. Preparing to unpack .../apache2_2.4.18-2ubuntu3.5_arm64.deb ... Unpacking apache2 (2.4.18-2ubuntu3.5) ... Processing triggers for libc-bin (2.23-0ubuntu10) ... Processing triggers for man-db (2.7.5-1) ... Processing triggers for systemd (229-4ubuntu21.1) ... Processing triggers for ureadahead (0.100.0-19) ... Setting up libapr1:arm64 (1.5.2-3) ... Setting up libaprutil1:arm64 (1.5.4-1build1) ... Setting up libaprutil1-dbd-sqlite3:arm64 (1.5.4-1build1) ... Setting up libaprutil1-ldap:arm64 (1.5.4-1build1) ... Setting up liblua5.1-0:arm64 (5.1.5-8ubuntu1) ... Setting up apache2-bin (2.4.18-2ubuntu3.5) ... Setting up apache2-utils (2.4.18-2ubuntu3.5) ... Setting up apache2-data (2.4.18-2ubuntu3.5) ... Setting up apache2 (2.4.18-2ubuntu3.5) ... Enabling module mpm_event. Enabling module authz_core. Enabling module authz_host. Enabling module authn_core. Enabling module auth_basic. Enabling module access_compat. Enabling module authn_file. Enabling module authz_user. Enabling module alias. Enabling module dir. Enabling module autoindex. Enabling module env. Enabling module mime. Enabling module negotiation. Enabling module setenvif. Enabling module filter. Enabling module deflate. Enabling module status. Enabling conf charset. Enabling conf localized-error-pages. Enabling conf other-vhosts-access-log. Enabling conf security. Enabling conf serve-cgi-bin. Enabling site 000-default. Processing triggers for libc-bin (2.23-0ubuntu10) ... Processing triggers for systemd (229-4ubuntu21.1) ... Processing triggers for ureadahead (0.100.0-19) ...
安装中文YAAW
git clone https://github.com/aa65535/yaaw-zh-hans /var/www/html/yaaw
使用YAAW
访问 http://orangepipc2/yaaw
, 然后点击右边刷新 旁边 的配置按钮,在 JSON-RPC Path
中填入 http://orangepipc2:6800/jsonrpc.
其中 orangepipc2
是OrangePi的IP地址
配置aria2自启动
新建文件 /etc/systemd/system/aria2.service
,然后输入以下内容
[Unit] Description=Aria2 After=syslog.target After=network.target [Service] Type=simple User=root Group=root WorkingDirectory=/root ExecStart=/usr/bin/aria2c --conf-path="/etc/aria2.conf -D # Restart=always Environment=USER=root HOME=/root [Install] WantedBy=multi-user.target