此教程针对Debian12系统进行,并且非保姆级的教程。只针对熟悉Linux操作和阅读基础的人群
此篇教程模拟内容如下
Debian12系统的内网IP为192.168.1.100
Emby的内网IP为172.17.0.2

1.安装Docker
https://zero.cd/2024/3.html

1.1如果你是国内机器就替换Docker源
https://zero.cd/2024/5.html
(直接读 Zero公开免费服务 下面内容即可)

2.安装Alist (一键安装)
https://alist.nn.ci/zh/guide/install/script.html
这里如果你是Debian12 我推荐你使用上方官方教程的一件安装

3.通过Alist 添加 OneDrive 为存储 (参考下方链接添加)
https://alist.nn.ci/zh/guide/drivers/onedrive.html
此教程模拟的Debian12系统下的Alist添加的OneDrive挂载路径为/Emby

4.安装Rclone + fuse3 (一件安装)
https://rclone.org/downloads/

安装好了Rclone后安装fuse3

apt install fuse3 -y

5.现在开始细分化教程,根据上面我们已经把所需环境(Docker+Alist+Rclone+fuse3)安装
5.1 开始使用 Rclone 挂载 Alist的WebDav

rclone config

5.2添加配置建议参考如下

----------[n](新建一个配置)---------------------
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

----------[alist](名称)---------------------
Enter name for new remote.
name> alist

-----------[webdave](协议)---------------------------------
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 3 / Alias for an existing remote
   \ (alias)
 4 / Amazon Drive
   \ (amazon cloud drive)
 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Ceph, ChinaMobile, Cloudflare, DigitalOcean, Dreamhost, GCS, HuaweiOBS, IBMCOS, IDrive, IONOS, LyveCloud, Leviia, Liara, Linode, Minio, Netease, Petabox, RackCorp, Rclone, Scaleway, SeaweedFS, StackPath, Storj, Synology, TencentCOS, Wasabi, Qiniu and others
   \ (s3)
 6 / Backblaze B2
   \ (b2)

-------[http://192.168.1.100:5244/dav/](这里的 192.168.1.100 请更改自己的机器IP)------
Option url.
URL of http host to connect to.
E.g. https://example.com.
Enter a value.
url> http://192.168.1.100:5244/dav/

-------[other]------
Option vendor.
Name of the WebDAV site/service/software you are using.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
 1 / Fastmail Files
   \ (fastmail)
 2 / Nextcloud
   \ (nextcloud)
 3 / Owncloud
   \ (owncloud)
 4 / Sharepoint Online, authenticated by Microsoft account
   \ (sharepoint)
 5 / Sharepoint with NTLM authentication, usually self-hosted or on-premises
   \ (sharepoint-ntlm)
 6 / rclone WebDAV server to serve a remote over HTTP via the WebDAV protocol
   \ (rclone)
 7 / Other site/service or software
   \ (other)
vendor> other

-------[admin](这里的 admin 用上面记录的 alist 帐号替换)------
Option user.
User name.
In case NTLM authentication is used, the username should be in the format 'Domain\User'.
Enter a value. Press Enter to leave empty.
user> admin

-------[y](我要自己填写密码)------
Option pass.
Password.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y

-------[password](这里的 password 用上面记录的 alist 密码替换,记得要输两遍)------
Option user.
User name.
In case NTLM authentication is used, the username should be in the format 'Domain\User'.
Enter a value. Press Enter to leave empty.
user> admin

Option pass.
Password.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
Enter the password:
password:
Confirm the password:
password:

-------[](这里直接回车)------
Option bearer_token.
Bearer token instead of user/pass (e.g. a Macaroon).
Enter a value. Press Enter to leave empty.
bearer_token> 

-------[n](使用默认配置)------
Edit advanced config?
y) Yes
n) No (default)
y/n> n

-------[y](保存)------
Configuration complete.
Options:
- type: webdav
- url: http://192.168.1.100:5244/dav/
- vendor: other
- user: admin
- pass: *** ENCRYPTED ***
Keep this "alist" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

-------[q](退出)------
Current remotes:

Name                 Type
====                 ====
alist                webdav

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q

5.3使用Rclone将配置文件挂载到Debian12系统根目录/onedrive
5.3.1 先在Debian12系统根目录创建onedrive文件夹

mkdir /onedrive

5.3.2 把Rclone挂载进行守护进程并且挂载

nano /etc/systemd/system/rclone-mount.service

将下方配置直接填入进去

[Unit]
Description=Rclone Mount
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount alist: /onedrive --allow-other --vfs-cache-mode writes --allow-non-empty --transfers=4 --buffer-size=50M --ignore-errors
ExecStop=/bin/fusermount -u /onedrive
Restart=always
RestartSec=10

[Install]
WantedBy=default.target

5.3.3 启动挂载
执行 systemctl daemon-reload 重载配置,现在你可以使用这些命令来管理程序:

启动: systemctl start rclone-mount
关闭: systemctl stop rclone-mount
配置开机自启: systemctl enable rclone-mount
取消开机自启: systemctl disable rclone-mount
状态: systemctl status rclone-mount
重启: systemctl restart rclone-mount

如果一切顺利,执行下方命令你可以看到名为Emby目录,里面是你自己OneDrive网盘的内容

ls -lah /onedrive/Emby

6 安装 embyserver
这里使用 https://hub.docker.com/r/amilys/embyserver 此镜仅供学习研究!请支持正版!
6.1 创建目录 - 进入目录

mkdir /opt/embyserver && cd /opt/embyserver

6.2 创建 Docker compose 启动 embyserver

nano docker-compose.yml

填入

services:
  embyserver:
    image: amilys/embyserver
    container_name: emby
    volumes:
      - ./emby:/config
      - /onedrive/Emby:/onedrive/Emby:shared
    privileged: true
    network_mode: bridge
    ports:
      - 8096:8096
    restart: unless-stopped

启动

docker compose up -d

7.访问 http://192.168.1.100:8096/
7.1进行初始化设置然后查看emby的内网IP
(这里Debian12系统下的Emby内网IP为172.17.0.2)
7.2生成并记录 embyserver 的 API KEY
7.3并且关闭转码功能

8.安装 embyExternalUrl 让emby的视频全部302跳转到Alist的生成OneDrive直链来观看视频
项目地址 https://github.com/bpking1/embyExternalUrl

cd /opt && git clone https://github.com/bpking1/embyExternalUrl.git

修改embyExternalUrl配置

nano /opt/embyExternalUrl/emby2Alist/nginx/conf.d/constant.js

大约在13行-17行代码处修改为自己的Emby内网IP和生成的API KEY

// 这里默认 emby/jellyfin 的地址是宿主机,要注意 iptables 给容器放行端口
const embyHost = "http://这里填入你自己系统的Emby内网IP:8096";

// emby/jellyfin api key, 在 emby/jellyfin 后台设置
const embyApiKey = "这里填入你在7.2步骤教程生成的 APIKEY";

然后修改需要跳转的302地址

nano /opt/embyExternalUrl/emby2Alist/nginx/conf.d/config/constant-mount.js

大约在7行-21行代码出修改自己的alist地址

// rclone/CD2 挂载的 alist 文件配置,根据实际情况修改下面的设置
// 访问宿主机上 5244 端口的 alist 地址, 要注意 iptables 给容器放行端口
const alistAddr = "http://192.168.1.100:5244";

// alist token, 在 alist 后台查看 设置 - 其它
const alistToken = "alist-xxxxx";

// alist 是否启用了 sign
const alistSignEnable = false;

// alist 中设置的直链过期时间,以小时为单位
const alistSignExpireTime = 12;

// alist 公网地址,用于需要 alist server 代理流量的情况,按需填写
const alistPublicAddr = "http://192.168.1.100:5244";

根据配置文件修改自己的IP和信息 基本就可以启动embyExternalUrl

cd /opt/embyExternalUrl/emby2Alist/docker
docker compose up -d

然后你就可以访问你的Emyb了 这里你需要访问embyExternalUrl处理过地址 http://192.168.1.100:8091/
这里IP改为自己的就好了

在Debian 启用可以显著提高网络的速度和可靠性。BBR可以降低数据包丢失,增加吞吐量,优化网络性能。如果你的互联网速度缓慢或存在网络阻塞,不妨考虑启用BBR以查看是否有所改善。

一键开启

echo -e "\nnet.core.default_qdisc=fq\nnet.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf && sysctl -p

验证是否开启成功

sysctl net.ipv4.tcp_congestion_control

如果成功开启,那么会看到以下输出结果

net.ipv4.tcp_congestion_control = bbr

错误排查
输入一键开启命令后,如输出以下结果,则表示系统可能不支持BBR。

net.core.default_qdisc = fq
sysctl: setting key "net.ipv4.tcp_congestion_control": No such file or directory

进一步检验是否支持
输入

sudo modprobe tcp_bbr

输出结果如下,则表示系统不支持BBR

modprobe: ERROR: could not insert 'tcp_bbr': Unknown symbol in module, or unknown parameter (see dmesg)

解决方案

sudo apt update && sudo apt-get upgrade

运行完成后,重启VPS即可。