Oracle Linux 8にDify コミュニティー版インストール


環境構築メモ
以下公式のインストール手順をやってみた系です。

https://docs.dify.ai/ja-jp/getting-started/install-self-hosted/docker-compose

Oracle Linux 要素は dnf 使うところぐらい？

## gitインストール
```
$ sudo dnf install -y git

Last metadata expiration check: 0:40:53 ago on Fri 06 Jun 2025 11:55:22 PM GMT.
Dependencies resolved.
========================================================================================================
 Package                    Architecture     Version                      Repository               Size
========================================================================================================
Installing:
 git                        x86_64           2.43.5-3.el8_10              ol8_appstream            91 k
Installing dependencies:
 git-core                   x86_64           2.43.5-3.el8_10              ol8_appstream            11 M
 git-core-doc               noarch           2.43.5-3.el8_10              ol8_appstream           3.1 M
 perl-Error                 noarch           1:0.17025-2.el8              ol8_appstream            46 k
 perl-Git                   noarch           2.43.5-3.el8_10              ol8_appstream            78 k
 perl-TermReadKey           x86_64           2.37-7.el8                   ol8_appstream            40 k

Transaction Summary
========================================================================================================
Install  6 Packages

Total download size: 14 M
Installed size: 46 M
Downloading Packages:
(1/6): git-2.43.5-3.el8_10.x86_64.rpm                                   1.1 MB/s |  91 kB     00:00    
(2/6): perl-Error-0.17025-2.el8.noarch.rpm                              6.0 MB/s |  46 kB     00:00    
(3/6): git-core-doc-2.43.5-3.el8_10.noarch.rpm                           26 MB/s | 3.1 MB     00:00    
(4/6): perl-Git-2.43.5-3.el8_10.noarch.rpm                              2.2 MB/s |  78 kB     00:00    
(5/6): perl-TermReadKey-2.37-7.el8.x86_64.rpm                           8.5 MB/s |  40 kB     00:00    
(6/6): git-core-2.43.5-3.el8_10.x86_64.rpm                               21 MB/s |  11 MB     00:00    
--------------------------------------------------------------------------------------------------------
Total                                                                    27 MB/s |  14 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                1/1 
  Installing       : git-core-2.43.5-3.el8_10.x86_64                                                1/6 
  Installing       : git-core-doc-2.43.5-3.el8_10.noarch                                            2/6 
  Installing       : perl-TermReadKey-2.37-7.el8.x86_64                                             3/6 
  Installing       : perl-Error-1:0.17025-2.el8.noarch                                              4/6 
  Installing       : perl-Git-2.43.5-3.el8_10.noarch                                                5/6 
  Installing       : git-2.43.5-3.el8_10.x86_64                                                     6/6 
  Running scriptlet: git-2.43.5-3.el8_10.x86_64                                                     6/6 
  Verifying        : git-2.43.5-3.el8_10.x86_64                                                     1/6 
  Verifying        : git-core-2.43.5-3.el8_10.x86_64                                                2/6 
  Verifying        : git-core-doc-2.43.5-3.el8_10.noarch                                            3/6 
  Verifying        : perl-Error-1:0.17025-2.el8.noarch                                              4/6 
  Verifying        : perl-Git-2.43.5-3.el8_10.noarch                                                5/6 
  Verifying        : perl-TermReadKey-2.37-7.el8.x86_64                                             6/6 

Installed:
  git-2.43.5-3.el8_10.x86_64        git-core-2.43.5-3.el8_10.x86_64 git-core-doc-2.43.5-3.el8_10.noarch
  perl-Error-1:0.17025-2.el8.noarch perl-Git-2.43.5-3.el8_10.noarch perl-TermReadKey-2.37-7.el8.x86_64 

Complete!

$ git --version
git version 2.43.5
```

## Docker および Docker Composeインストール
Docker ComposeはDockerに内包されてました

```
$ sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

$ sudo dnf install -y docker-ce docker-ce-cli containerd.io
Docker CE Stable - x86_64                                               1.6 MB/s |  66 kB     00:00    
Dependencies resolved.
========================================================================================================
 Package                   Arch   Version                                       Repository         Size
========================================================================================================
Installing:
 containerd.io             x86_64 1.6.32-3.1.el8                                docker-ce-stable   35 M
 docker-ce                 x86_64 3:26.1.3-1.el8                                docker-ce-stable   27 M
 docker-ce-cli             x86_64 1:26.1.3-1.el8                                docker-ce-stable  7.8 M
Installing dependencies:
 container-selinux         noarch 2:2.229.0-2.module+el8.10.0+90541+332b2aa7    ol8_appstream      69 k
 fuse-overlayfs            x86_64 1.13-1.module+el8.10.0+90541+332b2aa7         ol8_appstream      69 k
 libcgroup                 x86_64 0.41-19.el8                                   ol8_baseos_latest  70 k
 libslirp                  x86_64 4.4.0-2.module+el8.10.0+90541+332b2aa7        ol8_appstream      69 k
 slirp4netns               x86_64 1.2.3-1.module+el8.10.0+90541+332b2aa7        ol8_appstream      55 k
Installing weak dependencies:
 docker-buildx-plugin      x86_64 0.14.0-1.el8                                  docker-ce-stable   14 M
 docker-ce-rootless-extras x86_64 26.1.3-1.el8                                  docker-ce-stable  5.0 M
 docker-compose-plugin     x86_64 2.27.0-1.el8                                  docker-ce-stable   13 M
Enabling module streams:
 container-tools                  ol8                                                                  

Transaction Summary
========================================================================================================
Install  11 Packages

Total download size: 103 M
Installed size: 390 M
Downloading Packages:
(1/11): docker-buildx-plugin-0.14.0-1.el8.x86_64.rpm                     69 MB/s |  14 MB     00:00    
(2/11): docker-ce-26.1.3-1.el8.x86_64.rpm                                70 MB/s |  27 MB     00:00    
(3/11): docker-ce-cli-26.1.3-1.el8.x86_64.rpm                            29 MB/s | 7.8 MB     00:00    
(4/11): docker-ce-rootless-extras-26.1.3-1.el8.x86_64.rpm                46 MB/s | 5.0 MB     00:00    
(5/11): libcgroup-0.41-19.el8.x86_64.rpm                                3.5 MB/s |  70 kB     00:00    
(6/11): containerd.io-1.6.32-3.1.el8.x86_64.rpm                          48 MB/s |  35 MB     00:00    
(7/11): container-selinux-2.229.0-2.module+el8.10.0+90541+332b2aa7.noar 313 kB/s |  69 kB     00:00    
(8/11): fuse-overlayfs-1.13-1.module+el8.10.0+90541+332b2aa7.x86_64.rpm 1.3 MB/s |  69 kB     00:00    
(9/11): docker-compose-plugin-2.27.0-1.el8.x86_64.rpm                    32 MB/s |  13 MB     00:00    
(10/11): libslirp-4.4.0-2.module+el8.10.0+90541+332b2aa7.x86_64.rpm     356 kB/s |  69 kB     00:00    
(11/11): slirp4netns-1.2.3-1.module+el8.10.0+90541+332b2aa7.x86_64.rpm  240 kB/s |  55 kB     00:00    
--------------------------------------------------------------------------------------------------------
Total                                                                   100 MB/s | 103 MB     00:01     
Docker CE Stable - x86_64                                               100 kB/s | 1.6 kB     00:00    
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
 From       : https://download.docker.com/linux/centos/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                1/1 
  Running scriptlet: container-selinux-2:2.229.0-2.module+el8.10.0+90541+332b2aa7.noarch           1/11 
  Installing       : container-selinux-2:2.229.0-2.module+el8.10.0+90541+332b2aa7.noarch           1/11 
  Running scriptlet: container-selinux-2:2.229.0-2.module+el8.10.0+90541+332b2aa7.noarch           1/11 
  Installing       : docker-compose-plugin-2.27.0-1.el8.x86_64                                     2/11 
  Running scriptlet: docker-compose-plugin-2.27.0-1.el8.x86_64                                     2/11 
  Installing       : containerd.io-1.6.32-3.1.el8.x86_64                                           3/11 
  Running scriptlet: containerd.io-1.6.32-3.1.el8.x86_64                                           3/11 
  Installing       : libslirp-4.4.0-2.module+el8.10.0+90541+332b2aa7.x86_64                        4/11 
  Installing       : slirp4netns-1.2.3-1.module+el8.10.0+90541+332b2aa7.x86_64                     5/11 
  Installing       : fuse-overlayfs-1.13-1.module+el8.10.0+90541+332b2aa7.x86_64                   6/11 
  Running scriptlet: fuse-overlayfs-1.13-1.module+el8.10.0+90541+332b2aa7.x86_64                   6/11 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                  7/11 
  Installing       : libcgroup-0.41-19.el8.x86_64                                                  7/11 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                  7/11 
  Installing       : docker-buildx-plugin-0.14.0-1.el8.x86_64                                      8/11 
  Running scriptlet: docker-buildx-plugin-0.14.0-1.el8.x86_64                                      8/11 
  Installing       : docker-ce-cli-1:26.1.3-1.el8.x86_64                                           9/11 
  Running scriptlet: docker-ce-cli-1:26.1.3-1.el8.x86_64                                           9/11 
  Installing       : docker-ce-rootless-extras-26.1.3-1.el8.x86_64                                10/11 
  Running scriptlet: docker-ce-rootless-extras-26.1.3-1.el8.x86_64                                10/11 
  Installing       : docker-ce-3:26.1.3-1.el8.x86_64                                              11/11 
  Running scriptlet: docker-ce-3:26.1.3-1.el8.x86_64                                              11/11 
  Running scriptlet: container-selinux-2:2.229.0-2.module+el8.10.0+90541+332b2aa7.noarch          11/11 
  Running scriptlet: docker-ce-3:26.1.3-1.el8.x86_64                                              11/11 
  Verifying        : containerd.io-1.6.32-3.1.el8.x86_64                                           1/11 
  Verifying        : docker-buildx-plugin-0.14.0-1.el8.x86_64                                      2/11 
  Verifying        : docker-ce-3:26.1.3-1.el8.x86_64                                               3/11 
  Verifying        : docker-ce-cli-1:26.1.3-1.el8.x86_64                                           4/11 
  Verifying        : docker-ce-rootless-extras-26.1.3-1.el8.x86_64                                 5/11 
  Verifying        : docker-compose-plugin-2.27.0-1.el8.x86_64                                     6/11 
  Verifying        : libcgroup-0.41-19.el8.x86_64                                                  7/11 
  Verifying        : container-selinux-2:2.229.0-2.module+el8.10.0+90541+332b2aa7.noarch           8/11 
  Verifying        : fuse-overlayfs-1.13-1.module+el8.10.0+90541+332b2aa7.x86_64                   9/11 
  Verifying        : libslirp-4.4.0-2.module+el8.10.0+90541+332b2aa7.x86_64                       10/11 
  Verifying        : slirp4netns-1.2.3-1.module+el8.10.0+90541+332b2aa7.x86_64                    11/11 

Installed:
  container-selinux-2:2.229.0-2.module+el8.10.0+90541+332b2aa7.noarch                                   
  containerd.io-1.6.32-3.1.el8.x86_64                                                                   
  docker-buildx-plugin-0.14.0-1.el8.x86_64                                                              
  docker-ce-3:26.1.3-1.el8.x86_64                                                                       
  docker-ce-cli-1:26.1.3-1.el8.x86_64                                                                   
  docker-ce-rootless-extras-26.1.3-1.el8.x86_64                                                         
  docker-compose-plugin-2.27.0-1.el8.x86_64                                                             
  fuse-overlayfs-1.13-1.module+el8.10.0+90541+332b2aa7.x86_64                                           
  libcgroup-0.41-19.el8.x86_64                                                                          
  libslirp-4.4.0-2.module+el8.10.0+90541+332b2aa7.x86_64                                                
  slirp4netns-1.2.3-1.module+el8.10.0+90541+332b2aa7.x86_64                                             

Complete!

$ sudo systemctl start docker

$ sudo systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2025-06-07 00:39:56 GMT; 13s ago
     Docs: https://docs.docker.com
 Main PID: 52689 (dockerd)
    Tasks: 8
   Memory: 33.5M
   CGroup: /system.slice/docker.service
           └─52689 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
````

## gitからDifyのクローン
```
$ git clone https://github.com/langgenius/dify.git

Cloning into 'dify'...
remote: Enumerating objects: 173891, done.
remote: Counting objects: 100% (1460/1460), done.
remote: Compressing objects: 100% (677/677), done.
remote: Total 173891 (delta 1186), reused 788 (delta 783), pack-reused 172431 (from 5)
Receiving objects: 100% (173891/173891), 96.25 MiB | 22.37 MiB/s, done.
Resolving deltas: 100% (126028/126028), done.
```

## Difyの起動
```
$ cd dify/docker

$ cp .env.example .env

$ docker compose up -d

[+] Running 81/10
 ✔ web Pulled                                                                                                                          154.0s 
 ✔ sandbox Pulled                                                                                                                      104.6s 
 ✔ worker Pulled                                                                                                                       154.6s 
 ✔ api Pulled                                                                                                                          154.5s 
 ✔ redis Pulled                                                                                                                          4.5s 
 ✔ db Pulled                                                                                                                           104.6s 
 ✔ weaviate Pulled                                                                                                                      94.3s 
 ✔ plugin_daemon Pulled                                                                                                                 94.4s 
 ✔ nginx Pulled                                                                                                                         81.1s 
 ✔ ssrf_proxy Pulled                                                                                                                    81.1s 
[+] Running 12/12
 ✔ Network docker_default             Created                                                                                            0.2s 
 ✔ Network docker_ssrf_proxy_network  Created                                                                                            0.1s 
 ✔ Container docker-web-1             Started                                                                                            3.1s 
 ✔ Container docker-weaviate-1        Started                                                                                            1.8s 
 ✔ Container docker-sandbox-1         Started                                                                                            2.5s 
 ✔ Container docker-db-1              Healthy                                                                                            5.7s 
 ✔ Container docker-ssrf_proxy-1      Started                                                                                            3.0s 
 ✔ Container docker-redis-1           Started                                                                                            2.5s 
 ✔ Container docker-plugin_daemon-1   Started                                                                                            8.0s 
 ✔ Container docker-api-1             Started                                                                                            8.3s 
 ✔ Container docker-worker-1          Started                                                                                            8.7s 
 ✔ Container docker-nginx-1           Started                                                                                            9.5s 

```

## Dify 動作確認
```
$ docker compose ps
NAME                     IMAGE                                       COMMAND                  SERVICE         CREATED              STATUS                        PORTS
docker-api-1             langgenius/dify-api:1.4.1                   "/bin/bash /entrypoi…"   api             About a minute ago   Up About a minute             5001/tcp
docker-db-1              postgres:15-alpine                          "docker-entrypoint.s…"   db              About a minute ago   Up About a minute (healthy)   5432/tcp
docker-nginx-1           nginx:latest                                "sh -c 'cp /docker-e…"   nginx           About a minute ago   Up About a minute             0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp
docker-plugin_daemon-1   langgenius/dify-plugin-daemon:0.1.1-local   "/bin/bash -c /app/e…"   plugin_daemon   About a minute ago   Up About a minute             0.0.0.0:5003->5003/tcp, :::5003->5003/tcp
docker-redis-1           redis:6-alpine                              "docker-entrypoint.s…"   redis           About a minute ago   Up About a minute (healthy)   6379/tcp
docker-sandbox-1         langgenius/dify-sandbox:0.2.12              "/main"                  sandbox         About a minute ago   Up About a minute (healthy)   
docker-ssrf_proxy-1      ubuntu/squid:latest                         "sh -c 'cp /docker-e…"   ssrf_proxy      About a minute ago   Up About a minute             3128/tcp
docker-weaviate-1        semitechnologies/weaviate:1.19.0            "/bin/weaviate --hos…"   weaviate        About a minute ago   Up About a minute             
docker-web-1             langgenius/dify-web:1.4.1                   "/bin/sh ./entrypoin…"   web             About a minute ago   Up About a minute             3000/tcp
docker-worker-1          langgenius/dify-api:1.4.1                   "/bin/bash /entrypoi…"   worker          About a minute ago   Up About a minute             5001/tcp
```

## Difyへのアクセス

http://[server_ip]/install

管理者登録（メアド、ユーザー、パスワードを設定）
![CleanShot 2025-06-07 at 10.00.40.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/276568/2b660a2d-0383-4f1f-a476-68bdc5714f28.png)

ログイン
![CleanShot 2025-06-07 at 10.02.35.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/276568/717c49aa-d5fc-4cad-8ef5-5422d376b740.png)

ログインできましｔ
![CleanShot 2025-06-07 at 10.03.47.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/276568/c04b1bad-6766-4a7d-a1c7-7b1789da0225.png)