Files
ProxmoxVE/install/openwebui-install.sh
T

153 lines
4.7 KiB
Bash
Raw Normal View History

2024-10-22 18:39:54 +02:00
#!/usr/bin/env bash
# Copyright (c) 2021-2026 tteck
2025-11-05 14:20:33 +01:00
# Author: tteck | Co-Author: havardthom | Co-Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://openwebui.com/
2024-10-22 18:39:54 +02:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
2024-10-22 18:39:54 +02:00
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
ffmpeg \
zstd \
build-essential \
libmariadb-dev
2024-10-22 18:39:54 +02:00
msg_ok "Installed Dependencies"
setup_hwaccel
2026-02-13 11:26:19 +01:00
PYTHON_VERSION="3.12" setup_uv
OTEL_ARGS=()
read -r -p "${TAB3}Would you like to install OpenTelemetry instrumentation packages (requires manual .env configuration)? <y/N> " prompt
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
for pkg in \
opentelemetry-api \
opentelemetry-sdk \
opentelemetry-exporter-otlp \
opentelemetry-exporter-otlp-proto-http \
opentelemetry-instrumentation-fastapi \
opentelemetry-instrumentation-aiohttp-client \
opentelemetry-instrumentation-httpx \
opentelemetry-instrumentation-sqlalchemy \
opentelemetry-instrumentation-requests \
opentelemetry-instrumentation-logging \
opentelemetry-instrumentation-redis \
opentelemetry-instrumentation-system-metrics; do
OTEL_ARGS+=(--with "$pkg")
done
fi
msg_info "Installing Open WebUI"
export UV_HTTP_TIMEOUT=300
for attempt in $(seq 1 3); do
$STD uv tool install --python 3.12 --constraint <(echo "numba>=0.60") "${OTEL_ARGS[@]}" open-webui[all] && break
[[ $attempt -lt 3 ]] && msg_warn "Open WebUI install attempt $attempt failed, retrying..." && sleep 10
done
msg_ok "Installed Open WebUI"
2024-10-22 18:39:54 +02:00
2025-05-15 11:13:57 +02:00
read -r -p "${TAB3}Would you like to add Ollama? <y/N> " prompt
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
if [[ "$(arch_resolve)" == "amd64" ]]; then
msg_info "Setting up Intel® Repositories"
mkdir -p /usr/share/keyrings
curl -fsSL https://repositories.intel.com/gpu/intel-graphics.key | gpg --dearmor -o /usr/share/keyrings/intel-graphics.gpg 2>/dev/null || true
cat <<EOF >/etc/apt/sources.list.d/intel-gpu.sources
Types: deb
URIs: https://repositories.intel.com/gpu/ubuntu
Suites: jammy
Components: client
Architectures: amd64 i386
Signed-By: /usr/share/keyrings/intel-graphics.gpg
EOF
curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor -o /usr/share/keyrings/oneapi-archive-keyring.gpg 2>/dev/null || true
cat <<EOF >/etc/apt/sources.list.d/oneAPI.sources
Types: deb
URIs: https://apt.repos.intel.com/oneapi
Suites: all
Components: main
Signed-By: /usr/share/keyrings/oneapi-archive-keyring.gpg
EOF
$STD apt update
msg_ok "Set up Intel® Repositories"
msg_info "Installing Intel® Level Zero"
# Debian 13+ has newer Level Zero packages in system repos that conflict with Intel repo packages
if is_debian && [[ "$(get_os_version_major)" -ge 13 ]]; then
# Use system packages on Debian 13+ (avoid conflicts with libze1)
$STD apt -y install libze1 libze-dev intel-level-zero-gpu 2>/dev/null || {
msg_warn "Failed to install some Level Zero packages, continuing anyway"
}
else
# Use Intel repository packages for older systems
$STD apt -y install intel-level-zero-gpu level-zero level-zero-dev 2>/dev/null || {
msg_warn "Failed to install Intel Level Zero packages, continuing anyway"
}
fi
msg_ok "Installed Intel® Level Zero"
msg_info "Installing Intel® oneAPI Base Toolkit (Patience)"
$STD apt install -y --no-install-recommends intel-basekit-2024.1 2>/dev/null || true
msg_ok "Installed Intel® oneAPI Base Toolkit"
fi
msg_info "Installing Ollama"
if ! fetch_and_deploy_gh_release "ollama-com" "ollama/ollama" "prebuild" "latest" "/usr/lib/ollama" "ollama-linux-$(arch_resolve).tar.zst"; then
msg_error "Failed to download or deploy Ollama check network connectivity and GitHub API availability"
else
ln -sf /usr/lib/ollama/bin/ollama /usr/bin/ollama
cat <<EOF >/etc/systemd/system/ollama.service
[Unit]
Description=Ollama Service
After=network-online.target
[Service]
Type=exec
ExecStart=/usr/bin/ollama serve
Environment=HOME=$HOME
Environment=OLLAMA_HOST=0.0.0.0
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now ollama
echo "ENABLE_OLLAMA_API=true" >/root/.env
msg_ok "Installed Ollama"
fi
fi
2024-10-22 18:39:54 +02:00
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/open-webui.service
[Unit]
Description=Open WebUI Service
After=network.target
[Service]
2025-11-05 14:20:33 +01:00
Type=simple
EnvironmentFile=-/root/.env
Environment=DATA_DIR=/root/.open-webui
ExecStart=/root/.local/bin/open-webui serve
2025-11-05 14:20:33 +01:00
WorkingDirectory=/root
Restart=on-failure
RestartSec=5
User=root
2024-10-22 18:39:54 +02:00
[Install]
WantedBy=multi-user.target
EOF
2025-04-01 20:22:40 +02:00
systemctl enable -q --now open-webui
2024-10-22 18:39:54 +02:00
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc