sylar^z 发表于 2020-9-6 23:50

【树莓派4B测评】+ ARIA2远程下载服务器搭建

<div class='showpostmsg'> 本帖最后由 sylar^z 于 2020-9-6 23:57 编辑

<p>Aria2 是一个多平台轻量级,支持 HTTP、FTP、BitTorrent 等多协议、多来源的命令行下载工具,性能相当不错,速度不比迅雷慢。</p>

<p>&nbsp;</p>

<p>但Aria2 本身既没有Ui界面,也没有远程控制。所以需要nginx和ariang两个软件来配合使用。Nginx 是一个非常轻量级的HTTP服务器,非常适合放在树莓派上作为 Aria2 的 Web 管理。ariang是专为aria2打造的一个WEBUI,非常好用。</p>

<p>&nbsp;</p>

<p>安装Aria2指令</p>

<p>sudo apt-get install aria2</p>

<p>选择Y后自动安装完毕</p>

<p>&nbsp;</p>

<p>创建aria2目录用于保存aria2的配置文件</p>

<p>sudo mkdir /etc/aria2</p>

<p>两个相关文件为aria2.conf,aria2.session</p>

<p>创建aria2.session。这是aria2的会话记录保存文件,用于保存信息。直接保存退出即可。</p>

<p>创建aria2.conf。这个是aria2的配置文件,添加以下内容:</p>

<pre>
<code>#文件保存目录
dir=/mnt/usb-ntfs
disk-cache=32M
continue=true
#NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项
file-allocation=falloc

#下载连接相关
max-concurrent-downloads=10
max-connection-per-server=15
split=10

#进度保存相关
input-file=/etc/aria2/aria2.session
save-session=/etc/aria2/aria2.session
save-session-interval=60

#RPC相关设置
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true

#BT/PT下载相关
peer-id-prefix=-TR2770-
user-agent=Transmission/2.77
bt-seed-unverified=true
bt-save-metadata=true</code></pre>

<p>&nbsp;</p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">使用</font></span></span><span style="font-size:10.5000pt"><span style="font-family:Calibri">sudo aria2c --conf-path=/etc/aria2/aria2.con</span></span><span style="font-size:10.5000pt"><span style="font-family:宋体">f<font face="宋体">启动</font><font face="Calibri">aria2</font><font face="宋体">服务,显示正在监听,则启动成功。</font></span></span></span></span></p>

<p style="text-align:justify"></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">按</font>ctrl+c<font face="宋体">退出。</font></span></span></span></span></p>

<p style="text-align:justify">&nbsp;</p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">让</font></span></span><span style="font-size:10.5000pt"><span style="font-family:Calibri">aria2</span></span><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">随系统启动</font></span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">创建</font>aria2c<font face="宋体">的服务文件,</font><font face="Calibri">sudo nano /etc/init.d/aria2c</font><font face="宋体">,添加内容:</font></span></span></span></span></p>

<pre>
<code>
### BEGIN INIT INFO
# Provides: aria2c
# Required-Start:    $network $local_fs $remote_fs
# Required-Stop:   $network $local_fs $remote_fs
# Default-Start:   2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: aria2c RPC init script.
# Description: Starts and stops aria2 RPC services.
### END INIT INFO

USER=root
RETVAL=0

case "$1" in
    start)
      echo "Starting service Aria2..."
      aria2c --conf-path=/etc/aria2/aria2.conf -D
      echo "Start service done."
    ;;
    stop)
      echo "Stoping service Aria2..."
      killall aria2c
      echo "Stop service done."
    ;;
esac

exit $RETVAL</code></pre>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">按</font>ctrl+o<font face="宋体">和</font><font face="Calibri">ctrl+x</font><font face="宋体">保存退出。</font></span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">设置文件读写权限</font>sudo chmod 755 /etc/init.d/aria2c<font face="宋体">,保持权限和目录下其他文件权限一致。</font></span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">使用指令</font>sudo update-rc.d aria2c defaults<font face="宋体">设置开机启动。</font></span></span></span></span></p>

<p style="text-align:justify">&nbsp;</p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">安装标准版</font></span></span><span style="font-size:10.5000pt"><span style="font-family:Calibri">Nginx</span></span><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">,</font></span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:Calibri">sudo apt-get install nginx-full</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">选择</font>Y<font face="宋体">等待安装完成。</font></span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">使用指令</font>sudo update-rc.d </span></span><span style="font-size:10.5000pt"><span style="font-family:Calibri">nginx</span></span><span style="font-size:10.5000pt"><span style="font-family:宋体">&nbsp;defaults<font face="宋体">设置开机启动</font></span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">在</font>PC<font face="宋体">上的浏览器中输入你的树莓派</font><font face="Calibri">IP</font><font face="宋体">,显示如下图片则</font><font face="Calibri">nginx</font><font face="宋体">安装成功</font></span></span></span></span></p>

<p style="text-align:justify"></p>

<p style="text-align:justify">&nbsp;</p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">下载最新版</font></span></span><span style="font-size:10.5000pt"><span style="font-family:Calibri">AriaNg</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">把目录切到</font>tmp<font face="宋体">下:</font><font face="Calibri">cd /tmp</font></span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:Calibri">wget https://github.com/mayswind/AriaNg/releases/download/1.1.</span></span><span style="font-size:10.5000pt"><span style="font-family:宋体">7</span></span><span style="font-size:10.5000pt"><span style="font-family:Calibri">/AriaNg-1.1.</span></span><span style="font-size:10.5000pt"><span style="font-family:宋体">7</span></span><span style="font-size:10.5000pt"><span style="font-family:Calibri">.zip</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">解压缩文件到</font>/var/www/html<font face="宋体">中</font></span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:Calibri">sudo unzip AriaNg-1.1.7.zip -d /var/www/html/</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">完成后,在</font></span></span><span style="font-size:10.5000pt"><span style="font-family:宋体">PC<font face="宋体">上的</font></span></span><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">浏览器使用树莓派</font>IP<font face="宋体">连接树莓派,就可以显示</font><font face="Calibri">Aria2</font><font face="宋体">的管理页面了。点击新建即可开始创建下载了,操作起来很方便。</font></span></span></span></span></p>

<p style="text-align:justify"></p>

<p style="text-align:justify">&nbsp;</p>

<p style="text-align:justify">&nbsp;</p>

<p style="text-align:justify">&nbsp;</p>

<p style="text-align:justify">&nbsp;</p>
</div><script>                                        var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;"   style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
                                       
                                        if(parseInt(discuz_uid)==0){
                                                                                                (function($){
                                                        var postHeight = getTextHeight(400);
                                                        $(".showpostmsg").html($(".showpostmsg").html());
                                                        $(".showpostmsg").after(loginstr);
                                                        $(".showpostmsg").css({height:postHeight,overflow:"hidden"});
                                                })(jQuery);
                                        }                </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script>

freebsder 发表于 2020-9-7 19:59

<p>下学习视频应该很有优势。</p>

sylar^z 发表于 2020-9-8 10:16

freebsder 发表于 2020-9-7 19:59
下学习视频应该很有优势。

<p>下学习视频可以有,只要下载源不限速,速度杠杠的</p>

败絮呢 发表于 2020-9-9 10:06

<p>值得学习</p>
页: [1]
查看完整版本: 【树莓派4B测评】+ ARIA2远程下载服务器搭建