安装前建议先
apt update
挂载U盘
查看硬盘信息
fdisk -l
![](http://adianshi.com/wp-content/uploads/2020/12/28-1024x943.jpg)
blkid
mkdir /adianshi //新建目录名为‘adianshi’ 可用'ls'查看
mount /dev/sda /adianshi //挂载到adianshi
cd /adianshi //进入挂载的硬盘 'ls'查看内容
设置开机自动挂载硬盘
vi /etc/fstab
添加
/dev/sda /adianshi ext4 defaults 0 0
安装 Samba
apt -y install samba
编辑 /etc/samba/smb.conf,修改为一下内容(注意替换路径及删除注释): PS:配置无需账户、密码。
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = share
security = user
map to guest = bad user
dns proxy = no
[share]
comment = share
path = /adianshi/samba
#共享路径
public = yes
writable = yes
browseable=yes
available=yes
guest ok=yes
给读写权限(与上面路径相同):
chmod 777 /adianshi/samba
启动、开机自启:
systemctl start smbd
systemctl enable smbd
win系统在桌面新建快捷方式输入\\192.168.0.2
安装 aria2
apt -y install aria2
新建文件夹存放配置
mkdir /etc/aria2
新建配置文件
touch /etc/aria2/aria2.session
touch /etc/aria2/aria2.conf
配置aria2,vi /etc/aria2/aria2.conf
#需要修改的基本在这开始
#文件保存路径, 默认为当前启动位置
dir=/data/media
# 在Aria2退出时保存`错误/未完成`的下载任务到会话文件
input-file=/etc/aria2/aria2.session
save-session=/etc/aria2/aria2.session
# RPC监听端口, 端口被占用时可以修改, 默认:6800
rpc-listen-port=6800
# 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项
rpc-secret=123456
#基本需要修改的结束
###
# 断点续传
continue=true
# 最大同时下载任务数, 运行时可修改, 默认:5
max-concurrent-downloads=5
# 单个任务最大线程数, 添加时可指定, 默认:5
split=30
# 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M
min-split-size=10M
# 同一服务器连接数, 添加时可指定, 默认:1
max-connection-per-server=16
# 断开速度过慢的连接
lowest-speed-limit=0
# 整体下载速度限制, 运行时可修改, 默认: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
# 当服务器返回503错误时, aria2会尝试重连
# 尝试重连次数, 0代表无限, 默认:5
max-tries=0
# 重连冷却, 默认:0
#retry-wait=0
###
## 进度保存相关 ##
# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0
save-session-interval=30
# 强制保存会话, 即使任务已经完成, 默认:false
# 较新的版本开启后会在任务完成后依然保留.aria2文件
#force-save=false
###
## RPC相关设置 ##
# 启用RPC, 默认:false
enable-rpc=true
# 允许所有来源, 默认:false
rpc-allow-origin-all=true
# 允许非外部访问, 默认:false
rpc-listen-all=true
# 事件轮询方式, 取值:[epoll, kqueue, port, poll, select], 不同系统默认值不同
#event-poll=kqueue
# 设置的RPC访问用户名, 此选项新版已废弃, 建议改用 --rpc-secret 选项
#rpc-user=
# 设置的RPC访问密码, 此选项新版已废弃, 建议改用 --rpc-secret 选项
#rpc-passwd=
###
## BT/PT下载相关 ##
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true,可选:false|mem
follow-torrent=true
# BT监听端口(TCP), 默认:6881-6999
listen-port=51413
# DHT网络监听端口(UDP), 默认:6881-6999
dht-listen-port=6881-6999
# DHT(IPv4)文件
dht-file-path=/etc/aria2/dht.dat
# DHT(IPv6)文件
dht-file-path6=/etc/aria2/dht6.dat
# 打开DHT功能, PT需要禁用, 默认:true
enable-dht=true
# 打开IPv6 DHT功能, PT需要禁用
# 在没有 IPv6 的环境中不建议开启,否则会导致 DHT 功能异常。
enable-dht6=false
# 本地节点查找, PT需要禁用, 默认:false
bt-enable-lpd=true
# 种子交换, PT需要禁用, 默认:true
enable-peer-exchange=true
# 单个种子最大连接数,0为不限制,默认:55
bt-max-peers=0
# 期望下载速度,Aria2会临时提高连接数以提高下载速度,单位K或M。默认:50K
bt-request-peer-speed-limit=10M
# 全局最大上传速度限制, 运行时可修改, 默认:0
max-overall-upload-limit=5M
# 单个任务上传速度限制, 默认:0
max-upload-limit=0
# 当种子的分享率达到这个数时, 自动停止做种, 0为一直做种, 默认:1.0
seed-ratio=1.0
# 最小做种时间(分钟)。此选项设置为0时,将在BT任务下载完成后不进行做种。
seed-time=0
# 做种前检查文件哈希, 默认:true
bt-hash-check-seed=true
# 继续之前的BT任务时, 无需再次校验, 默认:false
bt-seed-unverified=false
# 保存磁力链接元数据为种子文件(.torrent文件), 默认:false
bt-save-metadata=true
# 加载已保存的元数据文件,默认:false
bt-load-saved-metadata=true
# 删除未选择文件,默认:false
bt-remove-unselected-file=true
# 保存上传的种子,默认:true
rpc-save-upload-metadata=true
# BT强制加密, 默认: false
# 启用后将拒绝旧的 BT 握手协议并仅使用混淆握手及加密,理论上可以防版权投诉与迅雷吸血。
# 此选项相当于后面两个选项(bt-require-crypto=true, bt-min-crypto-level=arc4)的快捷开启方式,但不会修改这两个选项的值。
bt-force-encryption=true
# BT加密需求,默认:false
# 启用后拒绝与旧的 BitTorrent 握手协议(\19BitTorrent protocol)建立连接,始终使用混淆处理握手。
bt-require-crypto=true
# BT最低加密等级,可选:plain(明文),arc4(加密),默认:plain
bt-min-crypto-level=arc4
# 客户端伪装
user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
# PT需要保持 user-agent 和 peer-agent 两个参数一致。即注释上面这行,然后取消注释下面的相关选项。
#user-agent=qBittorrent/4.2.2
peer-agent=qBittorrent/4.2.2
peer-id-prefix=-qB4220-
#----------------------------------
#user-agent=Transmission 2.94
#peer-agent=Transmission 2.94
#peer-id-prefix=-TR2940-
#----------------------------------
#user-agent=Deluge 2.0.3
#peer-agent=Deluge 2.0.3
#peer-id-prefix=-DE2030-
#----------------------------------
#user-agent=μTorrent 3.5.5
#peer-agent=μTorrent 3.5.5
#peer-id-prefix=-UT355W-
#----------------------------------
#user-agent=μTorrent Mac 1.8.7
#peer-agent=μTorrent Mac 1.8.7
#peer-id-prefix=-UM1870-
#bt-tracker 下载不能输在起跑线上
bt-tracker=udp://tracker.coppersurfer.tk:6969/announce,udp://tracker.open-internet.nl:6969/announce,udp://exodus.desync.com:6969/announce,udp://tracker.internetwarriors.net:1337/announce,udp://tracker.opentrackr.org:1337/announce,udp://9.rarbg.to:2710/announce,udp://public.popcorn-tracker.org:6969/announce,udp://tracker.vanitycore.co:6969/announce,udp://tracker.mg64.net:6969/announce,udp://mgtracker.org:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://bt.xxx-tracker.com:2710/announce,udp://thetracker.org:80/announce,udp://open.demonii.si:1337/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.qt.is:6969/announce,udp://tracker.port443.xyz:6969/announce,udp://tracker.ds.is:6969/announce,udp://tracker.cypherpunks.ru:6969/announce,udp://tracker-2.msm8916.com:6969/announce,udp://retracker.lanta-net.ru:2710/announce,udp://open.stealth.si:80/announce,udp://tracker1.itzmx.com:8080/announce,udp://tracker.uw0.xyz:6969/announce,udp://tracker.sandrotracker.biz:6969/announce,udp://tracker.iamhansen.xyz:2000/announce,udp://torr.ws:2710/announce,http://t.nyaatracker.com:80/announce,http://retracker.telecom.by:80/announce,http://open.acgnxtracker.com:80/announce,udp://zephir.monocul.us:6969/announce,udp://tracker4.itzmx.com:2710/announce,udp://tracker.kamigami.org:2710/announce,udp://tracker.cyberia.is:6969/announce,https://evening-badlands-6215.herokuapp.com:443/announce,http://tracker.city9x.com:2710/announce,http://retracker.mgts.by:80/announce,http://open.acgtracker.com:1096/announce,http://nbz.f3322.net:36006/announce,http://0d.kebhana.mx:443/announce,wss://tracker.openwebtorrent.com:443/announce,wss://tracker.iamhansen.xyz:443/announce,wss://tracker.fastcast.nz:443/announce,wss://tracker.btorrent.xyz:443/announce,ws://tracker.btsync.cf:2710/announce,udp://z.crazyhd.com:2710/announce,udp://wambo.club:1337/announce,udp://trackerxyz.tk:1337/announce,udp://tracker1.wasabii.com.tw:6969/announce,udp://tracker.xku.tv:6969/announce,udp://tracker.tvunderground.org.ru:3218/announce,udp://tracker.swateam.org.uk:2710/announce,udp://tracker.skyts.net:6969/announce,udp://tracker.piratepublic.com:1337/announce,udp://tracker.justseed.it:1337/announce,udp://tracker.halfchub.club:6969/announce,udp://tracker.files.fm:6969/announce,udp://tracker.dutchtracking.com:6969/announce,udp://tracker.dler.org:6969/announce,udp://tracker.desu.sh:6969/announce,udp://tracker.bluefrog.pw:2710/announce,udp://t.agx.co:61655/announce,udp://sd-95.allfon.net:2710/announce,udp://santost12.xyz:6969/announce,udp://retracker.nts.su:2710/announce,udp://retracker.coltel.ru:2710/announce,udp://pubt.in:2710/announce,udp://peerfect.org:6969/announce,udp://packages.crunchbangplusplus.org:6969/announce,udp://p4p.arenabg.com:1337/announce,udp://oscar.reyesleon.xyz:6969/announce,udp://open.facedatabg.net:6969/announce,udp://ipv4.tracker.harry.lu:80/announce,udp://inferno.demonoid.pw:3418/announce,udp://explodie.org:6969/announce,https://tracker.torrentsnows.com:443/announce,http://tracker1.itzmx.com:8080/announce,http://tracker.vanitycore.co:6969/announce,http://tracker.torrentyorg.pl:80/announce,http://tracker.tfile.me:80/announce,http://tracker.mg64.net:6881/announce,http://tracker.internetwarriors.net:1337/announce,http://tracker.electro-torrent.pl:80/announce,http://therightsize.net:1337/announce,http://share.camoe.cn:8080/announce,http://retracker.spb.ru:80/announce,http://omg.wtftrackr.pw:1337/announce,http://mgtracker.org:6969/announce,http://agusiq-torrents.pl:6969/announce
###
## 磁盘相关 ##
#另一种Linux文件缓存方式, 使用前确保您使用的内核支持此选项, 需要1.15及以上版本(?)
enable-mmap=true
# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc
# 预分配所需时间: 快none < trunc < falloc < prealloc慢
#file-allocation=trunc
# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M
disk-cache=64M
获取dht.dat文件(如果没有BT种子文件下载需求,可不下载.)
wget -P /etc/aria2 https://github.com/ToyoDAdoubi/doubi/blob/master/other/Aria2/dht.dat
配置自动更新tracker.sh
vi /etc/aria2/tracker.sh
#!/bin/bash
#=================================================
# https://github.com/P3TERX/aria2.conf
# File name:tracker.sh
# Description: Get trackers and add to aria2.conf
# Lisence: MIT
# Version: 1.4
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================
###
INFO="[\033[32mINFO\033[0m]"
ERROR="[\033[31mERROR\033[0m]"
ARIA2_CONF=${1:-aria2.conf}
###
echo && echo -e "$INFO Check downloader ..."
if [ $(command -v curl) ]; then
DOWNLOADER='curl -fsSL'
elif [ $(command -v wget) ]; then
DOWNLOADER='wget -qO-'
else
echo -e "$ERROR curl or wget is not installed."
fi
###
# BT tracker is provided by the following project.
# https://github.com/XIU2/TrackersListCollection
# https://github.com/ngosang/trackerslist
# Fallback URLs provided by jsDelivr and Cloudflare Workers
# https://www.jsdelivr.com
# https://workers.cloudflare.com/
echo && echo -e "$INFO Get trackers ..."
TRACKER=$(
${DOWNLOADER} https://trackerslist.com/all_aria2.txt ||
${DOWNLOADER} https://cdn.jsdelivr.net/gh/XIU2/TrackersListCollection/all_aria2.txt ||
${DOWNLOADER} https://trackerslist.p3terx.workers.dev/all_aria2.txt ||
{
${DOWNLOADER} https://ngosang.github.io/trackerslist/trackers_all.txt ||
${DOWNLOADER} https://cdn.jsdelivr.net/gh/ngosang/trackerslist/trackers_all.txt ||
${DOWNLOADER} https://ngosang-trackerslist.p3terx.workers.dev/trackers_all.txt
} | awk NF | sed ":a;N;s/\n/,/g;ta"
)
###
[ -z $TRACKER ] && echo -e "
$ERROR Unable to get trackers, network failure or invalid links." && exit 1
echo -e "
--------------------[TRACKERS]--------------------
${TRACKER}
--------------------[TRACKERS]--------------------
"
[ ${ARIA2_CONF} == "cat" ] && exit 0
###
echo -e "$INFO Adding trackers to '${ARIA2_CONF}' ..." && echo
if [ ! -f ${ARIA2_CONF} ]; then
echo -e "$ERROR '${ARIA2_CONF}' does not exist."
exit 1
else
[ -z $(grep "bt-tracker=" ${ARIA2_CONF}) ] && echo "bt-tracker=" >>${ARIA2_CONF}
sed -i "s@^\(bt-tracker=\).*@\1${TRACKER}@" ${ARIA2_CONF} && echo -e "$INFO Trackers added successfully!"
fi
###
执行更新
chmod +x tracker.sh
./tracker.sh "/etc/aria2/aria2.conf"
配置systemctl启动 ,新建
vim /lib/systemd/system/aria2.service
[Unit]
Description=aria2 project
After=network.service
[Service]
Type=simple
User=root
Group=root
KillMode=control-group
PIDFile=/etc/aria2/aria.pid
ExecStart=/usr/bin/aria2c --conf-path=/etc/aria2/aria2.conf
ExecReload=
ExecStop=
PrivateTmp=true
[Install]
WantedBy=multi-user.target
启动、开机自启命令:
systemctl enable aria2.service
systemctl start aria2.service
用宝塔来新建一个网站,然后把下载好的解压,里面两个文件拷贝到新建网站根目录
打开网站
AriaNg设置->输入RPC密钥,就是配置里rpc-secret
随便找部电影下载,
![](http://adianshi.com/wp-content/uploads/2020/12/33-1024x501.jpg)
在共享盘观察是否可用
![](http://adianshi.com/wp-content/uploads/2020/12/32.jpg)
家里的宽带是电信,有公网IP,然后进路由器添加端口转发,
![](http://adianshi.com/wp-content/uploads/2020/12/31.jpg)
就可用用自己域名访问了
![](http://adianshi.com/wp-content/uploads/2020/12/34-1024x498.jpg)
修改端口6800改到6801
修改下载地址为可道云的一个子目录,就是游客访问的目录
添加端口转发
84端口为ariang
6801端口为rpc
86端口为kod
![](http://adianshi.com/wp-content/uploads/2020/12/36-1024x507.jpg)
下载个电影
![](http://adianshi.com/wp-content/uploads/2020/12/37-1024x518.jpg)