一、相关链接

Ollama官网

https://ollama.com/

下载Ollama

https://ollama.com/download/linux

 curl -fsSL https://ollama.com/install.sh | sh

View script sourceManual install instructions

最新版本0.20.7

搜索模型

https://ollama.com/search

如搜索:deepseek,Qwen,gemma

有不同参数的模型。

Ollama's documentation
https://docs.ollama.com/

二、安装、配置Ollama

1、安装

前置安装:sudo apt-get install zstd

curl -fsSL https://ollama.com/install.sh | sh

可能会卡,稍后再试,或者打开网络代理

手动安装

https://docs.ollama.com/linux

包括:将Ollama添加为启动服务

查看版本

ollama --version
ollama -v

2、配置

默认模型存储位置:

~/.ollama/models

/usr/share/ollama/.ollama/models

配置模型存储位置

export OLLAMA_MODELS="/mnt/d/ModelScope"

可以把这个写入到:~/.bashrc,然后:source ~/.bashrc

3、启动及验证

启动服务

ollama serve

浏览器访问

http://127.0.0.1:11434/
Ollama is running

验证 Ollama 服务与模型可用性
curl http://127.0.0.1:11434/api/tags

三、运行个模型

运行模型

运行=拉取+启动

ollama run deepseek-r1:1.5b

>>> Send a message (/? for help)

>>> 你好

>>> /bye

先拉取

ollama pull deepseek-r1:1.5b

再运行

ollama run deepseek-r1:1.5b

四、常用命令

启动服务
ollama serve

列出本地模型

ollama list

查看运行中的模型

ollama ps

停止运行中的模型

ollama stop deepseek-r1:1.5b

# 再次运行
ollama run --verbose deepseek-r1:1.5b

--verbose 显示统计信息

五、Ollama命令提示

ollama帮助文档

uadmin@PC26:~$ ollama --help
Large language model runner

Usage:
  ollama [flags]
  ollama [command]

Available Commands:
  serve       Start Ollama
  create      Create a model
  show        Show information for a model
  run         Run a model
  stop        Stop a running model
  pull        Pull a model from a registry
  push        Push a model to a registry
  signin      Sign in to ollama.com
  signout     Sign out from ollama.com
  list        List models
  ps          List running models
  cp          Copy a model
  rm          Remove a model
  launch      Launch the Ollama menu or an integration
  help        Help about any command

Flags:
  -h, --help         help for ollama
      --nowordwrap   Don't wrap words to the next line automatically
      --verbose      Show timings for response
  -v, --version      Show version information

Use "ollama [command] --help" for more information about a command.

ollama交互式

uadmin@PC26:~$ ollama
Ollama 0.20.7

▸ Chat with a model
    Start an interactive chat with a model

  Launch OpenClaw
    Personal AI with 100+ skills

  Launch Claude Code (not installed)
    Anthropic's coding tool with subagents

  Launch OpenCode (not installed)
    Anomaly's open-source coding agent

  More...
    Show additional integrations


↑/↓ navigate • enter launch • → configure • esc quit

 六、查看统计信息

方法 1:用命令行 ollama run --verbose(最直接)

ollama run --verbose deepseek-r1:1.5b

每次回复后都会显示统计。

方法 2:在命令行会话内临时开启 / 关闭

进入 ollama run 后,用内置命令切换:

>>> /set verbose   # 开启统计
>>> /set quiet     # 关闭统计(默认)

七、关闭思考

deepseek 关闭思考,在ollama中,在代码中

八、其他

Ollama's new app

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐