Created
December 23, 2025 19:41
-
-
Save ucalyptus/91f6db619c2e518cffaab17a612ae98f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Ollama installation script for environments without sudo access | |
| # Uses only /tmp/ directory | |
| set -eu | |
| status() { echo ">>> $*" >&2; } | |
| error() { echo "ERROR: $*"; exit 1; } | |
| TEMP_DIR=$(mktemp -d) | |
| cleanup() { rm -rf $TEMP_DIR; } | |
| trap cleanup EXIT | |
| available() { command -v $1 >/dev/null; } | |
| [ "$(uname -s)" = "Linux" ] || error 'This script is intended to run on Linux only.' | |
| ARCH=$(uname -m) | |
| case "$ARCH" in | |
| x86_64) ARCH="amd64" ;; | |
| aarch64|arm64) ARCH="arm64" ;; | |
| *) error "Unsupported architecture: $ARCH" ;; | |
| esac | |
| NEEDS="" | |
| for TOOL in curl tar; do | |
| if ! available $TOOL; then | |
| NEEDS="$NEEDS $TOOL" | |
| fi | |
| done | |
| if [ -n "$NEEDS" ]; then | |
| error "Missing required tools:$NEEDS" | |
| fi | |
| VER_PARAM="${OLLAMA_VERSION:+?version=$OLLAMA_VERSION}" | |
| INSTALL_DIR="/tmp/ollama" | |
| mkdir -p "$INSTALL_DIR" | |
| status "Installing ollama to $INSTALL_DIR" | |
| status "Downloading Linux ${ARCH} bundle" | |
| curl --fail --show-error --location --progress-bar \ | |
| "https://ollama.com/download/ollama-linux-${ARCH}.tgz${VER_PARAM}" | \ | |
| tar -xzf - -C "$INSTALL_DIR" | |
| status "Installation complete!" | |
| status "To use ollama, run: $INSTALL_DIR/bin/ollama" | |
| status "To start the server: $INSTALL_DIR/bin/ollama serve &" | |
| status "" | |
| status "Add to PATH: export PATH=\$PATH:$INSTALL_DIR/bin" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment