mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-03 20:03:25 +01:00
Switch Ollama install to .tar.zst and add zstd dependency (#10814)
This commit is contained in:
committed by
GitHub
parent
fa1f2784f9
commit
bdfd72e311
11
ct/ollama.sh
11
ct/ollama.sh
@@ -32,17 +32,22 @@ function update_script() {
|
||||
if [[ ! -f /opt/Ollama_version.txt ]]; then
|
||||
touch /opt/Ollama_version.txt
|
||||
fi
|
||||
if ! command -v zstd &>/dev/null; then
|
||||
msg_info "Installing zstd"
|
||||
$STD apt install -y zstd
|
||||
msg_ok "Installed zstd"
|
||||
fi
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop ollama
|
||||
msg_ok "Services Stopped"
|
||||
|
||||
TMP_TAR=$(mktemp --suffix=.tgz)
|
||||
curl -fL# -C - -o "${TMP_TAR}" "https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tgz"
|
||||
TMP_TAR=$(mktemp --suffix=.tar.zst)
|
||||
curl -fL# -C - -o "${TMP_TAR}" "https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tar.zst"
|
||||
msg_info "Updating Ollama to ${RELEASE}"
|
||||
rm -rf /usr/local/lib/ollama
|
||||
rm -rf /usr/local/bin/ollama
|
||||
mkdir -p /usr/local/lib/ollama
|
||||
tar -xzf "${TMP_TAR}" -C /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
|
||||
|
||||
@@ -92,12 +92,17 @@ EOF
|
||||
OLLAMA_VERSION=$(ollama -v | awk '{print $NF}')
|
||||
RELEASE=$(curl -s https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
|
||||
if [ "$OLLAMA_VERSION" != "$RELEASE" ]; then
|
||||
if ! command -v zstd &>/dev/null; then
|
||||
msg_info "Installing zstd"
|
||||
$STD apt install -y zstd
|
||||
msg_ok "Installed zstd"
|
||||
fi
|
||||
msg_info "Ollama update available: v$OLLAMA_VERSION -> v$RELEASE"
|
||||
msg_info "Downloading Ollama v$RELEASE \n"
|
||||
curl -fS#LO https://ollama.com/download/ollama-linux-amd64.tgz
|
||||
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.tgz" ]; then
|
||||
if [ -f "ollama-linux-amd64.tar.zst" ]; then
|
||||
|
||||
msg_info "Stopping Ollama Service"
|
||||
systemctl stop ollama
|
||||
@@ -106,8 +111,8 @@ EOF
|
||||
msg_info "Installing Ollama"
|
||||
rm -rf /usr/lib/ollama
|
||||
rm -rf /usr/bin/ollama
|
||||
tar -C /usr -xzf ollama-linux-amd64.tgz
|
||||
rm -rf ollama-linux-amd64.tgz
|
||||
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"
|
||||
|
||||
@@ -16,7 +16,8 @@ update_os
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
build-essential \
|
||||
pkg-config
|
||||
pkg-config \
|
||||
zstd
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up Intel® Repositories"
|
||||
@@ -67,11 +68,11 @@ RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest
|
||||
OLLAMA_INSTALL_DIR="/usr/local/lib/ollama"
|
||||
BINDIR="/usr/local/bin"
|
||||
mkdir -p $OLLAMA_INSTALL_DIR
|
||||
OLLAMA_URL="https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tgz"
|
||||
TMP_TAR="/tmp/ollama.tgz"
|
||||
OLLAMA_URL="https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tar.zst"
|
||||
TMP_TAR="/tmp/ollama.tar.zst"
|
||||
echo -e "\n"
|
||||
if curl -fL# -C - -o "$TMP_TAR" "$OLLAMA_URL"; then
|
||||
if tar -xzf "$TMP_TAR" -C "$OLLAMA_INSTALL_DIR"; 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}"
|
||||
|
||||
@@ -14,7 +14,9 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y ffmpeg
|
||||
$STD apt install -y \
|
||||
ffmpeg \
|
||||
zstd
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
setup_hwaccel
|
||||
@@ -69,9 +71,10 @@ EOF
|
||||
msg_ok "Installed Intel® oneAPI Base Toolkit"
|
||||
|
||||
msg_info "Installing Ollama"
|
||||
curl -fsSLO -C - https://ollama.com/download/ollama-linux-amd64.tgz
|
||||
tar -C /usr -xzf ollama-linux-amd64.tgz
|
||||
rm -rf ollama-linux-amd64.tgz
|
||||
OLLAMA_RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}')
|
||||
curl -fsSLO -C - https://github.com/ollama/ollama/releases/download/${OLLAMA_RELEASE}/ollama-linux-amd64.tar.zst
|
||||
tar --zstd -C /usr -xf ollama-linux-amd64.tar.zst
|
||||
rm -rf ollama-linux-amd64.tar.zst
|
||||
cat <<EOF >/etc/systemd/system/ollama.service
|
||||
[Unit]
|
||||
Description=Ollama Service
|
||||
|
||||
Reference in New Issue
Block a user