centos7安装plex影音媒体服务器
Plex的全称为Plex Media Server,主要功能是存储+索引+转码+在线播放,它不仅仅是简单的存储,它还能分析影片的信息从而从IMDB等数据库补全影片介绍等信息,并且进行索引以方便搜索,要知道影片的格式有很多种,很多情况下播放设备无法兼容,所以它还能实时转码,播放渠道从网页到全平台的客户端应有尽有.当然,Plex除了能存片,还能存图存歌等等.
1.下载软件
yum -y install https://downloads.plex.tv/plex-media-server/1.13.5.5291-6fa5e50a8/plexmediaserver-1.13.5.5291-6fa5e50a8.x86_64.rpm
yum -y install libxslt
plex的下载地址:
https://www.plex.tv/media-server-downloads/
2.运行plex
systemctl start plexmediaserver
systemctl stop plexmediaserver
3.安装xmlstarlet
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/x/xmlstarlet-1.6.1-1.el7.x86_64.rpm
rpm -ivh xmlstarlet-1.6.1-1.el7.x86_64.rpm
4.进入到plex配置目录
cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/
看看是否有 Preferences.xml 这个文件,如果没有就再执行一次:
systemctl start plexmediaserver
systemctl stop plexmediaserver
5.替换你的Plex账户用户名和密码运行命令
PLEX_TOKEN=$(curl -qu "Plex用户名":"Plex密码" 'https://plex.tv/users/sign_in.xml' \ -X POST -H 'X-Plex-Device-Name: PlexMediaServer' \ -H 'X-Plex-Provides: server' \ -H 'X-Plex-Version: 0.9' \ -H 'X-Plex-Platform-Version: 0.9' \ -H 'X-Plex-Platform: xcid' \ -H 'X-Plex-Product: Plex Media Server'\ -H 'X-Plex-Device: Linux'\ -H 'X-Plex-Client-Identifier: XXXX' --compressed | sed -n 's/.*<authentication-token>\(.*\)<\/authentication-token>.*/\1/p')
xmlstarlet ed --inplace --insert "Preferences" --type attr -n "AcceptedEULA" -v "1" "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml" xmlstarlet ed --inplace --insert "Preferences" --type attr -n "FirstRun" -v "0" "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml" xmlstarlet ed --inplace --insert "Preferences" --type attr -n "PlexOnlineUsername" -v "Plex用户名" "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml" xmlstarlet ed --inplace --insert "Preferences" --type attr -n "PublishServerOnPlexOnlineKey" -v "1" "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml" xmlstarlet ed --inplace --insert "Preferences" --type attr -n "PlexOnlineToken" -v "${PLEX_TOKEN}" "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml"
替换好了之后就可以重启下plex服务:
systemctl restart plexmediaserver
最后在浏览器上访问 http://ip:32400 就可以了.
ps:
官方插件地址: https://github.com/plexinc-agents,其他的请自己在GitHub上以及Plex论坛或者Reddit上搜索.
插件安装方式:
cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins
wget https://github.com/plexinc-agents/Sub-Zero.bundle/archive/master.zip
unzip master.zip
rm -f master.zip
mv Sub-Zero.bundle-master Sub-Zero.bundle
chown -R plex:plex Sub-Zero.bundle
systemctl restart plexmediaserver
评论: