Switch Ollama install to .tar.zst and add zstd dependency (#10814)

This commit is contained in:
CanbiZ (MickLesk)
2026-01-14 18:04:13 +01:00
committed by GitHub
parent fa1f2784f9
commit bdfd72e311
4 changed files with 29 additions and 15 deletions

View File

@@ -32,17 +32,22 @@ function update_script() {
if [[ ! -f /opt/Ollama_version.txt ]]; then if [[ ! -f /opt/Ollama_version.txt ]]; then
touch /opt/Ollama_version.txt touch /opt/Ollama_version.txt
fi 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" msg_info "Stopping Services"
systemctl stop ollama systemctl stop ollama
msg_ok "Services Stopped" msg_ok "Services Stopped"
TMP_TAR=$(mktemp --suffix=.tgz) TMP_TAR=$(mktemp --suffix=.tar.zst)
curl -fL# -C - -o "${TMP_TAR}" "https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tgz" 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}" msg_info "Updating Ollama to ${RELEASE}"
rm -rf /usr/local/lib/ollama rm -rf /usr/local/lib/ollama
rm -rf /usr/local/bin/ollama rm -rf /usr/local/bin/ollama
mkdir -p /usr/local/lib/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 ln -sf /usr/local/lib/ollama/bin/ollama /usr/local/bin/ollama
rm -f "${TMP_TAR}" rm -f "${TMP_TAR}"
echo "${RELEASE}" >/opt/Ollama_version.txt echo "${RELEASE}" >/opt/Ollama_version.txt

View File

@@ -92,12 +92,17 @@ EOF
OLLAMA_VERSION=$(ollama -v | awk '{print $NF}') 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)}') 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 [ "$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 "Ollama update available: v$OLLAMA_VERSION -> v$RELEASE"
msg_info "Downloading Ollama v$RELEASE \n" 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" msg_ok "Download Complete"
if [ -f "ollama-linux-amd64.tgz" ]; then if [ -f "ollama-linux-amd64.tar.zst" ]; then
msg_info "Stopping Ollama Service" msg_info "Stopping Ollama Service"
systemctl stop ollama systemctl stop ollama
@@ -106,8 +111,8 @@ EOF
msg_info "Installing Ollama" msg_info "Installing Ollama"
rm -rf /usr/lib/ollama rm -rf /usr/lib/ollama
rm -rf /usr/bin/ollama rm -rf /usr/bin/ollama
tar -C /usr -xzf ollama-linux-amd64.tgz tar --zstd -C /usr -xf ollama-linux-amd64.tar.zst
rm -rf ollama-linux-amd64.tgz rm -rf ollama-linux-amd64.tar.zst
msg_ok "Installed Ollama" msg_ok "Installed Ollama"
msg_info "Starting Ollama Service" msg_info "Starting Ollama Service"

View File

@@ -16,7 +16,8 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt install -y \ $STD apt install -y \
build-essential \ build-essential \
pkg-config pkg-config \
zstd
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Setting up Intel® Repositories" 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" 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.tgz" OLLAMA_URL="https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tar.zst"
TMP_TAR="/tmp/ollama.tgz" TMP_TAR="/tmp/ollama.tar.zst"
echo -e "\n" echo -e "\n"
if curl -fL# -C - -o "$TMP_TAR" "$OLLAMA_URL"; then 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" ln -sf "$OLLAMA_INSTALL_DIR/bin/ollama" "$BINDIR/ollama"
echo "${RELEASE}" >/opt/Ollama_version.txt echo "${RELEASE}" >/opt/Ollama_version.txt
msg_ok "Installed Ollama ${RELEASE}" msg_ok "Installed Ollama ${RELEASE}"

View File

@@ -14,7 +14,9 @@ network_check
update_os update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt install -y ffmpeg $STD apt install -y \
ffmpeg \
zstd
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
setup_hwaccel setup_hwaccel
@@ -69,9 +71,10 @@ EOF
msg_ok "Installed Intel® oneAPI Base Toolkit" msg_ok "Installed Intel® oneAPI Base Toolkit"
msg_info "Installing Ollama" msg_info "Installing Ollama"
curl -fsSLO -C - https://ollama.com/download/ollama-linux-amd64.tgz OLLAMA_RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}')
tar -C /usr -xzf ollama-linux-amd64.tgz curl -fsSLO -C - https://github.com/ollama/ollama/releases/download/${OLLAMA_RELEASE}/ollama-linux-amd64.tar.zst
rm -rf ollama-linux-amd64.tgz tar --zstd -C /usr -xf ollama-linux-amd64.tar.zst
rm -rf ollama-linux-amd64.tar.zst
cat <<EOF >/etc/systemd/system/ollama.service cat <<EOF >/etc/systemd/system/ollama.service
[Unit] [Unit]
Description=Ollama Service Description=Ollama Service