远程VPS上设立Plex媒体服务+VPS硬解

date
May 22, 2022
slug
newservice-vps-plex-server
status
Published
summary
新服务 Plex on VPS
tags
service
type
Post
URL

Summary

  • 保留一个远程服务
  • 可以多服务器链接到一个plex账号上

步骤

获得plex claim code - https://www.plex.tv/claim/

notion image
notion image
 

设立docker-composer


export DOCKER_PROJ=plex
mkdir -p /data/$DOCKER_PROJ; cd /data/$DOCKER_PROJ
# 可以把rclone的目录挂载到/data下面
export RCLONE_TARGET1=gd_omgd_shared
cd data
ln -s /drive/$RCLONE_TARGET1 $RCLONE_TARGET1
cd ..


DOCKER_HOST_IP=$(curl ip.sb)
cat > docker-compose.yml <<EOF
version: '3.3'
services:
    pms-docker:
        container_name: plex
        ports:
            - '32400:32400/tcp'
            - '3005:3005/tcp'
            - '8324:8324/tcp'
            - '32469:32469/tcp'
            - '1900:1900/udp'
            - '32410:32410/udp'
            - '32412:32412/udp'
            - '32413:32413/udp'
            - '32414:32414/udp'
        environment:
            - TZ=Asia/Hong_Kong
            - PLEX_CLAIM=claim-Qm2yGgmgB-only 4 mins!!!
            - ADVERTISE_IP=http://$DOCKER_HOST_IP:32400/
        volumes:
            - './config:/config'
            - './transcode:/transcode'
            - './data:/data'
            - './data/$RCLONE_TARGET1:/data/$RCLONE_TARGET1'
        image: plexinc/pms-docker
EOF

docker-compose down; docker-compose up -d; sleep 1s; docker-compose logs -f
 
notion image

防火墙 - ufw allow 32400

notion image

配置LAN

 
10.0.0.0/16,10.13.0.0/16,192.168.0.0/16,172.16.0.0/16,10.168.0.0/16
notion image

验证

notion image
notion image
 
 

原始质量播放,不硬解 - 用于弱VPS

notion image

rclone挂载参数

--vfs-cache-mode full #开启vfs缓存,此缓存占用本地存储空间
--vfs-cache-max-age 1m #缓存时间,建议设置小一点,要不切视频可能导致我的20g被占满
--vfs-read-chunk-size-limit 100M #缓存块大小,每次块达到100M都会重新调用ODAPI,设置大些可以减少调用,按需设置
--vfs-cache-max-size 10G #最大缓存大小,我设置10G,不会占满我的20g小盘

# 缓存文件路径
# 如果本地磁盘被缓存占满了会导致plex那边无法放视频,手动删除如下路径缓存文件即可:

rm -rf /root/.cache/rclone/vfs/*
notion image

硬解 - 对于强悍VPS

lspci -v -s $(lspci | grep VGA | cut -d" " -f 1)

ls /dev/dri
--device /dev/dri:/dev/dri

sudo docker exec -it plex /bin/bash
chown -R plex:video /dev/dri
chmod -R 777 /dev/dri
notion image
notion image
notion image
 

安装允许利用本地nfo搜刮信息的插件

  • 下载 -
cd /data/plex/config/Library/Application\ Support/Plex\ Media\ Server/Plug-ins
curl -sSL https://github.com/gboudreau/XBMCnfoMoviesImporter.bundle/archive/master.zip -o XBMCnfoMoviesImporter.bundle.zip 
unzip XBMCnfoMoviesImporter.bundle.zip
mv XBMCnfoMoviesImporter.bundle-master XBMCnfoMoviesImporter.bundle
cd /data/plex
docker-compose down; docker-compose up -d; sleep 1s; docker-compose logs -f
  • 改名
notion image
notion image
  • 重启plex
  • 配置和确认
notion image
notion image

© Ying Bun 2021 - 2024