GNU/Linux >> Tutoriales Linux >  >> Ubuntu

Cómo instalar Jellyfin Media Server con Nginx en Ubuntu 20.04

Jellyfin es una solución de transmisión de medios gratuita y de código abierto que le permite alojar su propio servidor de medios. Se puede instalar en Linux, Windows y macOS. Puede administrar sus medios, como películas, programas de televisión, música y fotos, y compartirlos en varios dispositivos con Jellyfin. También proporciona aplicaciones para Android, Android TV y Amazon Fire TV. Ofrece varias características que incluyen, Admite DLNA, Sin límite de reproducción, Obtener metadatos automáticamente de TheTVDB, TheMovieDB y Rotten Tomatoes, Grabaciones automáticas, Admite aceleración de hardware y muchas más.

En este tutorial, explicaremos cómo instalar y configurar un servidor multimedia con Jellyfin en Ubuntu 20.04.

Requisitos

  • Un servidor con Ubuntu 20.04.
  • Un nombre de dominio válido apuntado con la IP de su servidor.
  • Se configura una contraseña de root en el servidor.

Cómo empezar

Antes de comenzar, actualice los paquetes de su sistema usando el siguiente comando:

apt-get update -y

Una vez que todos los paquetes estén actualizados, instale otras dependencias requeridas con el siguiente comando:

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

Después de instalar todas las dependencias, puede continuar con el siguiente paso.

Instalar Jellyfin

De forma predeterminada, el paquete Jellyfin no está disponible en el repositorio predeterminado de Ubuntu 20.04. Por lo tanto, deberá agregar el repositorio Jellyfin a su sistema. Primero, descargue y agregue la clave GPG con el siguiente comando:

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

Una vez que se agrega la clave GPG, agregue el repositorio Jellyfin a la APT con el siguiente comando:

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

A continuación, actualice la memoria caché del repositorio e instale Jellyfin con el siguiente comando:

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

Después de instalar Jellyfin, puede verificar el estado del servicio Jellyfin con el siguiente comando:

systemctl status jellyfin

Deberías obtener el siguiente resultado:

? 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 Sun 2020-12-27 06:15:40 UTC; 58s ago
   Main PID: 8454 (jellyfin)
      Tasks: 16 (limit: 4691)
     Memory: 92.3M
     CGroup: /system.slice/jellyfin.service
             ??8454 /usr/bin/jellyfin --webdir=/usr/share/jellyfin/web --restartpath=/usr/lib/jellyfin/restart.sh --ffmpeg=/usr/lib/jellyfin-f>

Dec 27 06:15:48 ubuntu2004 jellyfin[8454]: [06:15:48] [INF] Registering publisher for urn:schemas-upnp-org:device:MediaServer:1 on 104.245.33.>
Dec 27 06:15:48 ubuntu2004 jellyfin[8454]: [06:15:48] [INF] Executed all pre-startup entry points in 0:00:00.6715621
Dec 27 06:15:48 ubuntu2004 jellyfin[8454]: [06:15:48] [INF] Core startup complete
Dec 27 06:15:48 ubuntu2004 jellyfin[8454]: [06:15:48] [INF] Executed all post-startup entry points in 0:00:00.3885698
Dec 27 06:15:48 ubuntu2004 jellyfin[8454]: [06:15:48] [INF] Startup complete 0:00:08.0109863
Dec 27 06:15:50 ubuntu2004 jellyfin[8454]: [06:15:50] [INF] StartupTrigger fired for task: Update Plugins
Dec 27 06:15:50 ubuntu2004 jellyfin[8454]: [06:15:50] [INF] Queueing task PluginUpdateTask
Dec 27 06:15:50 ubuntu2004 jellyfin[8454]: [06:15:50] [INF] Executing Update Plugins
Dec 27 06:15:50 ubuntu2004 jellyfin[8454]: [06:15:50] [INF] Update Plugins Completed after 0 minute(s) and 0 seconds
Dec 27 06:15:51 ubuntu2004 jellyfin[8454]: [06:15:51] [INF] ExecuteQueuedTasks

De forma predeterminada, Jellyfin escucha en el puerto 8096. Puede verificarlo con el siguiente comando:

ss -antpl | grep 8096

Deberías obtener el siguiente resultado:

LISTEN    0         512                      *:8096                   *:*        users:(("jellyfin",pid=8454,fd=285))                                           

En este punto, Jellyfin está instalado y funcionando. Ahora puede continuar con el siguiente paso.

Configurar Nginx como proxy inverso

A continuación, se recomienda configurar Nginx como proxy inverso para Jellyfin. Para hacerlo, primero instale el servidor web Nginx con el siguiente comando:

apt-get install nginx -y

Una vez que Nginx esté instalado, cree un nuevo archivo de configuración de host virtual de Nginx:

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

Agregue las siguientes líneas:

server {
      listen 80;
      server_name jellyfin.yourdomain.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";

}

Guarde y cierre el archivo cuando haya terminado. Luego, verifique el Nginx para cualquier error de sintaxis con el siguiente comando:

nginx -t

Si todo está bien, debería obtener el siguiente resultado:

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

A continuación, reinicie el servicio Nginx para aplicar los cambios de configuración:

systemctl restart nginx

También puede verificar el estado de Nginx con el siguiente comando:

systemctl status nginx

Debería ver el siguiente resultado:

? nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2020-12-27 06:18:13 UTC; 6s ago
       Docs: man:nginx(8)
    Process: 9865 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 9879 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 9883 (nginx)
      Tasks: 3 (limit: 4691)
     Memory: 3.6M
     CGroup: /system.slice/nginx.service
             ??9883 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ??9884 nginx: worker process
             ??9885 nginx: worker process

Dec 27 06:18:13 ubuntu2004 systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec 27 06:18:13 ubuntu2004 systemd[1]: Started A high performance web server and a reverse proxy server.

En este punto, Nginx está instalado y configurado para servir a Jellyfin. Ahora puede continuar con el siguiente paso.

Acceder a la interfaz de usuario web de Jellyfin

Ahora, abra su navegador web y acceda a la interfaz de usuario web de Jellyfin usando la URL http://jellyfin.yourdomain.com . Será redirigido a la siguiente pantalla:

Seleccione su idioma y haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Proporcione su nombre de usuario y contraseña de administrador y haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Seleccione el idioma y el país de sus metadatos y luego haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Seleccione la opción deseada y haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Haga clic en Finalizar botón. Debería ver la página de inicio de sesión de Jellyfin:

Proporcione su nombre de usuario, contraseña y haga clic en Iniciar sesión botón. Debería ver el panel de control de Jellyfin en la siguiente pantalla:

Ahora puede agregar sus medios a la biblioteca y acceder a ellos a través de Internet.

Asegure Jellyfin con Let's Encrypt

A continuación, deberá instalar el paquete de cliente de Certbot para instalar y administrar Let's Encrypt SSL. Primero, instale Certbot con el siguiente comando:

apt-get install python3-certbot-nginx -y

Una vez finalizada la instalación, ejecute el siguiente comando para instalar Let's Encrypt SSL en su sitio web:

certbot --nginx -d jellyfin.yourdomain.com

Se le pedirá que proporcione una dirección de correo electrónico válida y acepte el término de servicio como se muestra a continuación:

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): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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.yourdomain.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/jellyfin.conf

A continuación, elija si desea o no redirigir el tráfico HTTP a HTTPS como se muestra a continuación:

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

Escriba 2 y presione Entrar para finalizar la instalación. Debería ver el siguiente resultado:

Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/jellyfin.conf

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/jellyfin.yourdomain.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/jellyfin.yourdomain.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.

Ahora, su sitio web está protegido con Let's Encrypt SSL. Puede acceder de forma segura utilizando la URL https://jellyfin.yourdomain.com.

Conclusión

¡Felicidades! Ha instalado y configurado correctamente Jellyfin con Nginx y Let's Encrypt SSL en el servidor Ubuntu 20.04. Ahora puede transmitir sus medios y acceder a ellos desde el navegador web o mediante la aplicación Jellyfin. Siéntase libre de preguntarme si tiene alguna pregunta.


Ubuntu
  1. Cómo instalar Plex Media Server en Ubuntu 20.04

  2. Cómo instalar Plex Media Server en Ubuntu 18.04

  3. Cómo instalar Nginx en Ubuntu 20.04

  4. Cómo instalar el servidor HTTP Git con Nginx en Ubuntu 16.04

  5. Cómo instalar el servidor HTTP Git con Nginx en Ubuntu 20.04

Cómo instalar InvoiceNinja en un servidor Ubuntu 18.04 con Apache/Nginx

Cómo instalar InvoiceNinja en un servidor Ubuntu 20.04 con Apache/Nginx

Cómo instalar Jellyfin Media Server en Ubuntu 20.04 LTS

Cómo instalar Nginx en Ubuntu

Cómo instalar LetsEncrypt con Nginx en Ubuntu 15.04

Cómo instalar Jellyfin Media Server en Ubuntu 20.04