mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-09-13 07:10:51 +02:00
Refactor: Ollama & Adding to Website (#4147)
* Refactor: Ollama & Adding to Website * VED -> VE * Update ollama.sh * Update ollama-install.sh * Update ollama.sh
This commit is contained in:
54
ct/ollama.sh
54
ct/ollama.sh
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 tteck
|
||||
# Author: tteck | Co-Author: havardthom
|
||||
# Author: havardthom | Co-Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://ollama.com/
|
||||
|
||||
@@ -9,9 +9,9 @@ APP="Ollama"
|
||||
var_tags="${var_tags:-ai}"
|
||||
var_cpu="${var_cpu:-4}"
|
||||
var_ram="${var_ram:-4096}"
|
||||
var_disk="${var_disk:-24}"
|
||||
var_disk="${var_disk:-35}"
|
||||
var_os="${var_os:-ubuntu}"
|
||||
var_version="${var_version:-22.04}"
|
||||
var_version="${var_version:-24.04}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
@@ -19,18 +19,42 @@ color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/ollama ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Updating ${APP}"
|
||||
$STD apt-get update
|
||||
$STD apt-get -y upgrade
|
||||
msg_ok "Updated Successfully"
|
||||
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
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop ollama
|
||||
msg_ok "Services Stopped"
|
||||
|
||||
TMP_TAR=$(mktemp --suffix=.tgz)
|
||||
curl -fL# -o "${TMP_TAR}" "https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tgz"
|
||||
msg_info "Updating Ollama to ${RELEASE}"
|
||||
tar -xzf "${TMP_TAR}" -C /usr/local/lib/ollama
|
||||
ln -sf /usr/local/lib/ollama/bin/ollama /usr/local/bin/ollama
|
||||
echo "${RELEASE}" >/opt/Ollama_version.txt
|
||||
msg_ok "Updated Ollama to ${RELEASE}"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start ollama
|
||||
msg_ok "Started Services"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -f "${TMP_TAR}"
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. Ollama is already at ${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
@@ -40,4 +64,4 @@ 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}:14434${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:11434${CL}"
|
||||
|
||||
Reference in New Issue
Block a user