保姆级教程!带你一步步在本地内网搭建RAGFlow

一、环境准备

大家可以准备一台配置为 4 核 CPU、8GB 内存的 Linux 服务器,我选用的是 CentOS 7.9 系统。安装包在《小周的数据库进阶之路》公众号后台回复 “ds离线安装包”领取 。

二、安装ollma

[root@localhost ~]# cd /opt/
上传离线安装包
[root@localhost opt]# tar -xvf ollama-linux-amd64.tgz

在这里插入图片描述
设置软连接

[root@localhost opt]# cd bin/
[root@localhost bin]# ll
[root@localhost bin]# sudo ln -s /opt/bin/ollama /usr/local/bin/ollama
[root@localhost bin]# ls -l /usr/local/bin/ollama

在这里插入图片描述
设置环境变量

[root@localhost bin]# vi ~/.bashrc
添加
export PATH=$PATH:/usr/local/bin

在这里插入图片描述

[root@localhost bin]#  source ~/.bashrc

输入ollama,验证是否安装成功。

[root@localhost bin]# ollama

在这里插入图片描述
设置服务开机自启动
配置ollama的配置文件

[root@localhost bin]# vi /etc/systemd/system/ollama.service
添加以下内容:

[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
User=root
Group=root
Restart=always
RestartSec=3
Environment="OLLAMA_HOST=0.0.0.0:11434"
[Install]
WantedBy=default.target


[root@localhost bin]# sudo systemctl daemon-reload
[root@localhost bin]# sudo systemctl enable ollama.service
[root@localhost bin]# sudo systemctl restart ollama.service
[root@localhost bin]#  sudo systemctl status ollama.service

在这里插入图片描述
查看端口是否开启

[root@localhost bin]# ss -anlp|grep 11434

在这里插入图片描述
ollama 下载deepseek-r1:1.5b
在这里插入图片描述
跟进需求和实际情况选择
在这里插入图片描述
复制命令到操作系统运行即可,这里大家根据需要进行选择。

[root@localhost bin]# ollama run deepseek-r1:1.5b

离线的需要把.ollama下的这4文件复制到服务器的路径下即可,这里我再不演示。
在这里插入图片描述

[root@localhost ~]# tar -cvf 1.5B.tar .ollama/ #将1.5B.tar复制到服务器解压即可。

出现以下界面即为安装成功。
在这里插入图片描述
正常提问问题”你是谁“,得到回复
在这里插入图片描述

三、安装docker

上传安装文件至任意目录下

[root@localhost ~]# tar -xvf ./docker-28.0.0.tgz
[root@localhost ~]# cp docker/* /usr/bin/
[root@localhost ~]#  vi docker.service

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
 
[Service]
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
 
[Install]
WantedBy=multi-user.target
[root@localhost bin]#cp ./docker.service /usr/lib/systemd/system
[root@localhost bin]#systemctl daemon-reload
[root@localhost bin]#systemctl start docker
[root@localhost bin]#systemctl enable docker
[root@localhost bin]#systemctl status docker

在这里插入图片描述
安装docker-compose
上传文件至/usr/local/bin下

[root@localhost bin]# sudo chmod +x /usr/local/bin/docker-compose
[root@localhost bin]# docker-compose --version

在这里插入图片描述

四、部署Ragflow WEB页面

设置参数

[root@localhost opt]# sudo sysctl -w vm.max_map_count=262144
[root@localhost opt]# sysctl vm.max_map_count

在这里插入图片描述

git地址:https://github.com/infiniflow/ragflow.git

这里我们提前下载好安装包,上传至opt下

[root@localhost opt]# unzip ragflow-main.zip 
[root@localhost opt]#cd ragflow/docker
[root@localhost docker]#chmod +x ./entrypoint.sh

2、导入镜像包

[root@localhost docker]#docker load -i resources/infiniflow-ragflow-v0.16.0-slim.tar
[root@localhost docker]#docker load -i resources/valkey-valkey-8.tar
[root@localhost docker]#docker load -i resources/minio-RELEASE.2023-12-20T01-00-02Z.tar
[root@localhost docker]#docker load -i resources/mysql-8.0.39.tar
[root@localhost docker]#docker load -i resources/elasticsearch-8.11.3.tar
[root@localhost docker]# docker-compose -f docker-compose.yml up -d

在这里插入图片描述
访问页面:

http://192.168.59.137/

在这里插入图片描述
点击注册
在这里插入图片描述
设置语言
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
添加模型
在这里插入图片描述
在这里插入图片描述

最大token数为32768即可
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值