centos

如何在centos上部署jellyfin

小樊
65
2025-09-09 19:06:44
栏目: 智能运维

在CentOS上部署Jellyfin的步骤如下:

1. 准备工作

2. 安装依赖项

打开终端并运行以下命令来安装必要的依赖项:

sudo yum update -y
sudo yum install -y epel-release
sudo yum install -y git python3-pip python3-devel nginx

3. 下载并安装Jellyfin

git clone https://github.com/jellyfin/jellyfin.git
cd jellyfin
pip3 install -r requirements.txt
sudo systemctl stop nginx
sudo systemctl stop mariadb
sudo systemctl disable mariadb
sudo systemctl stop postgresql
sudo systemctl disable postgresql

# 如果你选择使用SQLite,则无需进行此步骤
# 如果你选择使用MariaDB或PostgreSQL,请创建数据库并配置Jellyfin连接信息

sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql -u root -p

在MySQL中创建数据库和用户,并授予相应权限:

CREATE DATABASE jellyfin;
CREATE USER 'jellyfin'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON jellyfin.* TO 'jellyfin'@'localhost';
FLUSH PRIVILEGES;
EXIT;
sudo -u jellyfin ./jellyfin --init-db

4. 配置Nginx

sudo vi /etc/nginx/conf.d/jellyfin.conf
server {
    listen 80;
    server_name your_domain_or_ip;

    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;
    }
}

5. 启动Jellyfin和Nginx

sudo systemctl start jellyfin
sudo systemctl start nginx

6. 配置防火墙

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

7. 访问Jellyfin

注意事项

0
看了该问题的人还看了