欧拉服务器操作系统部署deekseep(Ollama+DeekSeep+open WebUI)

news2025/4/18 9:43:55

​​一、解压并安装 Ollama​​

# 1. 解压文件(默认会得到一个二进制文件)
tar -xzvf ollama-linux-amd64.tgz

# 2. 将二进制文件安装到系统路径
sudo mv ollama /usr/local/bin/
sudo chmod +x /usr/local/bin/ollama

# 3. 验证安装
ollama --version

链接:ollama-linux-amd64.tgz下载地址

二、配置 Ollama 服务​​

1. ​​创建专用用户和目录​

# 创建 ollama 用户的主目录(如果不存在)
sudo mkdir -p /home/ollama
# 设置目录所有权为 ollama 用户
sudo chown ollama:ollama /home/ollama
# 确保目录权限正确(用户可读写)
sudo chmod 700 /home/ollama
sudo useradd -r -s /bin/false ollama
#创建模型存储目录并授权​
sudo mkdir -p /etc/ollama /var/lib/ollama
sudo chown -R ollama:ollama /etc/ollama /var/lib/ollama

2. ​​配置 Systemd 服务​​

sudo tee /etc/systemd/system/ollama.service <<EOF
[Unit]
Description=Ollama Service
After=network-online.target
Requires=network-online.target

[Service]
User=ollama
Group=ollama
ExecStart=/usr/local/bin/ollama serve
Restart=on-failure
# 指定 PATH 环境变量
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# 指定模型存储路径
Environment="OLLAMA_MODELS=/var/lib/ollama"
# 在 [Service] 部分添加以下环境变量
Environment="OLLAMA_HOST=0.0.0.0"  # 允许所有网络接口访问
# 资源限制
MemoryLimit=4G
CPUQuota=200%
# 安全配置
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full

[Install]
WantedBy=multi-user.target
~                                 
EOF

3. ​​启动服务

sudo systemctl daemon-reload
sudo systemctl start ollama
sudo systemctl enable ollama

4. 放行防火墙端口

sudo firewall-cmd --permanent --add-port=11434/tcp
sudo firewall-cmd --reload
[root@koji-builder ~]# sudo firewall-cmd --list-ports | grep 11434
11434/tcp

三、验证安装​​

1. ​​检查服务状态​​

[root@koji-builder ~]# sudo systemctl status ollama  
● ollama.service - Ollama Service
   Loaded: loaded (/etc/systemd/system/ollama.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2025-04-14 11:41:24 CST; 7min ago
 Main PID: 357650 (ollama)
    Tasks: 16 (limit: 100784)
   Memory: 17.8M
   CGroup: /system.slice/ollama.service
           └─357650 /usr/local/bin/ollama serve

414 11:41:24 koji-builder systemd[1]: Started Ollama Service.
414 11:41:24 koji-builder ollama[357650]: 2025/04/14 11:41:24 routes.go:1231: INFO server config env="map[CUDA_VISIBLE_DEVICES: GPU_DEVICE_ORDINAL:>
4月 14 11:41:24 koji-builder ollama[357650]: time=2025-04-14T11:41:24.960+08:00 level=INFO source=images.go:458 msg="total blobs: 0"
4月 14 11:41:24 koji-builder ollama[357650]: time=2025-04-14T11:41:24.960+08:00 level=INFO source=images.go:465 msg="total unused blobs removed: 0"
4月 14 11:41:24 koji-builder ollama[357650]: time=2025-04-14T11:41:24.960+08:00 level=INFO source=routes.go:1298 msg="Listening on 127.0.0.1:11434 (ve>
414 11:41:24 koji-builder ollama[357650]: time=2025-04-14T11:41:24.961+08:00 level=INFO source=gpu.go:217 msg="looking for compatible GPUs"
414 11:41:24 koji-builder ollama[357650]: time=2025-04-14T11:41:24.974+08:00 level=INFO source=gpu.go:377 msg="no compatible GPUs were discovered"
414 11:41:24 koji-builder ollama[357650]: time=2025-04-14T11:41:24.974+08:00 level=INFO source=types.go:130 msg="inference compute" id=0 library=cp>
414 11:47:58 koji-builder ollama[357650]: [GIN] 2025/04/14 - 11:47:58 | 200 |      99.397µs |       127.0.0.1 | GET      "/"
lines 1-18/18 (END)

​​2. 验证端口监听状态​​

[root@koji-builder ~]# ss -tulnp | grep 11434
tcp   LISTEN 0      128                 *:11434            *:*    users:(("ollama",pid=369774,fd=3))                        
[root@koji-builder ~]# 

3. ​​测试 API 连通性​​

[root@koji-builder ~]# curl http://localhost:11434
Ollama is running

四、安装 DeepSeek 模型​​

1. ​​直接拉取模型(需网络通畅)​

[root@koji-builder ~]# ollama pull deepseek-r1:7b
pulling manifest 
pulling 96c415656d37... 100% ▕███████████████████████████████████████████████████████████████████████████████████████▏ 4.7 GB                         
pulling 369ca498f347... 100% ▕███████████████████████████████████████████████████████████████████████████████████████▏  387 B                         
pulling 6e4c38e1172f... 100% ▕███████████████████████████████████████████████████████████████████████████████████████▏ 1.1 KB                         
pulling f4d24e9138dd... 100% ▕███████████████████████████████████████████████████████████████████████████████████████▏  148 B                         
pulling 40fb844194b2... 100% ▕███████████████████████████████████████████████████████████████████████████████████████▏  487 B                         
verifying sha256 digest 
writing manifest 
success 
[root@koji-builder ~]# 

2. ​​运行模型​

[root@koji-builder ~]# ollama run deepseek-r1:7b
>>> 你好,DeepSeek!
<think>

</think>

你好!我是DeepSeek-R1,一个由深度求索公司开发的智能助手,我会尽我所能为您提供帮助。请问有什么可以为您服务的?

五、安装 Open WebUI

1.添加 Docker 仓库

sudo dnf config-manager --add-repo=https://repo.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+repo.huaweicloud.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
sudo sed -i 's+\$releasever+8+' /etc/yum.repos.d/docker-ce.repo

2.安装 Docker

使用以下命令安装 Docker:

yum remove runc
sudo yum install docker-ce docker-ce-cli containerd.io -y

3.启动并启用 Docker 服务

启动 Docker 服务并设置为开机自启动:

[root@koji-builder ~]# sudo systemctl start docker
[root@koji-builder ~]# sudo systemctl enable docker --now
[root@koji-builder ~]# systemctl status docker.service 
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2025-04-14 14:23:11 CST; 13min ago
     Docs: https://docs.docker.com
 Main PID: 366089 (dockerd)
    Tasks: 52
   Memory: 4.8G
   CGroup: /system.slice/docker.service
           ├─366089 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
           ├─367006 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3000 -container-ip 172.17.0.2 -container-port 8080
           └─367013 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3000 -container-ip 172.17.0.2 -container-port 8080

414 14:23:09 koji-builder dockerd[366089]: time="2025-04-14T14:23:09.876058935+08:00" level=info msg="Loading containers: start."
414 14:23:11 koji-builder dockerd[366089]: time="2025-04-14T14:23:11.681953947+08:00" level=info msg="Firewalld: interface docker0 already part of >
414 14:23:11 koji-builder dockerd[366089]: time="2025-04-14T14:23:11.883178595+08:00" level=info msg="Loading containers: done."
414 14:23:11 koji-builder dockerd[366089]: time="2025-04-14T14:23:11.912847572+08:00" level=info msg="Docker daemon" commit=8e96db1 containerd-snap>
414 14:23:11 koji-builder dockerd[366089]: time="2025-04-14T14:23:11.913161898+08:00" level=info msg="Daemon has completed initialization"
414 14:23:11 koji-builder dockerd[366089]: time="2025-04-14T14:23:11.956811112+08:00" level=info msg="API listen on /run/docker.sock"
414 14:23:11 koji-builder systemd[1]: Started Docker Application Container Engine.
414 14:30:56 koji-builder dockerd[366089]: time="2025-04-14T14:30:56.087596330+08:00" level=error msg="Not continuing with pull after error: contex>
414 14:33:36 koji-builder dockerd[366089]: time="2025-04-14T14:33:36.929237215+08:00" level=info msg="Pull session cancelled"
414 14:33:37 koji-builder dockerd[366089]: time="2025-04-14T14:33:37.845187027+08:00" level=error msg="Not continuing with pull after error: contex>

4.验证 Docker 安装

运行以下命令检查 Docker 版本:

[root@koji-builder ~]# docker --version
Docker version 26.1.3, build b72abbb
[root@koji-builder ~]# 

5.通过 Docker 快速安装​open-webui

[root@koji-builder ~]# docker run -d -p 3000:8080 -e OLLAMA_BASE_URL=http://172.16.104.203:11434 -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
Unable to find image 'ghcr.io/open-webui/open-webui:main' locally
main: Pulling from open-webui/open-webui
8a628cdd7ccc: Pull complete 
2a47a8c4fd5c: Pull complete 
9c538fc35491: Pull complete 
47bbb0afa7fe: Pull complete 
782acb99e453: Pull complete 
4f4fb700ef54: Pull complete 
b7915144f9c7: Pull complete 
633be3c6bab0: Pull complete 
266a80d83771: Pull complete 
7b4a3fa111d1: Pull complete 
693caf783e3a: Pull complete 
dc27e7f6d410: Pull complete 
734b72bc705c: Pull complete 
1f468c116822: Pull complete 
9cbf3744ebb9: Pull complete 
Digest: sha256:ae21d77f8d3c5ab06cdd79b5e1462ef57ca162de04e2ccb8977615e301fcb42a
Status: Downloaded newer image for ghcr.io/open-webui/open-webui:main
e27380dce3851bd9be09ce050bb8b0ffd0054abefe97ab4e3ede61f1989cd100

六、访问open-webui

​​1. 查看 Docker 映射到宿主机webui.db位置

为了解决 OpenWebUI 报错 500

​​1. 查看容器挂载详情​

[root@koji-builder ~]# docker inspect open-webui | grep -A 10 "Mounts"
        "Mounts": [
            {
                "Type": "volume",
                "Name": "open-webui",
                "Source": "/var/lib/docker/volumes/open-webui/_data",
                "Destination": "/app/backend/data",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            }
[root@koji-builder ~]# 

2.定位文件位置

[root@koji-builder ~]# cd /var/lib/docker/volumes/open-webui/_data
[root@koji-builder _data]# ls
cache  uploads  vector_db  webui.db 
[root@koji-builder _data]# 

​​2. 修改修改 config 表中 openai.enable 字段

如果不修改的话,会报500,因为openwebui使用了openai的api,如果不能访问外网的情况下,需要修改数据库表的openai.enable 字段

1.安装sqlite

yum install sqlite

2.备份数据库和停止 Open WebUI 容器​

sudo cp webui.db webui.db.bak
#停止 Open WebUI 容器​
docker stop open-webui

3. 进入 SQLite 交互模式​

[root@koji-builder _data]# sqlite3  webui.db 
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
sqlite> 

4. 查看所有表,是否有config 表

sqlite> .tables 
alembic_version   config            group             model           
auth              document          knowledge         prompt          
channel           feedback          memory            tag             
channel_member    file              message           tool            
chat              folder            message_reaction  user            
chatidtag         function          migratehistory  
sqlite> 

5. 修改config 表"openai":{"enable"是的修改true

#修改
sqlite> UPDATE config 
   ...> SET data = json_set(
   ...>   data, 
   ...>   '$.openai.enable', 
   ...>   json('false')  
   ...> ) 
   ...> WHERE id = 1;
#-- 验证结果
sqlite> SELECT json_extract(data, '$.openai.enable') FROM config WHERE id = 1;
0

6. 查看config 表中的"openai":{"enable"是的修改false

sqlite> select * from config;
1|{"version":0,"ui":{"default_locale":"","prompt_suggestions":[{"title":["Help me study","vocabulary for a college entrance exam"],"content":"Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."},{"title":["Give me ideas","for what to do with my kids' art"],"content":"What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter."},{"title":["Tell me a fun fact","about the Roman Empire"],"content":"Tell me a random fun fact about the Roman Empire"},{"title":["Show me a code snippet","of a website's sticky header"],"content":"Show me a code snippet of a website's sticky header in CSS and JavaScript."},{"title":["Explain options trading","if I'm familiar with buying and selling stocks"],"content":"Explain options trading in simple terms if I'm familiar with buying and selling stocks."},{"title":["Overcome procrastination","give me tips"],"content":"Could you start by asking me about instances when I procrastinate the most and then give me some suggestions to overcome it?"},{"title":["Grammar check","rewrite it for better readability "],"content":"Check the following sentence for grammar and clarity: \"[sentence]\". Rewrite it for better readability while maintaining its original meaning."}],"enable_signup":false},"ollama":{"enable":true,"base_urls":["http://172.16.104.203:11434"],"api_configs":{"0":{}}},"openai":{"enable":false,"api_base_urls":["https://api.openai.com/v1"],"api_keys":[""],"api_configs":{"0":{}}}}|0|2025-04-14 08:07:08|2025-04-14 08:50:11.453672
sqlite> 
#-- 退出
sqlite> .quit

7. 重启open-webui容器

[root@koji-builder _data]# docker start  open-webui 
open-webui
如果启动后没有反应需要进容器里启动
[root@koji-builder _data]# docker  exec -it open-webui /bin/bash
root@69d9b2ad6b44:/app/backend# ls
data  dev.sh  open_webui  requirements.txt  start.sh  start_windows.bat
root@69d9b2ad6b44:/app/backend# ./start.sh 

​​3. 访问open-webui

http://ip:3000

在这里插入图片描述

七、删除 Docker 上所有与 Open WebUI 相关资源的完整步骤:

​​1. 停止并删除容器​​

# 查找容器名称或 ID
docker ps -a | grep open-webui
# 停止并删除容器(替换为实际容器 ID 或名称)
docker stop open-webui && docker rm open-webui

​​2. 删除数据卷​​

# 查看数据卷列表
docker volume ls | grep open-webui
# 删除数据卷(替换为实际卷名)
docker volume rm open-webui

​​3. 清理镜像​​

# 查看镜像 ID
docker images | grep open-webui
# 删除镜像(替换为实际镜像 ID)
docker rmi ghcr.io/open-webui/open-webui:main

​​4. 强制清理所有残留资源​​

# 删除所有未使用的容器、镜像、卷和网络
docker system prune -af

​​5. 验证清理结果​​

# 检查容器、卷、镜像是否已删除
docker ps -a | grep open-webui      # 应无输出
docker volume ls | grep open-webui  # 应无输出
docker images | grep open-webui     # 应无输出

​​6. 手动清理宿主机的残留文件(可选)​​

# 删除可能残留的本地文件(路径根据实际情况调整)
sudo rm -rf /var/lib/docker/volumes/open-webui

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2335178.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

#4 我们为什么使用物联网? 以及 物联网的整体结构

设备不物联是否可以&#xff1f; 答案 是可以的&#xff0c;从项目实战的角度&#xff0c;还是有很多包括分拣&#xff0c;控制&#xff0c;检测等应用是分立的&#xff0c;这个和成本&#xff0c;场景&#xff0c;客户接受度等因素有关。 局部看&#xff0c;一些系统的确很简…

3D版的VLA——从3D VLA、SpatialVLA到PointVLA(不动VLM,仅动作专家中加入3D数据)

前言 之前写这篇文章的时候&#xff0c;就想解读下3D VLA来着&#xff0c;但一直因为和团队并行开发具身项目&#xff0c;很多解读被各种延后 更是各种出差&#xff0c;比如从25年3月下旬至今&#xff0c;连续出差三轮&#xff0c;绕中国半圈&#xff0c;具身占八成 第一轮 …

linux Shell编程之循环语句(三)

目录 一. for 循环语句 1. for语句的结构 2. for 语句应用示例 (1) 根据姓名列表批量添加用户 (2) 根据 IP 地址列表检查主机状态 二. 使用 while 循环语句 1. while 语句的结构 2. while 语句应用示例 (1) 批量添加规律编号的用户 (2) 猜价格游戏 三. until 循环语…

C#容器源码分析 --- Queue<T>

Queue<T> 是 System.Collections.Generic 命名空间下的先进先出&#xff08;FIFO&#xff09;动态集合&#xff0c;其核心实现基于​​循环数组​​&#xff0c;通过维护头尾指针实现高效入队和出队操作。 .Net4.8 Queue<T>源码地址&#xff1a;queue.cs (microso…

ViT 模型讲解

文章目录 一、模型的诞生背景1.1 背景1.2 ViT 的提出&#xff08;2020年&#xff09; 二、模型架构2.1 patch2.2 模型结构2.2.1 数据 shape 变化2.2.2 代码示例2.2.3 模型结构图 2.3 关于空间信息 三、实验3.1 主要实验3.2 消融实验 四、先验问题4.1 归纳偏置4.2 先验or大数据&…

IntelliJ IDEA 中安装和使用通义灵码 AI 编程助手教程

随着人工智能技术的发展&#xff0c;AI 编程助手逐渐成为提升开发效率的强大工具。通义灵码是阿里云推出的一款 AI 编程助手&#xff0c;它能够帮助开发者实现智能代码补全、代码解释、生成单元测试等功能&#xff0c;极大地提升了编程效率和代码质量。 IntelliJ IDEA 是一款广…

FreeRTOS入门与工程实践-基于STM32F103(一)(单片机程序设计模式,FreeRTOS源码概述,内存管理,任务管理,同步互斥与通信,队列,信号量)

裸机程序设计模式 裸机程序的设计模式可以分为&#xff1a;轮询、前后台、定时器驱动、基于状态机。前面三种方法都无法解决一个问题&#xff1a;假设有A、B两个都很耗时的函数&#xff0c;无法降低它们相互之间的影响。第4种方法可以解决这个问题&#xff0c;但是实践起来有难…

can‘t set boot order in virtualbox

Boot order setting is ignored if UEFI is enabled https://forums.virtualbox.org/viewtopic.php?t99121 如果勾选EFI boot order就是灰色的 传统BIOS就是可选的 然后选中任意介质&#xff0c;通过右边的上下箭头调节顺序&#xff0c;最上面的应该是优先级最高的 然后就…

2025年第十六届蓝桥杯省赛C++ A组真题

2025年第十六届蓝桥杯省赛C A组真题 1.说明2.题目A&#xff1a;寻找质数&#xff08;5分&#xff09;3.题目B&#xff1a;黑白棋&#xff08;5分&#xff09;4. 题目C&#xff1a;抽奖&#xff08;10分&#xff09;5. 题目D&#xff1a;红黑树&#xff08;10分&#xff09;6. 题…

asp.net Kestrel 和iis区别

Kestrel 和 IIS 都是用于托管 Web 应用程序的服务器&#xff0c;不过它们在多个方面存在显著差异&#xff0c;下面为你详细分析&#xff1a; 1. 所属平台与跨平台能力 Kestrel&#xff1a;是.NET Core 及后续版本的一部分&#xff0c;具备跨平台特性&#xff0c;可在 Windows…

《植物大战僵尸融合版v2.4.1》,塔防与创新融合的完美碰撞

《植物大战僵尸融合版》是基于经典塔防游戏《植物大战僵尸》的创意同人改版&#xff0c;由“蓝飘飘fly”等开发者主导制作。它在保留原版核心玩法的基础上&#xff0c;引入了独特的植物融合机制&#xff0c;玩家可以将不同的植物进行组合&#xff0c;创造出全新的植物种类&…

[LeetCode 1696] 跳跃游戏 6(Ⅵ)

题面&#xff1a; LeetCode 1696 数据范围&#xff1a; 1 ≤ n u m s . l e n g t h , k ≤ 1 0 5 1 \le nums.length, \ k \le 10^5 1≤nums.length, k≤105 − 1 0 4 ≤ n u m s [ i ] ≤ 1 0 4 -10^4 \le nums[i] \le 10^4 −104≤nums[i]≤104 思路 & Code 重点&…

Redis 常问知识

1.Redis 缓存穿透问题 缓存穿透&#xff1a;当请求的数据在缓存和数据库中不存在时&#xff0c;该请求就跳出我们使用缓存的架构&#xff08;先从缓存找&#xff0c;再从数据库查找、这样就导致了一直去数据库中找&#xff09;&#xff0c;因为这个数据缓存中永远也不会存在。…

履带小车+六轴机械臂(2)

本次介绍原理图部分 开发板部分&#xff0c;电源供电部分&#xff0c;六路舵机&#xff0c;PS2手柄接收器&#xff0c;HC-05蓝牙模块&#xff0c;蜂鸣器&#xff0c;串口&#xff0c;TB6612电机驱动模块&#xff0c;LDO线性稳压电路&#xff0c;按键部分 1、开发板部分 需要注…

多卡集群 - Docker命令来启动一个容器的实例

一、Docker下载安装及相关配置 桌面版&#xff1a;Docker Desktop: The #1 Containerization Tool for Developers | Docker 服务器版&#xff1a;Install | Docker Docs 我们先以windows桌面版为例进行安装&#xff0c;一般在公司里会使用服务器版本&#xff0c;后期也会出一…

测试第三课-------自动化测试相关

作者前言 &#x1f382; ✨✨✨✨✨✨&#x1f367;&#x1f367;&#x1f367;&#x1f367;&#x1f367;&#x1f367;&#x1f367;&#x1f382; ​&#x1f382; 作者介绍&#xff1a; &#x1f382;&#x1f382; &#x1f382; &#x1f389;&#x1f389;&#x1f389…

ebpf: CO-RE, BTF, and Libbpf(二)

本文内容主要来源于Learning eBPF&#xff0c;可阅读原文了解更全面的内容。 本文涉及源码也来自于书中对应的github&#xff1a;https://github.com/lizrice/learning-ebpf/ 概述 上篇文章主要讲了CO-RE最关键的一环&#xff1a;BTF&#xff0c;了解其如何记录内核中的数据结…

祁连山国家公园shp格式数据

地理位置 祁连山国家公园位于中国西北部&#xff0c;横跨甘肃省与青海省交界处&#xff0c;主体处于青藏高原东北边缘。总面积约5.02万平方公里&#xff0c;是中国首批设立的10个国家公园之一。 设立背景 保护措施 文化与历史 旅游与教育 意义与挑战 祁连山国家公园的设立标志…

《AI大模型应知应会100篇》 第16篇:AI安全与对齐:大模型的灵魂工程

第16篇&#xff1a;AI安全与对齐&#xff1a;大模型的灵魂工程 摘要 在人工智能技术飞速发展的今天&#xff0c;大型语言模型&#xff08;LLM&#xff09;已经成为推动社会进步的重要工具。然而&#xff0c;随着这些模型能力的增强&#xff0c;如何确保它们的行为符合人类的期…

探索QEMU-KVM虚拟化:麒麟系统下传统与云镜像创建虚拟机的最佳实践

随着云计算和虚拟化技术的不断进步&#xff0c;虚拟化在管理服务器、隔离资源以及提升性能方面的好处越来越明显。麒麟操作系统Kylin OS是我们国家自己开发的操作系统&#xff0c;在政府机构和企业中用得很多。这篇文章会教你如何在麒麟操作系统上设置QEMU-KVM虚拟化环境&#…