安装部署dify

先说明:这里使用的是centos7虚拟机部署的,需要提前装docker和git,docker配置了加速地址(不需要魔法),如果环境不一致的话,可以绕道避免浪费时间。

访问dify官网下载dify安装包

dify在githu的仓库地址是 https://github.com/langgenius/dify

进去之后,先复制 仓库的https地址

image-20250228214613170

开始下载dify

源地址是 https://github.com/langgenius/dify.git,我这里使用github镜像站githubfast加速下载(将github替换为githubfast)。

[root@192 桌面]# git clone https://githubfast.com/langgenius/dify.git                     # 这里需要安装有git
正克隆到 'dify'...
remote: Enumerating objects: 144101, done.
remote: Counting objects: 100% (217/217), done.
remote: Compressing objects: 100% (95/95), done.
remote: Total 144101 (delta 179), reused 122 (delta 122), pack-reused 143884 (from 5)
接收对象中: 100% (144101/144101), 76.77 MiB | 1.87 MiB/s, done.
处理 delta 中: 100% (105701/105701), done.
[root@192 桌面]#

安装dify

访问最新释放的1.0.0版本,按照部署步骤一步一步安装(就两步)

image-20250228214520752

[root@192 桌面]# cd dify/
[root@192 dify]# git checkout 1.0.0                                             # 切换到1.0.0版本
Note: checking out '1.0.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD 目前位于 c0358d8... release/1.0.0 (#14478)
[root@192 dify]# cd ./docker

[root@192 dify]# cp .env.example .env                                     # 复制一份默认的配置文件,把.env.example  复制为 .env

[root@192 docker]# docker compose -f docker-compose.yaml up -d                    # 使用docker compose方式安装
WARN[0000] The "DB_DATABASE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_USERNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_DATABASE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_USERNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_USERNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_DATABASE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_DATABASE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DB_USERNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CERTBOT_EMAIL" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CERTBOT_DOMAIN" variable is not set. Defaulting to a blank string. 
[+] Running 80/32
 ✔ redis Pulled                                                                                             56.6s 
 ✔ plugin_daemon Pulled                                                                                    255.0s 
 ✔ api Pulled                                                                                              254.1s 
 ✔ worker Pulled                                                                                           254.1s 
 ✔ ssrf_proxy Pulled                                                                                       167.2s 
 ✔ sandbox Pulled                                                                                           54.4s 
 ✔ nginx Pulled                                                                                            249.7s 
 ✔ db Pulled                                                                                                86.3s 
 ✔ web Pulled                                                                                              252.0s 
 ✔ weaviate Pulled                                                                                          44.6s 

[+] Running 12/12
 ✔ Network docker_ssrf_proxy_network  Created                                                                0.1s 
 ✔ Network docker_default             Created                                                                0.1s 
 ✔ Container docker-web-1             Started                                                                2.3s 
 ✔ Container docker-plugin_daemon-1   Started                                                                2.6s 
 ✔ Container docker-sandbox-1         Started                                                                2.6s 
 ✔ Container docker-weaviate-1        Started                                                                2.0s 
 ✔ Container docker-db-1              Started                                                                2.3s 
 ✔ Container docker-redis-1           Started                                                                2.2s 
 ✔ Container docker-ssrf_proxy-1      Started                                                                2.3s 
 ✔ Container docker-api-1             Started                                                                3.5s 
 ✔ Container docker-worker-1          Started                                                                3.5s 
 ✔ Container docker-nginx-1           Started                                                                4.7s 
[root@192 docker]#

登录dify

此时我们还不知道dify web端口绑到了宿主机的那个端口,可以看一下容器信息,找web服务器的端口映射

image-20250228213853666

可以看到web服务器也就是这里的ngnix的端口是宿主机的80绑到容器的80,所以直接通过http协议访问宿主机的ip即可。

安装过程中,如果有端口冲突可以修改 .env 文件

EXPOSE_NGINX_PORT=80
EXPOSE_NGINX_SSL_PORT=443

# HTTP port
NGINX_PORT=80
# SSL settings are only applied when HTTPS_ENABLED is true
NGINX_SSL_PORT=443

那关闭之后如何开启呢

可以重新回到docker目录执行安装时候的命令,它会在容器没有安装的时候安装并开启,如果是关闭状态会打开

[root@192 dify]# cd ./docker
[root@192 docker]# docker compose -f docker-compose.yaml up -d

也可以使用 docker compose start开启,这是一个专门用于开启的命令。

[root@192 dify]# cd ./docker
[root@192 docker]# docker compose -f docker-compose.yaml start

而且虚拟机重启之后dify会自动开启。

本文作者:jiyuchen1

本文链接:https://www.cnblogs.com/jiyuchen1/p/18744711

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   姬雨晨  阅读(277)  评论(2编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起