入站半年感觉慢慢攒上传还是太累了,于是最终还是摸了个盒子。因为是简单摸一下,我就不用一键脚本了。为了装起来方便,系统选的直接就是 ArchLinux
。
这篇文章源起于几个月前,现在已经开始吃灰了,所以赶在不续费之前摸完这篇(
![安 装](https://static.mmf.moe/wp/2021/03/image.png)
设置系统语言
https://wiki.archlinux.org/index.php/Locale_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
首先是修改 /etc/locale.gen
,将 zh_CN.UTF-8 UTF-8
前面的注释去掉,然后生成 locale
:
1sudo locale-gen
最后设置系统 locale
:
1sudo localectl set-locale LANG=zh_CN.UTF-8
下一次 ssh
登录就可以正常显示中文了。
调整分区保留大小
1# 调整为 1%2sudo tune2fs -m 1 /dev/sda3
调整系统时间
1sudo timedatectl set-timezone Asia/Shanghai
延长 sshd
超时
https://www.simplified.guide/ssh/disable-timeout
修改 /etc/ssh/sshd_config
:
1TCPKeepAlive no2ClientAliveInterval 303ClientAliveCountMax 240
开启 bbr
https://bbs.archlinux.org/viewtopic.php?id=223879
1# Load the BBR kernel module.2echo "tcp_bbr" > /etc/modules-load.d/modules.conf3
4# Set the default congestion algorithm to BBR.5echo "net.core.default_qdisc=fq" > /etc/sysctl.d/bbr.conf6echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.d/bbr.conf
Nginx
1# 安装 nginx2# 不使用 mainline 是为了升级模块方便3sudo pacman -S nginx4
5# 站点目录6sudo mkdir /etc/nginx/conf.d
然后创建第一个网站:
1server {2 listen 443 ssl http2;3
4 server_name torrent.mmf.moe;5 ssl_certificate ssl/mmf.moe.pem;6 ssl_certificate_key ssl/mmf.moe.key;7
8 root /usr/share/nginx/html;9 include site-torrent/*;10}
这里我们使用的证书是 Cloudflare
的源证书,相当于只有 Cloudflare
自签的证书,仅在 Cloudflare
到服务器可用,一次可以签 15
年。
qBittorrent
1sudo pacman -S qbittorrent-nox
然后写入网站配置:
1location /qbt/ {2 proxy_pass http://127.0.0.1:18080/;3 proxy_http_version 1.1;4 proxy_set_header X-Forwarded-Host \$server_name:\$server_port;5
6 http2_push_preload on;7
8 proxy_hide_header Referer;9 proxy_hide_header Origin;10 proxy_set_header Referer '';11 proxy_set_header Origin '';12
13 add_header X-Frame-Options "SAMEORIGIN";14}
最后启动,注意 @
后面的是你的用户名:
1sudo systemctl start qbittorrent-nox@mmfmoe2sudo systemctl enable qbittorrent-nox@mmfmoe
FlexGet
FlexGet
的用途主要是配合脚本,只下载 Free
的种子。首先是安装:
1# 安装 Python 32sudo pacman -S python3
4# 初始化 venv5python -m venv ~/flexget/6
7# 安装 FlexGet8cd ~/flexget/9bin/pip install flexget10
11# 创建插件目录12mkdir -p ~/.flexget/plugins13
14# 下载 NexusPHP 插件15curl https://raw.githubusercontent.com/Juszoe/flexget-nexusphp/master/nexusphp.py > ~/.flexget/plugins/nexusphp.py16
17# 创建用于存放种子的目录18mkdir ~/flexget/torrents19
20# 测试21~/flexget/bin/flexget --version
然后是配置:
1web_server:2 bind: 127.0.0.13 port: 35394 web_ui: yes5 base_url: /flexget6
7tasks:8 u2_free:9 rss:10 url: "这里填写你的 RSS 链接"11 other_fields: [link]12 nexusphp:13 cookie: "这里填写你的 Cookie"14 discount:15 - free16 - 2xfree17 seeders:18 min: 019 max: 520 hr: no21 remember: no22 download: ~/flexget/torrents/23
24schedules:25 - tasks: "u2_free"26 interval:27 minutes: 15
接下来是 Nginx
的配置:
1location /flexget/ {2 proxy_pass http://127.0.0.1:3539/flexget/;3 proxy_http_version 1.1;4 proxy_set_header X-Forwarded-Host \$server_name:\$server_port;5
6 http2_push_preload on;7
8 proxy_hide_header Referer;9 proxy_hide_header Origin;10 proxy_set_header Referer '';11 proxy_set_header Origin '';12
13 add_header X-Frame-Options "SAMEORIGIN";14}
最后启动:
1flexget daemon start --daemonize
rclone
总结
至此,需要的软件基本都有了,也就可以正常工作Google Drive
,但一直偷懒没写自动脚本,就手动来了。
Arch
配置起来确实省心,哪天我又要弄盒子的时候照着这篇重开一遍就行了((