JELLYFIN - Install Script On Ubuntu 24.4: Difference between revisions

From IT-Arts.net
No edit summary
No edit summary
Line 37: Line 37:
         libcurl4-openssl-dev \
         libcurl4-openssl-dev \
         libmbedtls-dev \
         libmbedtls-dev \
         libssl1.1 \
         libssl-dev \
         libudev-dev
         libudev-dev
}
}
Line 46: Line 46:


     # Jellyfin GPG key
     # Jellyfin GPG key
     curl -fsSL https://repo.jellyfin.org/keys/jellyfin.asc | sudo gpg --dearmor -o /usr/share/keyrings/jellyfin-archive-keyring.gpg
    mkdir -p /etc/apt/keyrings
     curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/jellyfin.gpg


     # Add Jellyfin repo to sources list
     # Add Jellyfin repo to sources list
     echo "deb [signed-by=/usr/share/keyrings/jellyfin-archive-keyring.gpg] https://repo.jellyfin.org/ubuntu/jellyfin main" | sudo tee /etc/apt/sources.list.d/jellyfin.list
     echo "deb [signed-by=/etc/apt/keyrings/jellyfin.gpg] https://repo.jellyfin.org/ubuntu/jellyfin main" | sudo tee /etc/apt/sources.list.d/jellyfin.list


     # Update package list to include Jellyfin repository
     # Update package list to include Jellyfin repository

Revision as of 17:49, 21 December 2025


install_jellyfin.sh

#!/bin/bash

# Exit on any error
set -e

# Function to print messages in green for success
function print_success() {
    echo -e "\033[0;32m$1\033[0m"
}

# Function to print messages in red for errors
function print_error() {
    echo -e "\033[0;31m$1\033[0m"
}

# Function to install dependencies
function install_dependencies() {
    print_success "Installing required dependencies..."

    sudo apt update
    sudo apt upgrade -y
    sudo apt install -y \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg \
        lsb-release \
        ufw \
        software-properties-common \
        ffmpeg \
        libssl-dev \
        libcurl4-openssl-dev \
        libmbedtls-dev \
        libssl-dev \
        libudev-dev
}

# Function to add Jellyfin repository and key
function add_jellyfin_repo() {
    print_success "Adding Jellyfin repository..."

    # Jellyfin GPG key
    mkdir -p /etc/apt/keyrings
    curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/jellyfin.gpg

    # Add Jellyfin repo to sources list
    echo "deb [signed-by=/etc/apt/keyrings/jellyfin.gpg] https://repo.jellyfin.org/ubuntu/jellyfin main" | sudo tee /etc/apt/sources.list.d/jellyfin.list

    # Update package list to include Jellyfin repository
    sudo apt update
}

# Function to install Jellyfin
function install_jellyfin() {
    print_success "Installing Jellyfin..."

    sudo apt install -y jellyfin

    # Enable Jellyfin service to start on boot
    sudo systemctl enable jellyfin
    sudo systemctl start jellyfin
}

# Function to configure firewall (if UFW is enabled)
function configure_firewall() {
    print_success "Configuring firewall (if UFW is enabled)..."

    # Check if UFW is enabled
    if sudo ufw status | grep -q "active"; then
        sudo ufw allow 8096/tcp  # Jellyfin default port
        sudo ufw reload
        print_success "Firewall configured to allow Jellyfin on port 8096."
    else
        print_error "UFW is not enabled. Skipping firewall configuration."
    fi
}

# Function to check Jellyfin status
function check_jellyfin_status() {
    print_success "Checking Jellyfin status..."

    # Check if Jellyfin service is running
    if systemctl is-active --quiet jellyfin; then
        print_success "Jellyfin service is running."
    else
        print_error "Jellyfin service is not running. Please check the logs."
        exit 1
    fi
}

# Main Installation Procedure
function install_jellyfin_server() {
    install_dependencies
    add_jellyfin_repo
    install_jellyfin
    configure_firewall
    check_jellyfin_status

    print_success "Jellyfin installation and setup complete!"
    print_success "Access Jellyfin at http://<Your_Server_IP>:8096"
}

# Run the installation function
install_jellyfin_server


exit 0