使用树莓派搭建下载机

我自己已经用树莓派几年了,从 3B+ 版本到 4B 版本,这样一个低功耗的 Linux 发行版非常适用于做下载机,来满足 PT、BT 等一些长时间挂机下载/做种的需求。它还可以搭配 SMB 分享、FTP 内网穿透实现个人 NAS 的一些功能。接下来我将介绍自己使用 Transmission 工具搭建的树莓派下载机。
Transmission 安装
Transmission 是一款流行的 BT 下载软件,比其他客户端使用更少的资源,守护程序非常适合服务器,并且可以通过桌面 GUI、Web 界面和终端程序进行远程控制,支持本地对等发现、完全加密、DHT、µTP、PEX 和 Magnet Link 等。
首先,通过 apt
安装软件包,这里注意安装的是 transmisson-daemon
:
sudo apt-get update
sudo apt-get install transmisson-daemon
然后在 /etc/transmission-daemon/
目录下修改配置文件 settings.json
。修改设置前需要先关闭 transmission
服务:
sudo systemctl stop transmission-daemon.service
cd /etc/transmission-daemon/
sudo nano settings.json
settings.json
文件内容如下,#
后为我补充的需要修改字段的注释:
{
"alt-speed-down": 50,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 50,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 4,
"dht-enabled": true,
"download-dir": "/home/pi/complete", # 下载目录
"download-limit": 100,
"download-limit-enabled": 0,
"download-queue-enabled": true,
"download-queue-size": 30,
"encryption": 1,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/home/pi/incomplete", # 下载未完成文件目录
"incomplete-dir-enabled": true,
"lpd-enabled": false,
"max-peers-global": 200,
"message-level": 1,
"peer-congestion-algorithm": "",
"peer-id-ttl-hours": 6,
"peer-limit-global": 1000,
"peer-limit-per-torrent": 50,
"peer-port": 51413,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": "default",
"pex-enabled": true,
"port-forwarding-enabled": false,
"preallocation": 1,
"prefetch-enabled": true,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 30,
"ratio-limit": 2,
"ratio-limit-enabled": false,
"rename-partial-files": true,
"rpc-authentication-required": true,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-host-whitelist": "",
"rpc-host-whitelist-enabled": true,
"rpc-password": "{525a44ba546f85ef59189a202b8d45357d17589686ReudqW", # 将双引号内修改为你要设定的密码,输入密码明文,重新启动程序后会自动加密,再打开看到的就是这样的密文了。
"rpc-port": 9091, # 默认 Web 访问端口
"rpc-url": "/transmission/",
"rpc-username": "raspberrypi", # 将双引号内修改为你要设定的用户名
"rpc-whitelist": "*.*.*.*",
"rpc-whitelist-enabled": true,
"scrape-paused-torrents-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",
"seed-queue-enabled": false,
"seed-queue-size": 10,
"speed-limit-down": 2048,
"speed-limit-down-enabled": false,
"speed-limit-up": 5,
"speed-limit-up-enabled": true,
"start-added-torrents": true,
"trash-original-torrent-files": false,
"umask": 18,
"upload-limit": 100,
"upload-limit-enabled": 0,
"upload-slots-per-torrent": 14,
"utp-enabled": true # 允许 Web 登录
}
settings.json
修改完成后,保存配置文件,重启 transmission
服务:
sudo systemctl start transmission-daemon.service
这样在浏览器中登录树莓派 ip:9091
就可以访问 Transmission Web 管理界面了。
如果下载中遇到写入权限问题,需要将目录设置为权限开放:
sudo chmod -R a+rw /home/pi/complete
在树莓派上挂载移动硬盘
树莓派的存储设备为 SD 卡,存储容量不会很大,不适合做 BT 的存储器,最好还是外接移动硬盘。
这里要注意的是由于树莓派供电的问题。树莓派 3B 供电不能直接外接移动硬盘,需要一个可接电源的 USB HUB 对移动硬盘单独供电。树莓派 4B 可以直接外接固态硬盘。
可以先在要挂载的目录下新建一个文件夹,然后将移动硬盘挂载即可。为了能够在树莓派重启的时候自动完成挂载操作,可以将挂载设置为系统服务。
下面是我设置的移动硬盘挂载服务,请参考 home-pi-M_disk.mount
:
[Unit]
Description=Auto mount USB disk
DefaultDependencies=no
ConditionPathExists=/home/pi/M_disk
Before=sysinit.target
[Mount]
What=/dev/sda1
Where=/home/pi/M_disk
Type=ntfs
[Install]
WantedBy=multi-user.target
上述挂载服务会在树莓派启动后自动将移动硬盘 /dev/sda1
(设备名称可以将移动硬盘插入树莓派后通过 sudo fdisk -l
查看),挂载到 /home/pi/M_disk
(此目录为新建的挂载目录)目录下。
结语
这样就完成了树莓派下载机的搭建,搭配之前介绍的 SMB 分享、 FTP 内网穿透,还是能够满足个人 NAS 的一些简单需求。 Enjoy!
本文转载来自 Linux 中国: https://github.com/Linux-CN/archive
nordvpn promotion 350fairfax
Hey there! I know this is kinda off topic but I was wondering if you knew where I could find a captcha
plugin for my comment form? I’m using the same blog platform as yours and I’m having problems finding one?
Thanks a lot!
Howdy, i read your blog occasionally and i own a similar one and
i was just wondering if you get a lot of spam feedback?
If so how do you prevent it, any plugin or anything you can recommend?
I get so much lately it’s driving me crazy so any assistance is very
much appreciated.
Visit my site :: nordvpn coupons inspiresensation
I’m now not certain where you’re getting your
information, but great topic. I needs to spend some time finding out much more or working
out more. Thanks for excellent info I was in search of this info for my mission.
Feel free to visit my homepage: nordvpn coupons inspiresensation (tinyurl.com)
I think this is among the so much vital information for me.
And i’m glad reading your article. However want to remark on few normal issues, The website taste is
ideal, the articles is in reality excellent : D.
Just right process, cheers
Here is my web site – nordvpn coupons inspiresensation
Wow that was unusual. I just wrote an extremely long
comment but after I clicked submit my comment didn’t appear.
Grrrr… well I’m not writing all that over again.
Anyhow, just wanted to say fantastic blog!
my page nordvpn coupons inspiresensation