使用Ollama部署属于羊驼3 72B,让自己拥有属于自己的大模型,小白教材

使用ollama部署本地大模型

前期准备条件

1.linux系统的gpu服务器
2.服务器上已经安装了cuda驱动并且能成功使用
3.有代理服务,启动web端需要下载模型
4.系统内安装有docker

相关资源链接

ollama项目地址:GitHub - ollama/ollama: Get up and running with OpenAI gpt-oss, DeepSeek-R1, Gemma 3 and other models.
ollama模型地址:https://ollama.com/
web ui地址:GitHub - open-webui/open-webui: User-friendly AI Interface (Supports Ollama, OpenAI API, ...)

安装ollama

拉模型:ollama pull 模型名称
运行模型: ollama run 模型名称
查询已经拉取下来的模型:ollama list

安装ollama web-ui

使用docker安装前端服务

首先拉取镜像,由于内地网络的原因,我们拉取镜像会很慢,所以我们走代理镜像拉取
1.拉取代理镜像
docker pull ghcr.dockerproxy.com/open-webui/open-webui:main
2.重命名代理镜像
docker tag ghcr.dockerproxy.com/open-webui/open-webui:main ghcr.io/open-webui/open-webui:main
3.删除代理镜像
docker rmi ghcr.dockerproxy.com/open-webui/open-webui:main

启动前端服务

1.首先我们需要在创建一个数据存储文件夹(可以自己定义不同的位置)
mkdir -p /opt/open-webui/data

2.先启动一次docker,这个时候,我们需要使用自己的系统代理,使其docker内部能够访问到模型网站
-e http_proxy=‘http://172.16.98.56:7890
-e https_proxy=‘http://172.16.98.56:7890
这两个为我本地的代理地址,大家自己根据自己的情况来

docker run -it
-p 8080:8080
–restart unless-stopped
–name ollama-webui
-v /opt/open-webui/data:/app/backend/data
-e OLLAMA_API_BASE_URL=http://127.0.0.1:11434
-e http_proxy=‘http://172.16.98.56:7890
-e https_proxy=‘http://172.16.98.56:7890
ghcr.io/open-webui/open-webui:main

3.停止并删除启动的容器
运行上面的命令以后,我们就可以看到容器在下载东西,等有显示启动成功,显示端口号的时候,就可以停止容器了
docker stop ollama-webui && docker rm -f ollama-webui

4.启动新的容器
这里有一个注意点,就是我本地的ollama的api接口是本地127.0.0.1可访问,没有修改其中的默认配置,所有要用–net=host
docker run -d
–network=host
–restart unless-stopped
–name ollama-webui
-v /opt/open-webui/data:/app/backend/data
-e OLLAMA_API_BASE_URL=http://127.0.0.1:11434
-e HF_ENDPOINT=https://hf-mirror.com/
ghcr.io/open-webui/open-webui:main

5.访问服务
服务启动后,访问
localhost:8080 就可以访问到前端ui界面了
注意:首次使用没有默认密码,要自己注册



注册以后,就可以正常登录了

6.界面设置中文

7.配置ollama的api地址
连接地址为:http://127.0.0.1:11434


点击刷新,就可以测试服务器是否连接成功,连接成功保存关闭界面

8.使用模型测试
点击中间的选择模型,就可以获取到ollama下载下来的模型

9.测试使用
测试使用千问32b


测试使用羊驼3 70b

10.注意
选择模型要根据自己的显卡配置来,如果模型过大,显卡也无法运算
我运行羊驼3 70B的占用截图

广告

作者穷逼一个,各位大哥大姐,要是缺流量可以看看我的流量卡
最新上架的19元 100G + 300分钟,也可以在里面找的呦
谢谢各位大哥哥,大姐姐们了,喜欢的话,我也会持续更新哟

66 个赞

#我与linux的那些事移除

20 个赞

:expressionless: 还能有广告 6

2 个赞

你站流量卡不好卖吧,我记着有好几个分佣金的上线都不好拉小弟

2 个赞

服务器要求啥,这广告有点离谱

3 个赞

要求显卡,根据显卡的显存跑不同的模型

2 个赞

扎心了,吃土坑位加一

2 个赞

你咋还打广告啊

1 个赞

为啥不卖 ollama服务呢?

非常不错

并不一定要求显卡GPU啊,可以仅CPU运行,设置方法见(Llama3来了,用Linux Ollama线下部署你自己的大模型羊驼)

参考我的docker-compose.yml

version: '3.8'
services:
  ollama-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: ollama-webui
    ports:
      - "8080:8080"
    volumes:
      - /opt/open-webui/data:/app/backend/data
    environment:
      - OLLAMA_API_BASE_URL=http://192.168.31.178:11434
      - http_proxy=http://192.168.31.45:7890
      - https_proxy=http://192.168.31.45:7890
      - ENABLE_SIGNUP=False
    restart: unless-stopped

可以在注册完账号后加一个

      - ENABLE_SIGNUP=False

来防止后续用户注册

这个广告措不及防

llama3 70b,就算用4bit量化光加载模型就要40G显存,我缺的是使用方法吗,我缺的是显卡啊

From #develop:ai to #share

感谢你的分享

7B,我就想啥机子可以跑70B

你好你好,这个怎么设置使用显存呀,我现在运行cpu占满了,gpu用的很少


没问题了,原来如此,平常就是会用这么多内存,然后再回答时才会使用gpu和cpu