在CentOS上搭建Jellyfin媒体服务器的步骤如下:
首先,确保你的CentOS系统是最新的:
sudo yum update -y
安装一些必要的依赖包:
sudo yum install -y epel-release
sudo yum install -y wget curl git
添加Jellyfin的官方仓库:
sudo tee /etc/yum.repos.d/jellyfin.repo <<EOF
[jellyfin]
name=Jellyfin Media Server
baseurl=https://download.jellyfin.org/repository/yum/
enabled=1
gpgcheck=1
gpgkey=https://download.jellyfin.org/repository/yum/RPM-GPG-KEY-jellyfin
EOF
安装Jellyfin媒体服务器:
sudo yum install -y jellyfin
启动Jellyfin服务并设置开机自启:
sudo systemctl start jellyfin
sudo systemctl enable jellyfin
打开浏览器,访问 http://<your_server_ip>:8096,其中 <your_server_ip> 是你的服务器IP地址。首次访问时,系统会提示你设置管理员密码。
如果你的服务器启用了防火墙,确保开放Jellyfin的默认端口8096:
sudo firewall-cmd --permanent --zone=public --add-port=8096/tcp
sudo firewall-cmd --reload
为了安全起见,建议配置SSL证书。你可以使用Let’s Encrypt免费获取SSL证书:
sudo yum install -y certbot python3-certbot-nginx
sudo certbot --nginx -d <your_domain>
按照提示完成SSL证书的安装和配置。
如果你希望通过域名访问Jellyfin,并且已经配置了Nginx作为反向代理,可以在Nginx配置文件中添加如下配置:
server {
listen 80;
server_name <your_domain>;
location / {
proxy_pass http://localhost:8096;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
}
}
然后重启Nginx服务:
sudo systemctl restart nginx
现在,你应该可以通过浏览器访问 http://<your_domain>:8096 来使用Jellyfin媒体服务器了。
希望这些步骤能帮助你在CentOS上成功搭建Jellyfin媒体服务器!如果有任何问题,请随时提问。