前言:树莓派不知道怎么的,很多服务都出问题了,虽然好像还能正常用,不过问题太大了,之前把树莓派当作主力机来使用的,装了太多冗余的东西了,直接重装。打算直接做nas了
设备:PI 4 8GB
系统:Debian 11 bullseye
前期准备
pt相关
把deluge的种子全部转移铺种到tr上
备份tr
备份transmission-daemon:
数据目录位于(apt安装的):
1 | /var/lib/transmission-daemon/.config |
复制一份
种子迁移:跳过校验
下载相关
备份aria2
备份aria2配置文件,以及service
我的配置文件位于用户目下的.aria2:/home/pi/.aria2
/etc/systemd/system/aria2.service
复制一份
局域网共享相关
smb备份
备份配置文件
配置文件位于:
1 | /etc/samba |
复制一份
脚本
python脚本备份
bash脚本备份
其余
crontab
latex
重装
镜像下载和系统启动:
2021-10-30-raspios-bullseye-arm64-lite
才注意到Debian版本换成了bullseye,升级换代了。
使用rpi-imager
写入sd卡
然后写入错误。。。错误:数据错误(循环冗余检查)
这张卡用了很久了,一扫描果然出了坏道。唉,先屏蔽了凑合着用。。。新的sd卡还要几天才能到。。。
屏蔽完了,测试了一下
1 | *** 开始测试第 1 圈,共 1 圈 *** |
根本不能往里面写数据。。。
含泪使用switch的128g的内存卡,先备份一波switch。TT
写入成功后,为开启ssh功能
在sd卡的/boot上创建空白文件SSH
树莓派在局域网上的域名为:raspberrypi
终端SSH访问:
1 | ssh pi@raspberrypi |
出现提示:
1 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
用个文本编辑器把用户目录下的.ssh/known_hosts
的文件改了,我用的vscode
1 | code .\.ssh\known_hosts |
树莓派我之前绑定了ip:192.168.1.6,在known_hosts把有关于树莓派的都删了。
1 | ssh pi@raspberrypi |
默认密码是:raspberry
进入后第一件事就是改密码
1 | sudo raspi-config |
选择System Options->Password
然后改时区,Locaisation Options->Timezone->Asia->Shanghai
挂载备份盘
1 | sudo df -h |
先挂载磁盘分区/dev/sdb1
1 | sudo mount /dev/sdb1 DiskShare/ |
换源
树莓派上版本了,所以原来备份的buster版本的就不能用了。。
换成清华源
Debian 镜像使用帮助
Debian 的软件源配置文件是 /etc/apt/sources.list
。将系统自带的该文件做个备份,将该文件替换为下面内容,即可使用 TUNA 的软件源镜像。
如果遇到无法拉取 https 源的情况,请先使用 http 源并安装:
1 | sudo apt install apt-transport-https ca-certificates |
再使用 TUNA 的软件源镜像。
备份一下source.list再改
1 | cp /etc/apt/sources.list ./ |
更新一下:
1 | sudo apt update && sudo apt upgrade |
安装v2rayA
先装v2ray
v2rayA 提供的镜像脚本(推荐):
1 | curl -Ls https://mirrors.v2raya.org/go.sh | sudo bash |
感觉有点满。。
安装后可以关掉服务,因为 v2rayA 不依赖于该 systemd 服务。
1 | sudo systemctl disable v2ray --now ### Xray 需要替换服务为 xray |
通过软件源安装v2rayA
添加公钥
1 | wget -qO - https://apt.v2raya.mzz.pub/key/public-key.asc | sudo apt-key add - |
添加 V2RayA 软件源
1 | echo "deb https://apt.v2raya.mzz.pub/ v2raya main" | sudo tee /etc/apt/sources.list.d/v2raya.list |
安装 V2RayA
1 | sudo apt install v2raya |
启动 v2rayA / 设置 v2rayA 自动启动
启动:
1 | sudo systemctl start v2raya.service |
设置开机自动启动:
1 | sudo systemctl enable v2raya.service |
设置v2rayA
对于 Debian11 用户来说,iptables 已被弃用。使用 nftables 作为 iptables 的后端以进行适配:
1 | update-alternatives --set iptables /usr/sbin/iptables-nft |
如果你想切换回 legacy 版本:
1 | update-alternatives --set iptables /usr/sbin/iptables-legacy |
切换后重启即可。
设置一下暂时代理:
1 | export http_proxy=http://127.0.0.1:20172 |
安装smb
1 | sudo apt install samba |
还原配置
1 | sudo cp DiskShare/smb.conf /etc/samba/ |
添加用户
1 | sudo smbpasswd -a pi |
1 | sudo systemctl reload smbd.service |
编译安装transmission
目前不建议软件源安装
1 | sudo apt install transmission-daemon |
先检查一下版本。。。(我备份的是2.94)
1 | transmission-daemon -V |
。。。居然变成了3.00,还好升级兼容数据。。。但还是不建议使用3.0 (目前而言,很多pt站会把3.0当成被ban的客户端。。。u2甚至出现了:错误信息: No UA presents! (2)。)
下载源码
1 | wget https://raw.githubusercontent.com/transmission/transmission-releases/master/transmission-2.94.tar.xz |
下载依赖libevent-2.1-6 (>= 2.1.8-stable) ,dep: zlib1g (>= 1:1.1.4)
1 | wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz |
编译安装
安装libevent
1
2
3
4
5
6tar zxf libevent-2.1.8-stable.tar.gz
cd ./libevent-2.1.8-stable
sudo ./configure
sudo make
sudo make install
cd ..安装zlib
1
2
3
4
5
6tar zxf zlib-1.2.11.tar.gz
cd ./zlib-1.2.11
sudo ./configure
sudo make
sudo make install
cd ..安装transmission 2.94
1
2
3tar xvf transmission-2.94.tar.xz
cd transmission-2.94
sudo ./configure分割线下都是报错!谨慎按照分割线下的方法操作。(因为啥也不懂,直接乱来)
结果报错
No package ‘libcurl’ found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.Alternatively, you may set the environment variables LIBCURL_CFLAGS
and LIBCURL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.找不到
libcurl
。阿哲,明明有装curl
,先看一下在不在。1
2
3ldconfig -p | grep libcurl
libcurl.so.4 (libc6,AArch64) => /lib/aarch64-linux-gnu/libcurl.so.4
libcurl-gnutls.so.4 (libc6,AArch64) => /lib/aarch64-linux-gnu/libcurl-gnutls.so.4再检查一下
curl
1
2
3
4
5curl -confg --version
curl 7.74.0 (aarch64-unknown-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
Release-Date: 2020-12-09
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets我。。。。现在还不会配置
./configure
,再装一个curl
吧先退出
transmission 2.94
安装目录1
cd ..
编译安装
curl
1
2
3
4
5
6
7
8wget https://github.com/curl/curl/releases/download/curl-7_76_1/curl-7.76.1.tar.gz
tar zxf curl-7.76.1.tar.gz
cd curl-7.76.1/
sudo ./configure
sudo make
sudo make install
cd ..
rm curl-7.76.1.tar.gz继续编译安装
transmission 2.94
!1
2cd transmission-2.94
sudo ./configure结果又报错
checking for OPENSSL… no
checking for WOLFSSL… no
checking for CYASSL… no
checking for MBEDTLS… no
checking polarssl/version.h usability… no
checking polarssl/version.h presence… no
checking for polarssl/version.h… no
configure: error: Unable to find any supported crypto library.(这步不要尝试,下面的才是解决方法)我。。。。。再编译安装
openssl
1
2
3
4
5
6
7
8
9cd ..
wget https://www.openssl.org/source/openssl-1.1.1l.tar.gz
tar xf openssl-1.1.1l.tar.gz
cd openssl-1.1.1l
sudo ./configure
sudo make
sudo make install
cd ..
rm openssl-1.1.1l.tar.gz结果一看还是这个错误。。。查了一下资料。。
The OpenSSL library is usually already installed, but you have to install the header files. Depending on your Linux distribution, you’ll need these packages:
- Red Hat, Fedora, CentOS -
openssl-devel
- Debian, Ubuntu -
libssl-dev
- Arch -
openssl
1
sudo apt install libssl-dev
人裂开。。
继续安装
transmission
报错./configure: line 20079: intltool-update: command not found
checking for intltool >= 0.35.0… found
configure: error: Your intltool is too old. You need intltool 0.35.0 or later.1
sudo apt install intltool
继续装transmission去
执行
sudo ./configure
后出现Configuration:
Source code location: .
Compiler: g++Build libtransmission: yes
* optimized for low-resource systems: no * µTP enabled: yes * crypto library: openssl
Build Command-Line client: no
Build GTK+ client: no
* libappindicator for an Ubuntu-style tray: no
Build Daemon: yes
Build Mac client: no
可以继续了
1
2
3
4sudo make
sudo make install
cd ..
transmission-daemon -V- Red Hat, Fedora, CentOS -
配置transmission服务
配置进程守护脚本
1
sudo nano /etc/systemd/system/transmission-daemon.service
写入
1
2
3
4
5
6
7
8
9
10
11
12[Unit]
Description=Transmission BitTorrent Daemon
After=network.target
[Service]
User=root
Type=notify
ExecStart=/usr/bin/transmission-daemon -f --log-error
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target配置 setting文件
执行
sudo systemctl start transmission
后,会在/usr/local/share/transmission
生成一个settings.json的配置文件先停止服务
1
2sudo systemctl stop transmission.service
sudo nano /usr/local/share/transmission/settings.json还原数据
1
sudo cp -r DiskShare/.config/transmission-daemon/* /usr/local/share/transmission
3.0降级为2.94,要手动跳检,以后写。手动跳过校验后还要注意修改曾经改过目录名的种子
我是备份的
apt
安装的数据,所以还要还原设置1
sudo cp DiskShare/transmission-daemon/setting.json /usr/local/share/transmission
重新启动
1
2
3sudo systemctl restart transmission
ps -aux | grep transmission
sudo /bin/kill -s HUP 889 # reload访问(如果你没有做特殊设置的话):http://raspberrypi:9091/
美化,安装transmission-web-control:
1 | wget https://github.com/ronggang/transmission-web-control/raw/master/release/install-tr-control-cn.sh |
安装Aria2
1 | sudo apt install aria2 |
还原配置
1 | mv DiskShare/aria2.service /etc/systemd/ |
确认配置
1 | cat .aria2/aria2.conf |
启动
1 | sudo systemctl start aria2.service |
查看是否成功
1 | sudo systemctl status aria2.service |
设置开机启动
1 | sudo systemctl enable aria2.service |
安装proxychains
为了更好的配置代理
1 | git clone https://github.com/rofl0r/proxychains-ng.git |
拉到最后一行
改成:
1 | socks5 127.0.0.1 20170 |
v2rayA是这么配置的。
安装Flexget
先更新一下pip3的源
1 | pip3 install pip -U |
安装
1 | pip3 install flexget |
备份还原
1 | mv DiskShare/.flexget/ ./ |
测试
1 | pip3 install transmission-rpc #我配置文件写的是transmission |
问题
1 | WARNING: The script calc-prorate is installed in '/home/pi/.local/bin' which is not on PATH. |
环境变量没设置
解决:
flexget的启动路径是在/home/pi/.local/bin
,把它加到环境变量里面
1 | echo 'export PATH=/home/pi/.local/bin:$PATH' >>~/.bashrc |
配置Flexget
在当前用户目录下创建
1 | mkdir .flexget |
写入以下内容
1 | tasks: |
测试是否正常
1 | flexget --test -c /home/pi/.flexget/config.yml execute |
写入crontab
1 | crontab -e |
每周一,0-8点,每两小时执行一次
1 | 0 0-8/2 * * 1 /home/pi/.local/bin/flexget -c /home/pi/.flexget/config.yml --cron execute |
更多详见
https://wiki.ukenn.top/seedbox-wiki-1/untitled-1
其他
fstab开机挂载磁盘
先查看磁盘
1 | sudo fdisk -l |
找到对应Device
1 | sudo nano /etc/fstab |
crontab任务