windows环境下dify的安装和使用

windows环境下dify的安装和使用

硬件要求

在安装Dify之前,请确保您的系统满足以下最低要求:

CPU: 至少2核心(推荐4核心或更高)
内存: 至少4GB RAM(推荐8GB或更高)
存储空间: 至少20GB可用空间
网络: 稳定的互联网连接,用于拉取Docker镜像

本篇文章采用docker部署dify

docker安装

Docker: 版本19.03或更高
Docker Compose: 版本1.28或更高(或Docker Compose V2)

1.开启Hyper-V

可在开始栏搜索hyper-v快速安装
在这里插入图片描述
参考 hyper-v的安装和基本使用方法

2.安装docker
访问 Docker 官网:https://www.docker.com 需要开启vpn以访问
点击页面上的“Download for Windows - AMD64”按钮,以下载适用于 Windows 系统的 Docker Desktop 安装文件。

3.配置文件换源
在这里插入图片描述
将以下的json复制下来并替换原先的配置

  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "registry-mirrors": [
    "https://docker.m.daocloud.io",
    "https://docker.imgdb.de",
    "https://docker-0.unsee.tech",
    "https://docker.hlmirror.com",
    "https://docker.1ms.run",
    "https://func.ink",
    "https://lispy.org",
    "https://docker.xiaogenban1993.com"
  ]
}

4.测试
运行下面的两串代码

docker --version
docker run hello-world
输出以下信息,则说明安装成功

C:\Users\lynnh>docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449bf11e0941a1fd0bf4a8e6c9408b2600777c5
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

docker run hello-world会先从本地搜索名为hello-world的镜像,若没有找到,则先从docker hub中pull该镜像,拉取镜像到本地成功后,再通过run指令来启动容器运行该镜像。

dify安装

1.安装
方式一:克隆GitHub仓库(推荐)

# 克隆最新版本
git clone https://github.com/langgenius/dify.git

# 或克隆特定稳定版本(推荐用于生产环境)
git clone https://github.com/langgenius/dify.git --branch 0.15.3

# 进入项目目录
cd dify/docker`

方式二:直接下载必要文件
如果您无法使用git,可以直接下载必要的配置文件:

//创建项目目录
mkdir -p dify-docker && cd dify-docker

//下载docker-compose配置
curl -fsSL https://github.com/langgenius/dify/raw/main/docker/docker-compose.yaml -o docker-compose.yaml

//下载环境变量模板
curl -fsSL https://github.com/langgenius/dify/raw/main/docker/.env.example -o .env

2.启动Docker服务

cd dify/docker //关键目录
cp .env.example .env  # 复制环境变量模板 如果提示找不到命令则改用 copy .env.example .env
docker compose up -d  # 后台启动docker,会自动拉取镜像

过程会有点长,或出现拉取失败的情况,如果遇到拉取失败,一般都是docker镜像源问题,请参考上面的坑的解决方案,正常情况会看到如下:
在这里插入图片描述

等待镜像拉取完成后自动启动相关的镜像:

在这里插入图片描述

3.验证
启动后,检查所有容器是否正常运行:

docker compose ps

浏览器中输入:http://localhost

首次进入会要设置管理员账号密码啥的,随便设置一个登录,然后就可以看到类似如下界面:

在这里插入图片描述

到这一步,则基本部署成功了。

### 安装使用Dify与DeepSeek #### Windows环境下的准备工作 为了在Windows环境中顺利安装并运行Dify以及DeepSeek,确保操作系统版本至少为Windows 10,并已启用Hyper-V功能以便支持容器化应用的执行[^2]。 #### Docker Desktop的安装 由于Dify依赖于Docker来构建其运行环境,在开始之前需先完成Docker Desktop的安装。此过程相对简单直观,按照官方指南中的指示操作即可顺利完成设置工作。 ```bash # 启动命令提示符作为管理员身份 wsl --install ``` 这段代码用于激活适用于Linux的Windows子系统(WSL),这一步骤对于后续通过Docker管理Linux容器至关重要。 #### 获取Dify 一旦Docker准备就绪,则可以转向获取Dify本身。访问项目主页或GitHub仓库页面找到最新的发布版链接进行下载[^1]。 #### 配置Dify 解压所获得的压缩包后,进入对应的文件夹内查看README文档了解具体的初始化指令其他必要的配置选项。通常情况下会涉及到创建`.env`文件来自定义一些参数设定,比如端口映射、数据库连接字符串等。 ```bash cp .env.example .env nano .env ``` 上述两条命令分别用来复制模板环境变量文件并打开编辑器对其进行修改调整以适应个人需求。 #### 运行Dify服务 一切准备好以后便可以通过如下方式启动整个平台: ```bash docker-compose up -d ``` 这条命令将会依据当前目录里的`docker-compose.yml`描述自动拉取所需镜像并且建立关联的服务实例。 #### DeepSeek集成 关于DeepSeek的具体集成方法并未直接提及,但从上下文中推测应当是在完成了基础架构搭建之后再考虑接入该组件。一般而言可能是作为一个独立微服务加入到现有的网络拓扑结构当中去。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值