Linux 摆设docker+open-webui实践

打印 上一主题 下一主题

主题 904|帖子 904|积分 2712

一、背景

当地摆设开源大语言模型,苦于常见笔记本和台式电脑的配置较低,运行不顺畅问题,因此拟通过内网Linux服务器来摆设。本篇文章将全程记载摆设全过程。供志同之士相互学习参考。
二、Centos7摆设Docker

下载你想要的Docker版本,通过WinSCP传入内网服务器。具体摆设操作如下:
  1. # 将Docker放入指定文件夹并进行解压
  2. tar -zxvf docker-20.10.10.taz(这里是你的docker安装包的名字)
  3. # 解压之后将docker全部文件拷贝到根目录下的/usr/bin目录下
  4. sudo cp -p docker/* /usr/bin
  5. # 创建docker.service文件,实现开机自启动
  6. touch docker.service
  7. # 将以下内容粘贴到docker.service中
  8. [Unit]
  9. Description=Docker Application Container Engine
  10. Documentation=https://docs.docker.com
  11. After=network-online.target firewalld.service
  12. Wants=network-online.target
  13. [Service]
  14. Type=notify
  15. # the default is not to use systemd for cgroups because the delegate issues still
  16. # exists and systemd currently does not support the cgroup feature set required
  17. # for containers run by docker
  18. ExecStart=/usr/bin/dockerd
  19. ExecReload=/bin/kill -s HUP $MAINPID
  20. # Having non-zero Limit*s causes performance problems due to accounting overhead
  21. # in the kernel. We recommend using cgroups to do container-local accounting.
  22. LimitNOFILE=infinity
  23. LimitNPROC=infinity
  24. LimitCORE=infinity
  25. # Uncomment TasksMax if your systemd version supports it.
  26. # Only systemd 226 and above support this version.
  27. #TasksMax=infinity
  28. TimeoutStartSec=0
  29. # set delegate yes so that systemd does not reset the cgroups of docker containers
  30. Delegate=yes
  31. # kill only the docker process, not all processes in the cgroup
  32. KillMode=process
  33. # restart the docker process if it exits prematurely
  34. Restart=on-failure
  35. StartLimitBurst=3
  36. StartLimitInterval=60s
  37. [Install]
  38. WantedBy=multi-user.target
  39. # 把docker.service拷贝到根目录下的 /etc/systemd/system/ 目录
  40. sudo cp docker.service /etc/systemd/system/
  41. # 对docker.service设置权限
  42. sudo chmod +x /etc/systemd/system/docker.service
  43. # 重新加载某个服务的配置文件
  44. sudo systemctl daemon-reload
  45. # 启动docker
  46. sudo systemctl start docker
  47. # 查看是否安装成功
  48. sudo docker --version
复制代码
三、安装Python(含pip)

1、下载Python的Linux 版本,open-webui要求Python3.11.*版本。(下载Linux版本下的ollama实在太慢了,我只能多路径实验。)
  1. # 下载地址,选择tar.xz版本的安装包进行下载
  2. https://www.python.org/ftp/python/3.11.3/
复制代码
2、利用WinSCP毗连Linux服务器,将以上安装包传入/usr/python3目录(自定义)
  1. # 在根目录下新建一个usr/python3
  2. mkdir /urs/python3/
复制代码
3、解压、编译、创建软毗连
  1. # 进入目录
  2. cd /usr/python3
  3. # 解压,解压的python包是你自己的安装包名字
  4. xz -d Python-3.11.*.tar.xz
  5. tar -xvf Python-3.11.*.tar
  6. # 进入解压并指明安装的Python路径
  7. cd Python-3.11.*
  8. ./configure --prefix=/usr/local/python
  9. #注意:需要执行命令,避免pip3 install 的时候报错没有ssl模块,其实python下面是有的,没有的话先安装:
  10. 1  yum install -y openssl-devel
  11. 2  ./configure --with-ssl
  12. # 备注:也可直接用以下方式解决:
  13. pip install open-webui -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
  14. # 编译安装
  15. make && make install
  16. # 软连接,便于直接用python3和pip3访问(centos7自带python2)
  17. ln -s /usr/local/python/bin/python3.11 /usr/bin/python3
  18. ln -s /usr/local//python/bin/pip3.11 /usr/bin/pip3
  19. # 检测安装情况
  20. python3 -V
  21. pip3 -V
复制代码
四、未完待续... 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

卖不甜枣

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表