温馨提示×

ubuntu jellyfin资源获取

小樊
55
2025-05-08 07:46:48
栏目: 智能运维

在Ubuntu上安装Jellyfin媒体服务器的步骤如下:

准备工作

  • 更新系统:
sudo apt update sudo apt upgrade -y 
  • 安装必要的软件包:
sudo apt install apt-transport-https ca-certificates curl software-properties-common 
  • 创建密钥环目录并添加Jellyfin GPG密钥:
mkdir -p /etc/apt/keyrings curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/jellyfin.gpg 

添加Jellyfin仓库

  • 添加Jellyfin仓库文件:
echo "deb [arch $(dpkg --print-architecture)] https://repo.jellyfin.org/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list 
  • 更新包列表:
sudo apt update 

安装Jellyfin

  • 安装Jellyfin:
sudo apt install jellyfin -y 

验证Jellyfin服务

  • 检查Jellyfin服务的状态:
sudo systemctl is-enabled jellyfin sudo systemctl status jellyfin 

管理Jellyfin服务

  • 启动Jellyfin:
sudo systemctl start jellyfin 
  • 停止Jellyfin:
sudo systemctl stop jellyfin 
  • 重启Jellyfin:
sudo systemctl restart jellyfin 

配置防火墙(可选)

  • 安装UFW并配置它以允许必要的服务:
sudo apt install ufw -y sudo ufw allow OpenSSH sudo ufw enable sudo ufw allow "WWW Full" sudo ufw status 

安装Apache和Certbot(可选,用于SSL配置)

  • 安装Apache和Certbot:
sudo apt install apache2 certbot python3-certbot-apache -y 
  • 检查Apache状态:
sudo systemctl is-enabled apache2 sudo systemctl status apache2 
  • 启用所需的Apache模块:
sudo a2enmod proxy proxy_http ssl proxy_wstunnel remoteip http2 headers sudo systemctl restart apache2 

设置Apache作为反向代理

  • 创建Jellyfin的web根目录并设置权限:
sudo mkdir -p /var/www/html/jellyfin/public_html sudo chown -R www-data:www-data /var/www/html/jellyfin/public_html 
  • 使用Certbot为你的域名获取SSL证书:
sudo certbot certonly --agree-tos --email your_email@example.com --no-eff-email --webroot -w /var/www/html -d your_domain 
  • 配置Apache虚拟主机:
sudo nano /etc/apache2/sites-available/jellyfin.conf 

在文件中插入以下内容,根据需要更改域名、SSL证书路径和服务器IP地址:

<VirtualHost *:80> ServerName your_domain Redirect permanent / https://your_domain/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> <VirtualHost *:443> ServerName your_domain DocumentRoot /var/www/html/jellyfin/public_html ProxyPreserveHost On ProxyPass "/.well-known/" "!" RequestHeader set X-Forwarded-Proto "https" RequestHeader set X-Forwarded-Port "443" ProxyPass "/socket" "ws://0.0.0.0:8096/socket" ProxyPassReverse "/socket" "ws://0.0.0.0:8096/socket" ProxyPass "/" "http://0.0.0.0:8096/" ProxyPassReverse "/" "http://0.0.0.0:8096/" </VirtualHost> 
  • 重启Apache:
sudo systemctl restart apache2 

完成以上步骤后,Jellyfin媒体服务器应该已经在Ubuntu上成功安装并运行。您可以通过在浏览器中输入服务器的IP地址来访问Jellyfin的Web界面,并进行相应的配置。

0