在CentOS上搭建Jellyfin媒体服务器可以通过以下步骤进行:
更新系统:
sudo yum update -y
安装依赖包:
sudo yum install -y libicu fontconfig
Jellyfin需要FFmpeg进行视频转码,可以从John Van Sickle下载静态包并进行安装:
wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
tar -xvf ffmpeg-git-amd64-static.tar.xz
cp ffmpeg-git-20200211-amd64-static/ffmpeg /usr/bin/
cp ffmpeg-git-20200211-amd64-static/ffprobe /usr/bin/
下载Jellyfin的RPM包:
wget -c https://repo.jellyfin.org/releases/server/centos/stable/web/jellyfin-web-10.8.9-1.el7.noarch.rpm
wget -c https://repo.jellyfin.org/releases/server/centos/stable/server/jellyfin-server-10.8.9-1.el7.x86_64.rpm
wget -c https://repo.jellyfin.org/releases/server/centos/stable/server/jellyfin-10.8.9-1.el7.x86_64.rpm
安装Jellyfin:
sudo yum localinstall jellyfin-web-10.8.9-1.el7.noarch.rpm
sudo yum localinstall jellyfin-server-10.8.9-1.el7.x86_64.rpm
sudo yum localinstall jellyfin-10.8.9-1.el7.x86_64.rpm
sudo systemctl start jellyfin
sudo systemctl enable jellyfin
放行必要的端口,如HTTP(8096)、HTTPS(8920)、DLNA(1900)和Bonjour/mDNS(5353):
sudo firewall-cmd --zone=public --add-port=8096/tcp --permanent
sudo firewall-cmd --zone=public --add-port=8920/tcp --permanent
sudo firewall-cmd --zone=public --add-port=1900/udp --permanent
sudo firewall-cmd --zone=public --add-port=5353/udp --permanent
sudo firewall-cmd --reload
访问Jellyfin的Web界面(通常是http://<your_server_ip>:8096),按照提示完成初始化设置,包括添加媒体库和配置FFmpeg路径。
安装Docker:
sudo yum install -y docker
sudo systemctl start docker
sudo systemctl enable docker
拉取最新版的Jellyfin镜像:
docker pull jellyfin/jellyfin:latest
新建配置和缓存目录:
mkdir -p /srv/jellyfin/{config,cache}
运行容器:
docker run -d --name myvideo -p 80:8096 --restart always --privileged true -v /srv/jellyfin/config:/config -v /srv/jellyfin/cache:/cache -v /path/to/your/media:/media jellyfin/jellyfin:latest