Arch Linux 安装 Ollam 以及 Open WebUI
1. 安装 Ollama
若想使用官方安装脚本安装可参考:Install Ollama on Linux - GitHub
本文不采用官方的安装脚本,而是直接使用pacman
来安装仓库中的包:
sudo pacman -S ollama
测试:
[skyzcyou@arch-honor ~]$ ollama -v
Warning: could not connect to a running Ollama instance
Warning: client version is 0.5.10
有如上输出则表示安装成功。可以看到安装之后 ollama
是不会自己启动的,需要手动运行 ollama serve
来开启。
不过每次都手动开启不方便,推荐使用 systemctl
来管理服务。
# 启动 ollama 服务
sudo systemctl start ollama
# 设置 ollama 服务自启
sudo systemctl enable ollama
# 查询 ollama 服务状态
sudo systemctl status ollama
ollama
服务会运行在 127.0.0.1:11434
。
2. 运行大模型
这里以 gemma3:4b
模型为例。运行命令:
ollama run gemma3:4b
等待下载和校验后则会自动进入终端对话界面。成功运行示例:
[skyzcyou@arch-honor ~]$ ollama run gemma3:4b
>>> who are you?
I'm Gemma, a large language model created by the Gemma team at Google DeepMind. I’m an open-weights model, meaning I’m publicly available for anyone to use!
I can take text and images as inputs and generate text-based responses.
You can learn more about me on the Gemma website: [https://ai.google.com/gemma](https://ai.google.com/gemma)
I'm still under development, but I'm always learning!
>>>
Use Ctrl + d or /bye to exit.
自此 ollama
便已安装并成功运行,可以根据自身需求和电脑配置挑选何时的大模型来运行。
3. 使用 Open WebUI
平时在终端使用 AI 对话非常不方便,除了第三方客户端之外,更推荐使用 Docker 来运行开源的 Open WebUI。
3.1 安装 Docker
使用 pacman 安装:
sudo pacman -S docker
启动 Docker Daemon:
sudo systemctl start docker.service
设置 Docker 服务开机自启:
sudo systemctl enable docker.service
添加当前用户到 docker 用户组:
sudo usermod -aG docker $USER
测试 Docker 运行状态:
docker run hello-world
若 Docker 运行正常则可以看到如下输出:
[skyzcyou@arch-honor ~]$ docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
For more examples and ideas, visit:
https://docs.docker.com/get-started/
3.2 安装 Open WebUI
根据是否需要 GPU 设置选择合适的命令:
无需 GPU 支持:
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
需要 Nvidia GPU 支持, 使用此命令:
docker run -d -p 3000:8080 --gpus all --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda
运行成功之后打开 127.0.0.1:3000
即可看到 Open WebUI 界面。
评论
其他文章