From 7d6a20cc5b89553d7b203ecdc162c41829604e15 Mon Sep 17 00:00:00 2001 From: alamin Date: Tue, 10 Feb 2026 17:48:38 +0000 Subject: [PATCH] Add 'ollama.sh' --- ollama.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 ollama.sh diff --git a/ollama.sh b/ollama.sh new file mode 100644 index 0000000..d40c79d --- /dev/null +++ b/ollama.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2026 tteck +# Author: havardthom | Co-Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://ollama.com/ + +APP="Ollama" +var_tags="${var_tags:-ai}" +var_cpu="${var_cpu:-4}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-35}" +var_os="${var_os:-ubuntu}" +var_version="${var_version:-24.04}" +var_gpu="${var_gpu:-yes}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /usr/local/lib/ollama ]]; then + msg_error "No Ollama Installation Found!" + exit + fi + RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}') + if [[ ! -f /opt/Ollama_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/Ollama_version.txt)" ]]; then + if [[ ! -f /opt/Ollama_version.txt ]]; then + touch /opt/Ollama_version.txt + fi + ensure_dependencies zstd + msg_info "Stopping Services" + systemctl stop ollama + msg_ok "Services Stopped" + + TMP_TAR=$(mktemp --suffix=.tar.zst) + msg_info "Downloading Ollama from local mirror" + curl -fL# -o "${TMP_TAR}" "https://file.wifibills.com/ollama-linux-amd64.tar.zst" + msg_info "Installing Ollama ${RELEASE}" + + rm -rf /usr/local/lib/ollama + rm -rf /usr/local/bin/ollama + mkdir -p /usr/local/lib/ollama + tar --zstd -xf "${TMP_TAR}" -C /usr/local/lib/ollama + ln -sf /usr/local/lib/ollama/bin/ollama /usr/local/bin/ollama + rm -f "${TMP_TAR}" + echo "${RELEASE}" >/opt/Ollama_version.txt + msg_ok "Updated Ollama to ${RELEASE}" + + msg_info "Starting Services" + systemctl start ollama + msg_ok "Started Services" + msg_ok "Updated successfully!" + else + msg_ok "No update required. Ollama is already at ${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:11434${CL}"