ollama + lobechat 搭建自己的多模型助手

背景

人工智能已经推出了快2年了,各种模型和插件,有渐渐变成熟的趋势,打造一个类似 hao123网站的人工智能模型入口,也变得有需求了。用户会去比较多个ai给出的答案,作为程序员想拥有一台自己的GPU服务器来为自己服务。目前来看ollama + lobechat是一个不错的选择。

准备

服务器:一台GPU服务器(按量计费,目前腾讯云8核32G大概是8元一小时,相比阿里云便宜了不少),为了不掉队,出点钱玩玩GPU,真想有个本地的GPU服务器呀

环境:  centos7.9

【注意】:因为是按量计费的,使用时开机,不使用时及时关机:)

安装 ollama

安装过程是

curl -fsSL https://ollama.com/install.sh | sh

实际在腾讯云及阿里云中,这个过程居然是曲折的(因为网络不通畅)。这里用了自己的香港服务器(香港服务器下载很快)。

想将 https://ollama.com/install.sh 的脚本先下下来。

并将 ollama-linux-amd64 这个文件也从 香港服务器 通过scp到 腾讯云服务器上

status "Downloading ollama..."
## 注释下面的下载过程,加入后面的指令
## curl --fail --show-error --location --progress-bar -o $TEMP_DIR/ollama "https://ollama.com/download/ollama-linux-${ARCH}${VER_PARAM}"
## 【加入】显示下载的位置
status "$TEMP_DIR/ollama"
## 【加入】拷贝已经从香港服务器过来的ollama-linux-amd64到 $TEMP_DIR/ollama
cp /root/ollama-linux-amd64 $TEMP_DIR/ollama 

将修改后的install.sh 授予权限并执行 

安装成功后,先安装个大模型(llava)试试

查看ollama服务端口是否正常(默认是11434)

这个时候如果你通过 浏览器ip:11434访问 是访问不到的

但是,通过 curl  http://127.0.0.1:11434  可以得到   Ollama is running 的反馈

修改ollama服务

vi /etc/systemd/system/ollama.service

重启服务

systemctl restart ollama

提示

Warning: ollama.service changed on disk. Run 'systemctl daemon-reload' to reload units.

 再来一次重启服务,加上systemctl daemon-reload再执行

systemctl daemon-reload

systemctl restart ollama

这个时候,可以通过 公网ip:11434访问了

安装 lobe-chat

先安装docker 

增加一个yum的源

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

安装

yum install  docker-ce

systemctl start docker

systemctl enable docker

修改docker镜像

不然速度是个大问题

vi /etc/docker/daemon.json

加入

{
    "registry-mirrors": [
        "https://dockerproxy.com",
        "https://mirror.baidubce.com",
        "https://docker.m.daocloud.io",
        "https://docker.nju.edu.cn",
        "https://docker.mirrors.sjtug.sjtu.edu.cn"
    ]
}

重启docker

systemctl daemon-reload

systemctl restart docker

用docker 安装 lobe-chat

【划重点】如果像我一样 ollama是安装在本机的,而lobe-chat是docker内的,就需要OLLAMA_PROXY_URL这个参数去启动 

docker run -d -p 3210:3210 -e OLLAMA_PROXY_URL=http://【你的ip或者局域网ip】:11434 lobehub/lobe-chat

以下是lobe-chat给出的docker的命令 

docker run -d -p 3210:3210 -e OLLAMA_PROXY_URL=http://host.docker.internal:11434 lobehub/lobe-chat 

试用

访问 ip:3210

探索lobe-chat

后期使用后再分享...

相关推荐

  1. 自己chatgpt-web(nextchat)

    2024-07-11 18:38:05       38 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-11 18:38:05       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-11 18:38:05       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-11 18:38:05       58 阅读
  4. Python语言-面向对象

    2024-07-11 18:38:05       69 阅读

热门阅读

  1. OpenCV和CUDA匹配,使用源码构建OpenCV

    2024-07-11 18:38:05       21 阅读
  2. Oracle左连接过滤条件注意事项

    2024-07-11 18:38:05       20 阅读
  3. Spring-Data-ES-template工具类使用

    2024-07-11 18:38:05       23 阅读
  4. 四种常见的Http请求方式

    2024-07-11 18:38:05       21 阅读
  5. [USACO5.3] 巨大的牛棚Big Barn

    2024-07-11 18:38:05       26 阅读
  6. python杨辉三角的两种书写方式

    2024-07-11 18:38:05       21 阅读
  7. 【Go - 常见的5类循环】

    2024-07-11 18:38:05       26 阅读
  8. 二叉搜索树的最近公共祖先

    2024-07-11 18:38:05       23 阅读
  9. 基于单目摄像头实现的AR多人脸捕捉效果展示

    2024-07-11 18:38:05       18 阅读
  10. git 基本使用

    2024-07-11 18:38:05       22 阅读
  11. 【智能制造-15】常见通讯协议

    2024-07-11 18:38:05       22 阅读
  12. 网络编程学习part1

    2024-07-11 18:38:05       23 阅读
  13. IQN、UUID和SCSI-ID

    2024-07-11 18:38:05       23 阅读