웹사이트 검색

Debian 10에 Jellyfin Media Server를 설치하는 방법


이 페이지에서

  1. 전제 조건
  2. 시작하기\n
  3. 젤리핀 설치\n
  4. Nginx를 역방향 프록시로 구성\n
  5. 젤리핀 접속\n
  6. Lets Encrypt SSL로 보안 Jellyfin
  7. 결론

Jellyfin은 미디어를 관리하고 스트리밍할 수 있는 오픈 소스 미디어 스트리밍 시스템입니다. 교차 플랫폼이며 Emby 및 Plex와 같은 다른 응용 프로그램의 대안입니다. Jellyfin을 사용하면 웹 기반 인터페이스에서 미디어 파일, TV 쇼, 음악 및 사진을 구성하고 공유할 수 있습니다. 인터넷을 통해 PC, 태블릿, 전화, Roku 및 TV에서 스트리밍된 미디어에 액세스할 수 있습니다. Jellyfin은 TheMovieDB, OpenMovie, Rotten Tomatoes 및 TheTVDB 데이터베이스에서 메타데이터를 자동으로 가져옵니다.

이 게시물에서는 Debian 10에서 Nginx를 리버스 프록시로 사용하여 Jellyfin 미디어 스트리밍 서버를 설치하는 방법을 보여줍니다.

전제 조건

  • Debian 10을 실행하는 서버.\n
  • 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
  • 루트 암호는 서버에 구성됩니다.\n

시작하기

먼저 시스템 패키지를 최신 버전으로 업데이트해야 합니다. 다음 명령으로 업데이트할 수 있습니다.

apt-get update -y

모든 패키지가 업데이트되면 다음 명령을 사용하여 다른 필수 패키지를 설치합니다.

apt-get install apt-transport-https ca-certificates gnupg2 curl git -y

모든 패키지가 설치되면 다음 단계로 진행할 수 있습니다.

젤리핀 설치

기본적으로 Jellyfin 패키지는 데비안 10 저장소에 포함되어 있지 않습니다. 따라서 APT에 Jellyfin 저장소를 추가해야 합니다.

다음 명령으로 추가할 수 있습니다.

echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/debian buster main" | tee /etc/apt/sources.list.d/jellyfin.list

리포지토리가 추가되면 다음 명령을 사용하여 GPG 키를 추가합니다.

wget -O - https://repo.jellyfin.org/jellyfin_team.gpg.key | apt-key add -

다음으로 리포지토리를 업데이트하고 다음 명령을 사용하여 Jellyfin을 설치합니다.

apt-get update -y
apt-get install jellyfin -y

젤리핀 설치가 완료되면 다음 명령어로 젤리핀의 상태를 확인할 수 있습니다.

systemctl status jellyfin

다음 출력이 표시되어야 합니다.

? jellyfin.service - Jellyfin Media Server
   Loaded: loaded (/lib/systemd/system/jellyfin.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/jellyfin.service.d
           ??jellyfin.service.conf
   Active: active (running) since Mon 2021-03-22 08:27:42 UTC; 5min ago
 Main PID: 10192 (jellyfin)
    Tasks: 17 (limit: 4701)
   Memory: 113.9M
   CGroup: /system.slice/jellyfin.service
           ??10192 /usr/bin/jellyfin --webdir=/usr/share/jellyfin/web --restartpath=/usr/lib/jellyfin/restart.sh --ffmpeg=/usr/lib/jellyfin-ffm

Mar 22 08:27:45 debian10 jellyfin[10192]: [08:27:45] [WRN] 127.0.0.1/32: GetBindInterface: Loopback 127.0.0.1 returned.
Mar 22 08:27:45 debian10 jellyfin[10192]: [08:27:45] [INF] Executed all pre-startup entry points in 0:00:00.1545678
Mar 22 08:27:45 debian10 jellyfin[10192]: [08:27:45] [INF] Core startup complete
Mar 22 08:27:46 debian10 jellyfin[10192]: [08:27:46] [INF] Executed all post-startup entry points in 0:00:00.1976994
Mar 22 08:27:46 debian10 jellyfin[10192]: [08:27:46] [INF] Startup complete 0:00:03.6985068
Mar 22 08:27:48 debian10 jellyfin[10192]: [08:27:48] [INF] StartupTrigger fired for task: Update Plugins
Mar 22 08:27:48 debian10 jellyfin[10192]: [08:27:48] [INF] Queuing task PluginUpdateTask
Mar 22 08:27:48 debian10 jellyfin[10192]: [08:27:48] [INF] Executing Update Plugins
Mar 22 08:27:49 debian10 jellyfin[10192]: [08:27:49] [INF] Update Plugins Completed after 0 minute(s) and 0 seconds
Mar 22 08:27:49 debian10 jellyfin[10192]: [08:27:49] [INF] ExecuteQueuedTasks

이때 Jellyfin이 시작되어 포트 8096에서 수신 대기합니다. 다음 명령으로 확인할 수 있습니다.

ss -antpl | grep 8096

산출:

LISTEN    0         128                0.0.0.0:8096             0.0.0.0:*        users:(("jellyfin",pid=10192,fd=289))                                          

Nginx를 역방향 프록시로 구성

다음으로 포트 80에서 Jellyfin에 액세스하려면 Nginx를 리버스 프록시로 구성해야 합니다.

먼저 다음 명령을 사용하여 Nginx 패키지를 설치합니다.

apt-get install nginx -y

설치가 완료되면 다음 명령을 사용하여 새 Nginx 구성 파일을 만듭니다.

nano /etc/nginx/conf.d/jellyfin.conf

다음 줄을 추가합니다.

server {
      listen 80;
      server_name jellyfin.example.com;

      access_log /var/log/nginx/jellyfin.access;
      error_log /var/log/nginx/jellyfin.error;

      set $jellyfin 127.0.0.1;

      location / {
          proxy_pass http://127.0.0.1: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;
          proxy_set_header X-Forwarded-Protocol $scheme;
          proxy_set_header X-Forwarded-Host $http_host;

          # Disable buffering when the nginx proxy gets very resource heavy upon streaming
          proxy_buffering off;
      }

      # location block for /web - This is purely for aesthetics so /web/#!/ works instead of having to go to /web/index.html/#!/
      location ~ ^/web/$ {
          # Proxy main Jellyfin traffic
          proxy_pass http://$jellyfin:8096/web/index.html/;
          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;
          proxy_set_header X-Forwarded-Protocol $scheme;
          proxy_set_header X-Forwarded-Host $http_host;
      }

      location /socket {
          # Proxy Jellyfin Websockets traffic
          proxy_pass http://$127.0.0.1:8096;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
          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;
          proxy_set_header X-Forwarded-Protocol $scheme;
          proxy_set_header X-Forwarded-Host $http_host;
      }

        # Security / XSS Mitigation Headers
        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-XSS-Protection "1; mode=block";
        add_header X-Content-Type-Options "nosniff";
}

파일을 저장하고 닫은 후 다음 명령을 사용하여 구문 오류가 있는지 Nginx를 확인합니다.

nginx -t

산출:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

그런 다음 Nginx 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl reload nginx

액세스 젤리핀

이제 웹 브라우저를 열고 URL http://jellyfin.example.com을 사용하여 Jellyfin 웹 인터페이스에 액세스하십시오. 다음 페이지로 리디렉션됩니다.

언어를 선택하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

사용자 이름, 비밀번호를 입력하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

메타데이터 언어를 선택하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

원격 액세스를 허용하고 다음 버튼을 클릭합니다. 설치가 완료되면 다음 페이지가 표시됩니다.

마침 버튼을 클릭하여 설치를 마칩니다. Jellyfin 로그인 페이지가 표시됩니다.

사용자 이름, 비밀번호를 입력하고 로그인 버튼을 클릭합니다. 다음 페이지에서 Jellyfin 대시보드를 볼 수 있습니다.

Lets Encrypt SSL로 젤리핀 보안

다음으로 Lets Encrypt SSL 관리를 설치하려면 Certbot 클라이언트 패키지를 설치해야 합니다. 먼저 다음 명령을 사용하여 Certbot을 설치합니다.

apt-get install python3-certbot-nginx -y

설치가 완료되면 다음 명령을 실행하여 웹사이트에 Lets Encrypt SSL을 설치합니다.

certbot --nginx -d jellyfin.example.com

유효한 이메일 주소를 제공하고 아래와 같이 서비스 약관에 동의하라는 메시지가 표시됩니다.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for jellyfin.example.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/jellyfin.conf

다음으로, 아래와 같이 HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택합니다.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

2를 입력하고 Enter 키를 눌러 설치를 마칩니다. 다음 출력이 표시되어야 합니다.

Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/jellyfin.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://jellyfin.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=jellyfin.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/jellyfin.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/jellyfin.example.com/privkey.pem
   Your cert will expire on 2020-10-30. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

이제 웹사이트는 Lets Encrypt SSL로 보호됩니다. URL https://jellyfin.example.com을 사용하여 안전하게 액세스할 수 있습니다.

결론

축하합니다! Debian 10 서버에 Jellyfin을 성공적으로 설치했습니다. 이제 친구, 가족 및 다른 사용자와 미디어를 쉽게 공유할 수 있습니다.