ollama refactor
This commit is contained in:
parent
bb7945c44e
commit
5adff26cc6
33
ct/ollama.sh
33
ct/ollama.sh
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||||
# Copyright (c) 2021-2025 tteck
|
# 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
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# Source: https://ollama.com/
|
# Source: https://ollama.com/
|
||||||
|
|
||||||
@ -22,14 +22,35 @@ function update_script() {
|
|||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -d /opt/ollama ]]; then
|
if [[ ! -d /usr/local/lib/ollama ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No Ollama Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
msg_info "Updating ${APP}"
|
RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}')
|
||||||
$STD apt-get update
|
if [[ ! -f /opt/Ollama_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/Ollama_version.txt)" ]]; then
|
||||||
$STD apt-get -y upgrade
|
msg_info "Stopping Services"
|
||||||
|
systemctl stop ollama
|
||||||
|
msg_ok "Services Stopped"
|
||||||
|
|
||||||
|
msg_info "Updating Ollama to ${RELEASE}"
|
||||||
|
TMP_TAR=$(mktemp --suffix=.tgz)
|
||||||
|
curl -fL# -o "${TMP_TAR}" "https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tgz"
|
||||||
|
tar -xzf "${TMP_TAR}" -C /usr/local/lib/ollama
|
||||||
|
ln -sf /usr/local/lib/ollama/ollama /usr/local/bin/ollama
|
||||||
|
echo "${RELEASE}" >/opt/Ollama_version.txt
|
||||||
|
msg_ok "Updated Ollama"
|
||||||
|
|
||||||
|
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"
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. Ollama is already at ${RELEASE}"
|
||||||
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 tteck
|
# Copyright (c) 2021-2025 tteck
|
||||||
# Author: tteck
|
# Author: havardthom | Co-Author: MickLesk (CanbiZ)
|
||||||
# Co-Author: havardthom
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# Source: https://ollama.com/
|
# Source: https://ollama.com/
|
||||||
|
|
||||||
@ -16,22 +15,10 @@ update_os
|
|||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y \
|
$STD apt-get install -y \
|
||||||
gpg \
|
|
||||||
build-essential \
|
build-essential \
|
||||||
pkg-config
|
pkg-config
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
# msg_info "Installing Golang"
|
|
||||||
# set +o pipefail
|
|
||||||
# temp_file=$(mktemp)
|
|
||||||
# golang_tarball=$(curl -fsSL https://go.dev/dl/ | grep -oP 'go[\d\.]+\.linux-amd64\.tar\.gz' | head -n 1)
|
|
||||||
# curl -fsSL "https://golang.org/dl/${golang_tarball}" -o "$temp_file"
|
|
||||||
# tar -C /usr/local -xzf "$temp_file"
|
|
||||||
# ln -sf /usr/local/go/bin/go /usr/local/bin/go
|
|
||||||
# rm -f "$temp_file"
|
|
||||||
# set -o pipefail
|
|
||||||
# msg_ok "Installed Golang"
|
|
||||||
|
|
||||||
msg_info "Setting up Intel® Repositories"
|
msg_info "Setting up Intel® Repositories"
|
||||||
mkdir -p /etc/apt/keyrings
|
mkdir -p /etc/apt/keyrings
|
||||||
curl -fsSL https://repositories.intel.com/gpu/intel-graphics.key | gpg --dearmor -o /etc/apt/keyrings/intel-graphics.gpg
|
curl -fsSL https://repositories.intel.com/gpu/intel-graphics.key | gpg --dearmor -o /etc/apt/keyrings/intel-graphics.gpg
|
||||||
@ -57,19 +44,26 @@ $STD apt-get 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)"
|
||||||
ARCH=$(uname -m)
|
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
|
||||||
curl --fail --show-error --location --progress-bar \
|
OLLAMA_URL="https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tgz"
|
||||||
"https://ollama.com/download/ollama-linux-${ARCH}.tgz${OLLAMA_VERSION:+?version=$OLLAMA_VERSION}" |
|
TMP_TAR="/tmp/ollama.tgz"
|
||||||
tar -xzf - -C "$OLLAMA_INSTALL_DIR"
|
if curl -fL# -o "$TMP_TAR" "$OLLAMA_URL"; then
|
||||||
ln -sf "$OLLAMA_INSTALL_DIR/ollama" "$BINDIR/ollama"
|
echo -e "\nExtracting...\n"
|
||||||
#$STD git clone https://github.com/ollama/ollama.git /opt/ollama
|
if tar -xzf "$TMP_TAR" -C "$OLLAMA_INSTALL_DIR"; then
|
||||||
#cd /opt/ollama
|
ln -sf "$OLLAMA_INSTALL_DIR/ollama" "$BINDIR/ollama"
|
||||||
#$STD go generate ./...
|
echo "${RELEASE}" >/opt/Ollama_version.txt
|
||||||
#$STD go build .
|
msg_ok "Installed Ollama ${RELEASE}"
|
||||||
msg_ok "Installed Ollama"
|
else
|
||||||
|
msg_error "Extraction failed – archive corrupt or incomplete"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
msg_error "Download failed – $OLLAMA_URL not reachable"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user