You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.8 KiB
79 lines
1.8 KiB
#!/usr/bin/env bash
|
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
|
|
|
APP="Ollama"
|
|
var_tags="${var_tags:-ai}"
|
|
var_cpu="${var_cpu:-4}"
|
|
var_ram="${var_ram:-4096}"
|
|
var_disk="${var_disk:-35}"
|
|
var_os="${var_os:-ubuntu}"
|
|
var_version="${var_version:-24.04}"
|
|
var_gpu="${var_gpu:-yes}"
|
|
|
|
# 🔥 YOUR MIRROR
|
|
OLLAMA_MIRROR="https://file.wifibills.com/ollama-linux-amd64.tar.zst"
|
|
|
|
header_info "$APP"
|
|
variables
|
|
color
|
|
catch_errors
|
|
|
|
start
|
|
build_container
|
|
description
|
|
|
|
msg_info "Installing Ollama inside container"
|
|
|
|
pct exec $CTID -- bash -c "
|
|
set -e
|
|
|
|
echo 'Installing dependencies...'
|
|
apt update -qq
|
|
apt install -y curl zstd
|
|
|
|
TMP_TAR=\$(mktemp --suffix=.tar.zst)
|
|
|
|
echo 'Trying mirror download...'
|
|
if curl -fL -o \$TMP_TAR ${OLLAMA_MIRROR}; then
|
|
echo 'Downloaded from mirror'
|
|
else
|
|
echo 'Mirror failed. Trying GitHub...'
|
|
curl -fL -o \$TMP_TAR https://github.com/ollama/ollama/releases/latest/download/ollama-linux-amd64.tar.zst
|
|
fi
|
|
|
|
echo 'Installing Ollama...'
|
|
rm -rf /usr/local/lib/ollama
|
|
rm -f /usr/local/bin/ollama
|
|
|
|
mkdir -p /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 'Creating systemd service...'
|
|
cat <<EOF >/etc/systemd/system/ollama.service
|
|
[Unit]
|
|
Description=Ollama Service
|
|
After=network.target
|
|
|
|
[Service]
|
|
ExecStart=/usr/local/bin/ollama serve
|
|
Restart=always
|
|
User=root
|
|
Group=root
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable ollama
|
|
systemctl start ollama
|
|
|
|
echo 'Ollama installation complete.'
|
|
"
|
|
|
|
msg_ok "Completed successfully!"
|
|
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}:11434${CL}"
|