Skip to content

Commit

Permalink
ollama install
Browse files Browse the repository at this point in the history
  • Loading branch information
fortes committed Sep 26, 2024
1 parent ed28c15 commit 0189939
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
34 changes: 34 additions & 0 deletions scripts/install_ollama
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Install Ollama
#
# Usage: install_ollama

set -euo pipefail
IFS=$'\n\t'
export DEBIAN_FRONTEND=noninteractive

main() {
local install_location="$HOME/.local/bin/ollama"
local download_dir
download_dir="$(mktemp -d -t ollama-XXXX)"

if [[ ! -x "${install_location}" ]]; then
echo "Installing Ollama..."
pushd "${download_dir}" > /dev/null
wget --quiet -O "ollama-linux-amd64.tgz" \
"https://ollama.com/download/ollama-linux-amd64.tgz"
tar -C "$HOME/.local" -xzf "ollama-linux-amd64.tgz" > /dev/null
popd > /dev/null
fi

echo "Ollama installed, starting service"
systemctl --user start ollama

# Still need to download models, e.g. `ollama run llama3`
#
# Can also hook up via `llm` by first `llm install llm-ollama`
}

main


12 changes: 12 additions & 0 deletions stowed-files/ollama/.config/systemd/user/ollama.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/home/fortes/.local/bin/ollama serve
Restart=always
RestartSec=3
Environment="PATH=/home/fortes/.local/bin:${PATH}"

[Install]
WantedBy=default.target

0 comments on commit 0189939

Please sign in to comment.