Ricerca nel sito web

Come installare Jellyfin Media Server su Debian 10


Su questa pagina

  1. Prerequisiti
  2. Per iniziare
  3. Installa Jellyfin
  4. Configura Nginx come proxy inverso
  5. Accedi a Jellyfin
  6. Proteggi Jellyfin con Lets Encrypt SSL
  7. Conclusione

Jellyfin è un sistema di streaming multimediale open source che ti consente di gestire e trasmettere i tuoi file multimediali. È multipiattaforma e alternativa ad altre applicazioni come Emby e Plex. Con Jellyfin puoi organizzare e condividere i tuoi file multimediali, programmi TV, musica e foto dall'interfaccia basata sul web. Puoi accedere a quei media in streaming sul tuo PC, tablet, telefono, Roku e TV su Internet. Jellyfin recupera automaticamente i metadati dal database TheMovieDB, OpenMovie, Rotten Tomatoes e TheTVDB.

In questo post, ti mostreremo come installare il server di streaming multimediale Jellyfin con Nginx come proxy inverso su Debian 10.

Prerequisiti

  • Un server che esegue Debian 10.
  • Un nome di dominio valido indicato con l'IP del tuo server.
  • Una password di root è configurata sul server.

Iniziare

Innanzitutto, dovrai aggiornare i tuoi pacchetti di sistema con l'ultima versione. Puoi aggiornarli con il seguente comando:

apt-get update -y

Una volta aggiornati tutti i pacchetti, installa gli altri pacchetti richiesti con il seguente comando:

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

Una volta installati tutti i pacchetti, puoi procedere al passaggio successivo.

Installa Jellyfin

Per impostazione predefinita, il pacchetto Jellyfin non è incluso nel repository Debian 10. Quindi dovrai aggiungere il repository Jellyfin al tuo APT.

Puoi aggiungerlo con il seguente comando:

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

Una volta aggiunto il repository, aggiungi la chiave GPG con il seguente comando:

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

Successivamente, aggiorna il repository e installa Jellyfin con il seguente comando:

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

Una volta installato Jellyfin, puoi controllare lo stato di Jellyfin con il seguente comando:

systemctl status jellyfin

Dovresti ottenere il seguente output:

? 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

A questo punto, Jellyfin è avviato e in ascolto sulla porta 8096. Puoi verificarlo con il seguente comando:

ss -antpl | grep 8096

Produzione:

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

Configura Nginx come proxy inverso

Successivamente, dovrai configurare Nginx come proxy inverso per accedere a Jellyfin sulla porta 80.

Innanzitutto, installa il pacchetto Nginx con il seguente comando:

apt-get install nginx -y

Una volta installato, crea un nuovo file di configurazione Nginx con il seguente comando:

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

Aggiungi le seguenti righe:

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

Salva e chiudi il file, quindi verifica Nginx per eventuali errori di sintassi con il seguente comando:

nginx -t

Produzione:

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

Successivamente, riavvia il servizio Nginx per applicare le modifiche:

systemctl reload nginx

Accedi a Jellyfin

Ora apri il tuo browser web e accedi all'interfaccia web di Jellyfin utilizzando l'URL http://jellyfin.example.com. Verrai reindirizzato alla seguente pagina:

Seleziona la tua lingua e fai clic sul pulsante Avanti. Dovresti vedere la seguente pagina:

Fornisci il tuo nome utente, password e fai clic sul pulsante Avanti. Dovresti vedere la seguente pagina:

Fare clic sul pulsante Avanti. Dovresti vedere la seguente pagina:

Seleziona la lingua dei metadati e fai clic sul pulsante Avanti. Dovresti vedere la seguente pagina:

Consenti l'accesso remoto e fai clic sul pulsante Avanti. Una volta terminata l'installazione, dovresti vedere la seguente pagina:

Fare clic sul pulsante Fine per terminare l'installazione. Dovresti vedere la pagina di accesso di Jellyfin:

Fornisci il tuo nome utente, password e fai clic sul pulsante Accedi. Dovresti vedere la dashboard di Jellyfin nella pagina seguente:

Proteggi Jellyfin con Lets Encrypt SSL

Successivamente, dovrai installare il pacchetto client Certbot per installare la gestione di Lets Encrypt SSL. Innanzitutto, installa Certbot con il seguente comando:

apt-get install python3-certbot-nginx -y

Al termine dell'installazione, esegui il seguente comando per installare Lets Encrypt SSL sul tuo sito web:

certbot --nginx -d jellyfin.example.com

Ti verrà chiesto di fornire un indirizzo email valido e di accettare i termini di servizio come mostrato di seguito:

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

Successivamente, scegli se reindirizzare o meno il traffico HTTP su HTTPS come mostrato di seguito:

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

Digita 2 e premi Invio per completare l'installazione. Dovresti vedere il seguente output:

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.

Ora il tuo sito web è protetto con Lets Encrypt SSL. Puoi accedervi in modo sicuro utilizzando l'URL https://jellyfin.example.com.

Conclusione

Congratulazioni! hai installato con successo Jellyfin sul server Debian 10. Ora puoi condividere facilmente i tuoi file multimediali con i tuoi amici, familiari e altri utenti.