使用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
-
运行命令即可自动安装完成(没有安装完成的检查自己的环境)
curl -fsSL https://ollama.com/install.sh | sh -
运行ollma并设置自启
systemctl start ollama && systemctl enable ollama -
拉取大模型并运行
拉取羊驼3 70B
ollama pull llama3:70b
拉模型: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分钟,也可以在里面找的呦
谢谢各位大哥哥,大姐姐们了,喜欢的话,我也会持续更新哟












