卖不甜枣 发表于 2025-2-13 21:24:05

Linux 摆设docker+open-webui实践

一、背景

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

下载你想要的Docker版本,通过WinSCP传入内网服务器。具体摆设操作如下:
# 将Docker放入指定文件夹并进行解压
tar -zxvf docker-20.10.10.taz(这里是你的docker安装包的名字)

# 解压之后将docker全部文件拷贝到根目录下的/usr/bin目录下
sudo cp -p docker/* /usr/bin

# 创建docker.service文件,实现开机自启动
touch docker.service

# 将以下内容粘贴到docker.service中

Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

WantedBy=multi-user.target

# 把docker.service拷贝到根目录下的 /etc/systemd/system/ 目录
sudo cp docker.service /etc/systemd/system/

# 对docker.service设置权限
sudo chmod +x /etc/systemd/system/docker.service

# 重新加载某个服务的配置文件
sudo systemctl daemon-reload

# 启动docker
sudo systemctl start docker

# 查看是否安装成功
sudo docker --version
三、安装Python(含pip)

1、下载Python的Linux 版本,open-webui要求Python3.11.*版本。(下载Linux版本下的ollama实在太慢了,我只能多路径实验。)
# 下载地址,选择tar.xz版本的安装包进行下载
https://www.python.org/ftp/python/3.11.3/ 2、利用WinSCP毗连Linux服务器,将以上安装包传入/usr/python3目录(自定义)
# 在根目录下新建一个usr/python3
mkdir /urs/python3/ 3、解压、编译、创建软毗连
# 进入目录
cd /usr/python3

# 解压,解压的python包是你自己的安装包名字
xz -d Python-3.11.*.tar.xz
tar -xvf Python-3.11.*.tar


# 进入解压并指明安装的Python路径
cd Python-3.11.*
./configure --prefix=/usr/local/python

#注意:需要执行命令,避免pip3 install 的时候报错没有ssl模块,其实python下面是有的,没有的话先安装:
1yum install -y openssl-devel
2./configure --with-ssl

# 备注:也可直接用以下方式解决:
pip install open-webui -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

# 编译安装
make && make install

# 软连接,便于直接用python3和pip3访问(centos7自带python2)
ln -s /usr/local/python/bin/python3.11 /usr/bin/python3
ln -s /usr/local//python/bin/pip3.11 /usr/bin/pip3

# 检测安装情况
python3 -V
pip3 -V

四、未完待续... 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: Linux 摆设docker+open-webui实践