adding ollama installer

This commit is contained in:
Kenji Morishige
2026-02-23 19:53:49 -06:00
parent 0fc1b3cba0
commit 074ab05908
5 changed files with 358 additions and 0 deletions

View File

@@ -356,3 +356,83 @@ To add manually:
sudo tmutil addexclusion ~/data/raw
sudo tmutil addexclusion ~/models
```
**Ollama Bootstrap & Usage**
- **Bootstrap (macOS)**: Run the macOS installer/check + create model folders:
```bash
bash scripts/bootstrap_ollama_mac.sh
```
- **Bootstrap (Linux)**: Run the Linux helper (attempts to detect package manager and prepares model folders):
```bash
bash scripts/bootstrap_ollama_linux.sh
```
- The scripts create the model directory referenced by the setup script as `OLLAMA_MODELS` (by default `$HOME/models/ollama`).
- Start the Ollama server inside a tmux session (helper functions):
```bash
# Load helper functions (one-liner to source from dotfiles workspace)
source scripts/ollama_tmux.sh
# Start the server in a detached tmux session named 'ollama' (default command):
start_ollama_tmux
# To attach to the session:
tmux attach -t ollama
# To stop the server session:
stop_ollama_tmux
```
- Model management (two simple options):
- Pull a remote model (via the `ollama` CLI):
```bash
# example: pull a model by reference
pull_ollama_model <model-ref>
```
- Import or stage a local model into the $OLLAMA_MODELS path (creates a symlink):
```bash
import_local_model /path/to/local/model-dir-or-file
# The helper will link it into the directory created by setup_enterprise_ai_bash.sh
```
- Scripts referenced:
- [scripts/bootstrap_ollama_mac.sh](scripts/bootstrap_ollama_mac.sh)
- [scripts/bootstrap_ollama_linux.sh](scripts/bootstrap_ollama_linux.sh)
- [scripts/ollama_tmux.sh](scripts/ollama_tmux.sh)
- How to use Ollama from other AI applications:
- Run the server with `start_ollama_tmux` (above). By default the helper uses `ollama serve --host 127.0.0.1 --port 11434`.
- Many client apps can be pointed at the local Ollama HTTP API (default: `http://127.0.0.1:11434`). Check the Ollama docs for exact endpoints and payloads.
- Example using the `ollama` CLI to run a model directly from scripts or other programs:
```bash
# Run a model locally (interactive / CLI). Replace <model> with the model name.
ollama run <model> --prompt "Write a short haiku about trees"
```
- Example (generic) using HTTP from another application (replace endpoint/payload per Ollama docs):
```bash
curl -X POST "http://127.0.0.1:11434/api/generate" \
-H "Content-Type: application/json" \
-d '{"model":"<model>","prompt":"Hello from my app"}'
```
- When integrating from other AI tooling, supply the Ollama host/port (e.g. `OLLAMA_URL=http://127.0.0.1:11434`) or call the `ollama` CLI directly from the application process.
If you want, I can also:
- Make the new scripts executable (`chmod +x`) automatically in the repo
- Attempt to detect the Ollama default model storage path and auto-configure a symlink