Centos9安装ollama open-webui使用DeepSeek模型

DeepSeek最近很火的AI,下面介绍在Centis9 无GPU中如何运行

ollama 网站

https://ollama.com

ollama_install.sh并保存

curl -fsSL https://ollama.com/install.sh -o ollama_install.sh

使用github文件加速替换github下载地址(不保证github文件加速一直存活)

sed -i 's|https://ollama.com/download/ollama-linux|https://gh.llkk.cc/https://github.com/ollama/ollama/releases/download/v0.5.7/ollama-linux|g' ollama_install.sh

执行 下载安装DeepSeek1.5B模型

2C4G可以运行1.5B,推荐8G内存
8C16G可以运行7B/8B,建议使用GPU运行

chmod +x ollama_install.sh
sh ollama_install.sh
ollama run deepseek-r1:1.5b

open-webui Github地址

https://github.com/open-webui/open-webui

open-webui 需要python3.11 而Centos9 默认python3.9 安装python3.11

dnf install -y python311 python3.11-pip  python3.11-devel sqlite-devel

升级sqlite3

pip3.11 install pysqlite3
pip3.11 install --upgrade pysqlite3
pip3.11 install pysqlite3-binary

安装Web

pip3.11 install open-webui

如果直接运行会报

RuntimeError: [91mYour system has an unsupported version of sqlite3. Chroma                     requires sqlite3 >= 3.35.0.[0m
[94mPlease visit                     https://docs.trychroma.com/troubleshooting#sqlite to learn how                     to upgrade.[0m

修改init

vi /usr/local/lib/python3.11/site-packages/chromadb/__init__.py

在顶部增加后保存退出

__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')

设置开机服务

sudo vi /etc/systemd/system/open-webui.service
[Unit]
Description=Open Web UI Service
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/open-webui serve
Restart=always
Environment=PATH=/usr/local/bin:/usr/bin:/bin
Environment=PYTHONUNBUFFERED=1

[Install]
WantedBy=multi-user.target

设置开机启动

sudo systemctl daemon-reload
sudo systemctl enable open-webui.service
sudo systemctl start open-webui.service
sudo systemctl status open-webui.service

效果

● open-webui.service - Open Web UI Service
     Loaded: loaded (/etc/systemd/system/open-webui.service; enabled; preset: disabled)
     Active: active (running) since Sun 2025-02-09 15:22:44 CST; 23s ago
   Main PID: 2036 (open-webui)
      Tasks: 14 (limit: 11090)
     Memory: 1.0G
        CPU: 9.763s
     CGroup: /system.slice/open-webui.service
             └─2036 /usr/bin/python3.11 /usr/local/bin/open-webui serve

Feb 09 15:22:48 VM-4-6-centos open-webui[2036]:   warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
Feb 09 15:22:50 VM-4-6-centos open-webui[2036]: WARNI [langchain_community.utils.user_agent] USER_AGENT environment variable not set, consider setting it to identify your requests.
Feb 09 15:22:52 VM-4-6-centos open-webui[2036]:   ___                    __        __   _     _   _ ___
Feb 09 15:22:52 VM-4-6-centos open-webui[2036]:  / _ \ _ __   ___ _ __   \ \      / /__| |__ | | | |_ _|
Feb 09 15:22:52 VM-4-6-centos open-webui[2036]: | | | | '_ \ / _ \ '_ \   \ \ /\ / / _ \ '_ \| | | || |
Feb 09 15:22:52 VM-4-6-centos open-webui[2036]: | |_| | |_) |  __/ | | |   \ V  V /  __/ |_) | |_| || |
Feb 09 15:22:52 VM-4-6-centos open-webui[2036]:  \___/| .__/ \___|_| |_|    \_/\_/ \___|_.__/ \___/|___|
Feb 09 15:22:52 VM-4-6-centos open-webui[2036]:       |_|
Feb 09 15:22:52 VM-4-6-centos open-webui[2036]: v0.5.10 - building the best open-source AI user interface.
Feb 09 15:22:52 VM-4-6-centos open-webui[2036]: https://github.com/open-webui/open-webui

Web访问

http://ip:8080

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注