Post

基于 PVE 的追番下载播放服务

基于 PVE 的追番下载播放服务

以 7840HS 宿主机核显硬解为例

1 在宿主机上挂载 NFS 媒体目录

假设 NFS 服务器 IP 为 192.168.0.10,共享目录为 /mnt/tank/qbittorrent

  • 所属用户 qbit,UID 为 3000
  • 所属用户组 qbit,GID 为 3000
  1. 在 PVE 上创建挂载点

    1
    
    mkdir -p /mnt/qbittorrent
    
  2. 编辑 /etc/fstab,添加:

    1
    
    192.168.0.10:/mnt/tank/qbittorrent /mnt/qbittorrent nfs defaults,_netdev 0 0
    
  3. 挂载:

    1
    
    mount -a
    

2 部署 Jellyfin

2.1 创建 LXC 容器

2.1.1 常规

  1. CT ID:300
  2. 主机名:jellyfin
  3. 无特权的容器:取消勾选

2.1.2 模板

  1. 模板:Debian 12

2.1.3 磁盘

  1. 磁盘大小:128GB

2.1.4 CPU

  1. 核心:4

2.1.5 内存

  1. 内存:4096MB
  2. Swap:4096MB

2.1.6 网络

按实际情况配置

2.2 将核显共享给 LXC

编辑 /etc/pve/lxc/300.conf,添加以下内容:

1
2
lxc.cgroup2.devices.allow: c 226:* rwm
lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir

2.3 将媒体目录映射到 LXC

编辑 /etc/pve/lxc/300.conf,添加以下内容:

1
mp0: /mnt/qbittorrent,mp=/media

2.4 安装 Jellyfin

  1. 启动 LXC
  2. 编辑 /etc/apt/sources.list 修改软件源
  3. 确认 VAAPI 是否可用:

    1
    2
    3
    
    apt update
    apt install vainfo mesa-va-drivers firmware-amd-graphics -y
    vainfo
    
  4. 确认媒体目录是否映射:

    1
    
    ls -al /media
    
  5. 安装 Jellyfin

    1
    2
    
    apt install curl -y
    curl -s https://repo.jellyfin.org/install-debuntu.sh | bash
    

2.5 配置 Jellyfin 开启硬解

控制台 -> 播放 -> 转码

  1. 硬件加速:Video Acceleration API (VAAPI)
  2. VA-API 设备:/dev/dri/renderD128
  3. 启用硬件编码:
    • H264
    • HEVC
    • MPEG2
    • VC1
    • VP8
    • VP9
    • AV1
    • HEVC 10bit
    • VP9 10bit
    • HEVC RExt 8/10bit
    • HEVC RExt 12bit
  4. 点击最下方的保存

2.6 安装 Tailscale(可选)

  1. 编辑 /etc/pve/lxc/300.conf,添加以下内容:

    1
    2
    3
    
    features: nesting=1
    lxc.cgroup2.devices.allow: c 10:200 rwm
    lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
    
  2. 重启 LXC
  3. 检查 /dev/net/tun 是否存在:

    1
    
    ls -l /dev/net/tun
    
  4. 安装 Tailscale
  5. tailscale up 登录账号并连接
  6. tailscale serve --bg 8096

3 部署 qBittorrent

3.1 创建配置文件目录

1
2
mkdir -p /srv/appdata/qbittorrent
chown -R 3000:3000 /srv/appdata/qbittorrent

3.2 创建 LXC 容器

3.2.1 常规

  1. CT ID:301
  2. 主机名:qbittorrent
  3. 无特权的容器:取消勾选

3.2.2 模板

  1. 模板:Debian 12

3.2.3 磁盘

  1. 磁盘大小:128GB

3.2.4 CPU

  1. 核心:2

3.2.5 内存

  1. 内存:2048MB
  2. Swap:2048MB

3.2.6 网络

按实际情况配置

3.3 将目录映射到 LXC

编辑 /etc/pve/lxc/301.conf,添加以下内容:

1
2
3
mp0: /srv/appdata/qbittorrent,mp=/config
mp1: /mnt/qbittorrent/anime,mp=/anime
mp2: /mnt/qbittorrent/downloads,mp=/downloads

3.4 安装 Podman

  1. 编辑 /etc/pve/lxc/301.conf,添加以下内容:

    1
    2
    3
    
    features: nesting=1,keyctl=1
    lxc.cgroup2.devices.allow: c 10:229 rwm
    lxc.mount.entry: /dev/fuse dev/fuse none bind,create=file
    
  2. 启动 LXC
  3. 编辑 /etc/apt/sources.list 修改软件源
  4. 安装 Podman:

    1
    2
    
    apt update
    apt install podman -y
    

3.5 安装 qBittorrent

1
2
3
4
5
6
7
8
9
10
11
12
podman run -d \
    --name qbittorrent \
    --network=host \
    --restart=always \
    -e PUID=3000 \
    -e PGID=3000 \
    -e WEBUI_PORT=8080 \
    -e TZ=Asia/Shanghai \
    -v /config:/config \
    -v /anime:/anime \
    -v /downloads:/downloads \
    lscr.io/linuxserver/qbittorrent:latest

3.6 安装 Tailscale(可选)

  1. 编辑 /etc/pve/lxc/301.conf,添加以下内容:

    1
    2
    
    lxc.cgroup2.devices.allow: c 10:200 rwm
    lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
    
  2. 重启 LXC
  3. 安装 Tailscale
  4. tailscale up 登录账号并连接
  5. tailscale serve --bg 8080

4 部署 ani-rss

4.1 创建配置文件目录

1
2
mkdir -p /srv/appdata/ani-rss
chown -R 3000:3000 /srv/appdata/ani-rss

4.2 创建 LXC 容器

4.2.1 常规

  1. CT ID:302
  2. 主机名:ani-rss
  3. 无特权的容器:取消勾选

4.2.2 模板

  1. 模板:Debian 12

4.2.3 磁盘

  1. 磁盘大小:64GB

4.2.4 CPU

  1. 核心:2

4.2.5 内存

  1. 内存:1024MB
  2. Swap:1024MB

4.2.6 网络

按实际情况配置

4.3 将目录映射到 LXC

编辑 /etc/pve/lxc/302.conf,添加以下内容:

1
2
mp0: /srv/appdata/ani-rss,mp=/config
mp1: /mnt/qbittorrent/anime,mp=/anime

4.4 安装 Podman

  1. 编辑 /etc/pve/lxc/302.conf,添加以下内容:

    1
    2
    3
    
    features: nesting=1,keyctl=1
    lxc.cgroup2.devices.allow: c 10:229 rwm
    lxc.mount.entry: /dev/fuse dev/fuse none bind,create=file
    
  2. 启动 LXC
  3. 编辑 /etc/apt/sources.list 修改软件源
  4. 安装 Podman:

    1
    2
    
    apt update
    apt install podman -y
    

4.5 安装 ani-rss

为避免限流先使用 podman login docker.io 登录账号

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
podman run -d \
    --name ani-rss \
    --network=host \
    --restart=always \
    -e PUID=3000 \
    -e PGID=3000 \
    -e UMASK=022 \
    -e SERVER_PORT=7789 \
    -e TZ=Asia/Shanghai \
    -e SWAGGER_ENABLED=false \
    -e MCP_ENABLED=false \
    -e JAVA_OPTS="-Xms64m -Xmx512m -Xss256k -XX:+UseG1GC" \
    -e CONFIG=/config \
    -v /config:/config \
    -v /anime:/anime \
    docker.io/wushuo894/ani-rss:latest

4.6 安装 Tailscale(可选)

  1. 编辑 /etc/pve/lxc/302.conf,添加以下内容:

    1
    2
    
    lxc.cgroup2.devices.allow: c 10:200 rwm
    lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
    
  2. 重启 LXC
  3. 安装 Tailscale
  4. tailscale up 登录账号并连接
  5. tailscale serve --bg 7789
This post is licensed under CC BY 4.0 by the author.