当前位置: 首页 > Skill >

Ubuntu Ollama

Ubuntu Ollama

Ubuntu Ollama

在 Ubuntu 上运行 Ollama,支持跨多台 Ubuntu 机器的 fleet 路由。使用 apt、systemd 与 NVIDIA CUDA 完成 Ubuntu Ollama 的安装与配置,实现 Ollama路由。

1.0.0 2026.11.20 404
获取Skill文件查看使用说明
作 者:江知 许可证: 更新时间:2026.11.20
本文目录展开

Ubuntu Ollama — Fleet Routing for Ollama on Ubuntu

Run Ollama on Ubuntu with multi-machine load balancing. Ubuntu Ollama Herd turns your Ubuntu servers and desktops into one smart Ollama endpoint. Install with apt + pip, manage with systemd, monitor with the web dashboard.

Ubuntu Ollama setup

Step 1: Install Ollama on Ubuntu

# Install Ollama on Ubuntu
curl -fsSL https://ollama.ai/install.sh | sh

# Verify Ollama is running on Ubuntu
ollama --version
systemctl status ollama

Step 2: Install Ubuntu Ollama Herd

# Ubuntu prerequisites
sudo apt update && sudo apt install python3-pip curl -y

# Install Ubuntu Ollama fleet router
pip install ollama-herd

Step 3: Start Ubuntu Ollama router

On one Ubuntu machine (the router):

herd          # start Ubuntu Ollama router on port 11435
herd-node     # register this Ubuntu Ollama node

On every other Ubuntu machine:

herd-node     # auto-discovers the Ubuntu Ollama router via mDNS

No mDNS? Connect Ubuntu Ollama nodes directly: herd-node --router-url http://router-ip:11435

Step 4: Verify Ubuntu Ollama fleet

curl -s http://localhost:11435/fleet/status | python3 -m json.tool

Ubuntu Ollama systemd services

Run Ubuntu Ollama as systemd services for automatic startup:

# Ubuntu Ollama router service
sudo tee /etc/systemd/system/herd-router.service << 'EOF'
[Unit]
Description=Ubuntu Ollama Router
After=network.target ollama.service

[Service]
Type=simple
ExecStart=/usr/local/bin/herd
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

# Ubuntu Ollama node service
sudo tee /etc/systemd/system/herd-node.service << 'EOF'
[Unit]
Description=Ubuntu Ollama Node
After=network.target ollama.service

[Service]
Type=simple
ExecStart=/usr/local/bin/herd-node
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl enable --now herd-router
sudo systemctl enable --now herd-node

Use Ubuntu Ollama

OpenAI SDK

from openai import OpenAI

# Your Ubuntu Ollama fleet
client = OpenAI(base_url="http://localhost:11435/v1", api_key="not-needed")

response = client.chat.completions.create(
    model="llama3.3:70b",
    messages=[{"role": "user", "content": "Write an Ubuntu cron job for log rotation"}],
    stream=True,
)
for chunk in response:
    print(chunk.choices[0].delta.content or "", end="")

curl (Ollama format)

# Ubuntu Ollama inference
curl http://localhost:11435/api/chat -d '{
  "model": "qwen3.5:32b",
  "messages": [{"role": "user", "content": "Explain Ubuntu apt package management"}],
  "stream": false
}'

curl (OpenAI format)

curl http://localhost:11435/v1/chat/completions 
  -H "Content-Type: application/json" 
  -d '{"model": "phi4", "messages": [{"role": "user", "content": "Hello from Ubuntu Ollama"}]}'

Ubuntu Ollama NVIDIA CUDA setup

# Install NVIDIA drivers on Ubuntu for Ollama CUDA
sudo apt install nvidia-driver-550 -y
sudo reboot

# Verify Ubuntu NVIDIA CUDA
nvidia-smi

# Ubuntu Ollama automatically uses CUDA when NVIDIA drivers are installed
ollama ps    # should show GPU acceleration

Ubuntu Ollama environment

# Optimize Ollama on Ubuntu via systemd
sudo systemctl edit ollama
# Add under [Service]:
#   Environment="OLLAMA_KEEP_ALIVE=-1"
#   Environment="OLLAMA_MAX_LOADED_MODELS=-1"
#   Environment="OLLAMA_NUM_PARALLEL=2"
sudo systemctl restart ollama

# Verify Ubuntu Ollama settings
systemctl show ollama | grep Environment

Ubuntu Ollama model recommendations

Ubuntu Machine GPU Best Ubuntu Ollama models
Ubuntu desktop (RTX 4090) 24GB llama3.3:70b, qwen3.5:32b, deepseek-r1:32b
Ubuntu desktop (RTX 4080) 16GB phi4, codestral, qwen3.5:14b
Ubuntu Server (A100) 80GB deepseek-v3, qwen3.5:72b
Ubuntu Server (no GPU) CPU phi4-mini, gemma3:4b
Ubuntu on Raspberry Pi 5 CPU gemma3:1b, phi4-mini

Ubuntu Ollama firewall

# Ubuntu UFW
sudo ufw allow 11435/tcp
sudo ufw reload

Monitor Ubuntu Ollama

# Ubuntu Ollama fleet status
curl -s http://localhost:11435/fleet/status | python3 -m json.tool

# Ubuntu Ollama health — 15 automated checks
curl -s http://localhost:11435/dashboard/api/health | python3 -m json.tool

# Ubuntu Ollama models loaded
curl -s http://localhost:11435/api/ps | python3 -m json.tool

# Ubuntu Ollama logs
journalctl -u herd-router -f
tail -f ~/.fleet-manager/logs/herd.jsonl.$(date +%Y-%m-%d)

Dashboard at http://localhost:11435/dashboard — live Ubuntu Ollama monitoring.

Also available on Ubuntu Ollama

Image generation

curl http://localhost:11435/api/generate-image 
  -d '{"model": "z-image-turbo", "prompt": "Ubuntu penguin in space", "width": 1024, "height": 1024}'

Embeddings

curl http://localhost:11435/api/embed 
  -d '{"model": "nomic-embed-text", "input": "Ubuntu Ollama local inference routing"}'

Full documentation

  • Agent Setup Guide
  • API Reference

Contribute

Ollama Herd is open source (MIT). Ubuntu Ollama users welcome:

  • Star on GitHub
  • Open an issue

Guardrails

  • Ubuntu Ollama model downloads require explicit user confirmation.
  • Ubuntu Ollama model deletion requires explicit user confirmation.
  • Never delete or modify files in ~/.fleet-manager/.
  • No models are downloaded automatically — all pulls are user-initiated or require opt-in.

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,036
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,020
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,016
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,014
Skill 文件
  • SKILL.md
    • Ubuntu Ollama — Fleet Routing for Ollama on Ubuntu
    • Ubuntu Ollama setup
      • Step 1: Install Ollama on Ubuntu
      • Step 2: Install Ubuntu Ollama Herd
      • Step 3: Start Ubuntu Ollama router
      • Step 4: Verify Ubuntu Ollama fleet
    • Ubuntu Ollama systemd services
    • Use Ubuntu Ollama
      • OpenAI SDK
      • curl (Ollama format)
      • curl (OpenAI format)
    • Ubuntu Ollama NVIDIA CUDA setup
    • Ubuntu Ollama environment
    • Ubuntu Ollama model recommendations
    • Ubuntu Ollama firewall
    • Monitor Ubuntu Ollama
    • Also available on Ubuntu Ollama
      • Image generation
      • Embeddings
    • Full documentation
    • Contribute
    • Guardrails
  • 项目或源文件

相关 Skill

更多
Whisper GPU Audio Transcriber Whisper GPU Audio Transcriber 利用OpenAI Whisper将音频转换为SRT字幕,支持Intel XPU、NVIDIA CUDA、AMD ROCm及Apple Metal的自动GPU加速,适用于内容创作者。
Linux Ai Server Linux Ai Server Linux AI 服务器 — 将 Linux 服务器转换为本地 AI 推理集群。使用 systemd、NVIDIA CUDA 实现无头 Linux AI,零 GUI 开销。
NVIDIA CUDA NVIDIA CUDA Use when work targets NVIDIA GPUs for deep learning training, inference, distributed execution, CUDA/Triton kernels, or AI infra tuning. Enforces GPU-aware c...
本地视频字幕提取与校对 本地视频字幕提取与校对 本地视频字幕提取与校正工具,完全离线运行,无需 API key。支持三条路径:A) ffmpeg 提取内嵌软字幕;B) faster-whisper 语音转写(ASR),支持 NVIDIA CUDA 加速,Intel Arc 走 CPU 模式(本 skill 在 A770 上实测);C) 硬字幕多模态帧读校正——用 AI 逐帧比对烧录字幕自动修正 ASR 错词。内置繁体转简体、SRT 导出,国内网络环境开箱即用。
audio-transcription-skill audio-transcription-skill 音频转录全流程技能:下载→语音转文字→精炼版整理。 支持B站视频、网盘分享、HTTP直链、本地文件的音频下载; 使用 Qwen3-ASR-1.7B 模型 GPU 推理转录(Intel XPU / NVIDIA CUDA / Apple MPS); AI 整理精炼版(话题分章、口语清理、信息分层、表格/列表)。 全平台兼容:Windows/macOS/Linux,自动检测系统并适配。 触发词:转录、语音转文字、ASR、音频转录、B站转录、录音整理、 精炼版、Qwen3-ASR、音频下载、播客转录、会议录音整理