How to Install Jellyfin on NetBSD

Jellyfin is a free and open-source media streaming platform that allows you to organize and stream your media files from multiple devices. In this guide, we will show you how to install Jellyfin on NetBSD.

Prerequisites

Step 1: Update the System

Before installing Jellyfin, it is recommended to update the system packages and repository index to their latest versions. You can do this by running the following command:

pkgin update && pkgin full-upgrade

Step 2: Install the Required Dependencies

Jellyfin requires several dependencies to be installed on your system before you can install it. You can install them by running the following command:

pkgin install fontconfig freetype2 fribidi giflib gnutls netpbm opus-tools swscale yasm

Step 3: Download and Install Jellyfin

To install Jellyfin, follow the steps below:

  1. Download the latest version of Jellyfin by visiting the Jellyfin website. Choose the appropriate version for NetBSD, and copy the download link to your clipboard.

  2. Connect to your NetBSD server using SSH, and navigate to the directory where you want to download Jellyfin.

  3. Download Jellyfin using the following command:

    fetch <download-link>
    

    Replace <download-link> with the link you copied in the previous step.

  4. Extract the downloaded archive using the following command:

    tar -xvf jellyfin*.tar.gz
    

    This will create a new directory named jellyfin.

  5. Move the extracted directory to /usr/local using the following command:

    mv jellyfin /usr/local/
    
  6. Set the ownership of the jellyfin directory to the jellyfin user and group using the following command:

    chown -R jellyfin:jellyfin /usr/local/jellyfin
    

Step 4: Configure Jellyfin as a Service

To run Jellyfin as a service on your system, you need to create a new service file in the /etc/rc.d/ directory. Follow the steps below to configure Jellyfin as a service:

  1. Create a new service file in the /etc/rc.d/ directory using the following command:

    vi /etc/rc.d/jellyfin
    
  2. Paste the following text into the service file:

    #!/bin/sh
    #
    # PROVIDE: jellyfin
    # REQUIRE: DAEMON
    # KEYWORD: shutdown
    #
    # Define these variables in /etc/rc.conf to customize the service:
    # jellyfin_user
    # jellyfin_install_dir
    # jellyfin_options
    
    . /etc/rc.subr
    
    name="jellyfin"
    rcvar=${name}_enable
    
    jellyfin_user=${jellyfin_user:-jellyfin}
    jellyfin_install_dir=${jellyfin_install_dir:-/usr/local/jellyfin}
    
    command="/usr/sbin/daemon"
    command_args="-u ${jellyfin_user} ${jellyfin_install_dir}/jellyfin --ffmpeg=/usr/pkg/bin/ffmpeg ${jellyfin_options}"
    pidfile="${jellyfin_pidfile:-${jellyfin_install_dir}/jellyfin.pid}"
    start_cmd="jellyfin_start"
    stop_cmd="jellyfin_stop"
    status_cmd="jellyfin_status"
    
    jellyfin_start()
    {
        ${command} ${command_args} ${pidfile}
    }
    
    jellyfin_stop()
    {
        pkill -x -u ${jellyfin_user} jellyfin
    }
    
    jellyfin_status()
    {
        status $command
    }
    
    load_rc_config $name
    run_rc_command "$1"
    
  3. Save the service file and exit the editor.

  4. Make the service file executable using the following command:

    chmod +x /etc/rc.d/jellyfin
    
  5. Add the jellyfin service to the system startup by running the following command:

    echo 'jellyfin_enable="YES"' >> /etc/rc.conf
    

    This will start the Jellyfin service automatically every time you boot your system.

Step 5: Start the Jellyfin Service

To start the Jellyfin service, run the following command:

service jellyfin start

You can now access the Jellyfin web interface by entering the server's IP address or domain name in your web browser followed by :8096.

Conclusion

By following these steps, you have successfully installed Jellyfin on your NetBSD server. You can now organize and stream your media files from multiple devices.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!