mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-24 01:14:58 +02:00
Compare commits
1 Commits
node_js_ve
...
refactor/o
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdb0f484df |
28
ct/ollama.sh
28
ct/ollama.sh
@@ -27,34 +27,26 @@ function update_script() {
|
|||||||
msg_error "No Ollama Installation Found!"
|
msg_error "No Ollama Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}')
|
if check_for_gh_release "ollama" "ollama/ollama"; then
|
||||||
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
|
ensure_dependencies zstd
|
||||||
msg_info "Stopping Services"
|
msg_info "Stopping Services"
|
||||||
systemctl stop ollama
|
systemctl stop ollama
|
||||||
msg_ok "Services Stopped"
|
msg_ok "Services Stopped"
|
||||||
|
|
||||||
TMP_TAR=$(mktemp --suffix=.tar.zst)
|
OLLAMA_INSTALL_DIR="/usr/local/lib/ollama"
|
||||||
curl -fL# -C - -o "${TMP_TAR}" "https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tar.zst"
|
rm -rf "$OLLAMA_INSTALL_DIR" /usr/local/bin/ollama
|
||||||
msg_info "Updating Ollama to ${RELEASE}"
|
mkdir -p "$OLLAMA_INSTALL_DIR"
|
||||||
rm -rf /usr/local/lib/ollama
|
if ! fetch_and_deploy_gh_release "ollama" "ollama/ollama" "prebuild" "latest" "$OLLAMA_INSTALL_DIR" "ollama-linux-amd64.tar.zst"; then
|
||||||
rm -rf /usr/local/bin/ollama
|
msg_error "Download or deployment failed – check network connectivity and GitHub API availability"
|
||||||
mkdir -p /usr/local/lib/ollama
|
exit 250
|
||||||
tar --zstd -xf "${TMP_TAR}" -C /usr/local/lib/ollama
|
fi
|
||||||
ln -sf /usr/local/lib/ollama/bin/ollama /usr/local/bin/ollama
|
ln -sf "$OLLAMA_INSTALL_DIR/bin/ollama" /usr/local/bin/ollama
|
||||||
rm -f "${TMP_TAR}"
|
msg_ok "Updated Ollama"
|
||||||
echo "${RELEASE}" >/opt/Ollama_version.txt
|
|
||||||
msg_ok "Updated Ollama to ${RELEASE}"
|
|
||||||
|
|
||||||
msg_info "Starting Services"
|
msg_info "Starting Services"
|
||||||
systemctl start ollama
|
systemctl start ollama
|
||||||
msg_ok "Started Services"
|
msg_ok "Started Services"
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated successfully!"
|
||||||
else
|
|
||||||
msg_ok "No update required. Ollama is already at ${RELEASE}"
|
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,37 +91,22 @@ EOF
|
|||||||
|
|
||||||
if [ -x "/usr/bin/ollama" ]; then
|
if [ -x "/usr/bin/ollama" ]; then
|
||||||
msg_info "Checking for Ollama Update"
|
msg_info "Checking for Ollama Update"
|
||||||
OLLAMA_VERSION=$(ollama -v | awk '{print $NF}')
|
if check_for_gh_release "ollama" "ollama/ollama"; then
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
|
msg_info "Stopping Ollama Service"
|
||||||
if [ "$OLLAMA_VERSION" != "$RELEASE" ]; then
|
systemctl stop ollama
|
||||||
msg_info "Ollama update available: v$OLLAMA_VERSION -> v$RELEASE"
|
msg_ok "Stopped Service"
|
||||||
msg_info "Downloading Ollama v$RELEASE \n"
|
|
||||||
curl -fS#LO https://github.com/ollama/ollama/releases/download/v${RELEASE}/ollama-linux-amd64.tar.zst
|
|
||||||
msg_ok "Download Complete"
|
|
||||||
|
|
||||||
if [ -f "ollama-linux-amd64.tar.zst" ]; then
|
rm -rf /usr/lib/ollama /usr/bin/ollama
|
||||||
|
if ! fetch_and_deploy_gh_release "ollama" "ollama/ollama" "prebuild" "latest" "/usr/lib/ollama" "ollama-linux-amd64.tar.zst"; then
|
||||||
msg_info "Stopping Ollama Service"
|
msg_error "Ollama download or deployment failed – check network connectivity and GitHub API availability"
|
||||||
systemctl stop ollama
|
|
||||||
msg_ok "Stopped Service"
|
|
||||||
|
|
||||||
msg_info "Installing Ollama"
|
|
||||||
rm -rf /usr/lib/ollama
|
|
||||||
rm -rf /usr/bin/ollama
|
|
||||||
tar --zstd -C /usr -xf ollama-linux-amd64.tar.zst
|
|
||||||
rm -rf ollama-linux-amd64.tar.zst
|
|
||||||
msg_ok "Installed Ollama"
|
|
||||||
|
|
||||||
msg_info "Starting Ollama Service"
|
|
||||||
systemctl start ollama
|
|
||||||
msg_ok "Started Service"
|
|
||||||
|
|
||||||
msg_ok "Ollama updated to version $RELEASE"
|
|
||||||
else
|
else
|
||||||
msg_error "Ollama download failed. Aborting update."
|
ln -sf /usr/lib/ollama/bin/ollama /usr/bin/ollama
|
||||||
|
msg_ok "Updated Ollama to ${CHECK_UPDATE_RELEASE}"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
msg_ok "Ollama is already up to date."
|
msg_info "Starting Ollama Service"
|
||||||
|
systemctl start ollama
|
||||||
|
msg_ok "Started Service"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -62,26 +62,15 @@ $STD apt install -y --no-install-recommends intel-basekit-2024.1
|
|||||||
msg_ok "Installed Intel® oneAPI Base Toolkit"
|
msg_ok "Installed Intel® oneAPI Base Toolkit"
|
||||||
|
|
||||||
msg_info "Installing Ollama (Patience)"
|
msg_info "Installing Ollama (Patience)"
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}')
|
|
||||||
OLLAMA_INSTALL_DIR="/usr/local/lib/ollama"
|
OLLAMA_INSTALL_DIR="/usr/local/lib/ollama"
|
||||||
BINDIR="/usr/local/bin"
|
BINDIR="/usr/local/bin"
|
||||||
mkdir -p $OLLAMA_INSTALL_DIR
|
mkdir -p "$OLLAMA_INSTALL_DIR"
|
||||||
OLLAMA_URL="https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tar.zst"
|
if ! fetch_and_deploy_gh_release "ollama" "ollama/ollama" "prebuild" "latest" "$OLLAMA_INSTALL_DIR" "ollama-linux-amd64.tar.zst"; then
|
||||||
TMP_TAR="/tmp/ollama.tar.zst"
|
msg_error "Failed to download or deploy Ollama – check network connectivity and GitHub API availability"
|
||||||
echo -e "\n"
|
|
||||||
if curl -fL# -C - -o "$TMP_TAR" "$OLLAMA_URL"; then
|
|
||||||
if tar --zstd -xf "$TMP_TAR" -C "$OLLAMA_INSTALL_DIR"; then
|
|
||||||
ln -sf "$OLLAMA_INSTALL_DIR/bin/ollama" "$BINDIR/ollama"
|
|
||||||
echo "${RELEASE}" >/opt/Ollama_version.txt
|
|
||||||
msg_ok "Installed Ollama ${RELEASE}"
|
|
||||||
else
|
|
||||||
msg_error "Extraction failed – archive corrupt or incomplete"
|
|
||||||
exit 251
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
msg_error "Download failed – $OLLAMA_URL not reachable"
|
|
||||||
exit 250
|
exit 250
|
||||||
fi
|
fi
|
||||||
|
ln -sf "$OLLAMA_INSTALL_DIR/bin/ollama" "$BINDIR/ollama"
|
||||||
|
msg_ok "Installed Ollama"
|
||||||
|
|
||||||
msg_info "Creating ollama User and Group"
|
msg_info "Creating ollama User and Group"
|
||||||
if ! id ollama >/dev/null 2>&1; then
|
if ! id ollama >/dev/null 2>&1; then
|
||||||
|
|||||||
@@ -73,11 +73,11 @@ EOF
|
|||||||
msg_ok "Installed Intel® oneAPI Base Toolkit"
|
msg_ok "Installed Intel® oneAPI Base Toolkit"
|
||||||
|
|
||||||
msg_info "Installing Ollama"
|
msg_info "Installing Ollama"
|
||||||
OLLAMA_RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}')
|
if ! fetch_and_deploy_gh_release "ollama" "ollama/ollama" "prebuild" "latest" "/usr/lib/ollama" "ollama-linux-amd64.tar.zst"; then
|
||||||
curl -fsSLO -C - https://github.com/ollama/ollama/releases/download/${OLLAMA_RELEASE}/ollama-linux-amd64.tar.zst
|
msg_error "Failed to download or deploy Ollama – check network connectivity and GitHub API availability"
|
||||||
tar --zstd -C /usr -xf ollama-linux-amd64.tar.zst
|
else
|
||||||
rm -rf ollama-linux-amd64.tar.zst
|
ln -sf /usr/lib/ollama/bin/ollama /usr/bin/ollama
|
||||||
cat <<EOF >/etc/systemd/system/ollama.service
|
cat <<EOF >/etc/systemd/system/ollama.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Ollama Service
|
Description=Ollama Service
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
@@ -93,9 +93,10 @@ RestartSec=3
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now ollama
|
systemctl enable -q --now ollama
|
||||||
echo "ENABLE_OLLAMA_API=true" >/root/.env
|
echo "ENABLE_OLLAMA_API=true" >/root/.env
|
||||||
msg_ok "Installed Ollama"
|
msg_ok "Installed Ollama"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
|
|||||||
Reference in New Issue
Block a user