0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Difyをセットアップしよう

0
Last updated at Posted at 2025-12-29

記事一覧:https://qiita.com/takulabo/items/d5f56132c02d4136687c

Difyのセットアップ手順

 Difyのセットアップ手順の案内になります。

セルフホスト版の最低限のシステム要件

制限なくDifyを使いたい場合や、機密データを扱いたい場合は、自身のローカル環境にセットアップできます。
この場合、以下の最低限のシステム要件を満たす必要があります。

構成 要件
CPU 2コア以上
メモリ 4GB以上(8GB以上推奨)
ストレージ 20GB以上
ソフト Git、Docker
OS Windows 10/11、macOS、
またはLinux (Ubuntu 20.04以降が推奨)

①事前状態確認

OS/アーキテクチャ確認

terminal
uname -a
uname -m
lsb_release -a

例:

  • aarch64
  • /Debian 12(Bookworm)

メモリ・ストレージ確認

terminal
free -h
df -h /
  • Mem: 4GB以上
    4GB以下の場合、swapを足しておきましょう。
    →「環境調整」で実施します。
  • / に 20GB以上の空き
    Dify + DB + Redis + logs で 8〜10GB 消費します。

時刻同期

terminal
timedatectl status
  • System clock synchronized: yes であること
    → no の場合は後で証明書エラーが出ます

cgroup v2 確認

terminal
stat -fc %T /sys/fs/cgroup/
  • cgroup2fs→ 出ていればOK

iptables backend 確認

terminal
iptables --version
  • 後でDockerが自動導入します。

②Dockerのインストール

Dockerインストール状態確認

terminal
docker version

バージョン情報が表示されれば、
インストール済みのため②手順は飛ばしてOKです。
「docker: command not found」の場合インストールを実施しましょう。

Docker インストール

terminal
curl -fsSL https://get.docker.com | sh

docker起動 & 自動起動

terminal
sudo systemctl enable docker
sudo systemctl start docker

ユーザーをdockerグループへ

terminal
sudo usermod -aG docker $USER
newgrp docker

Docker動作確認

terminal
docker version

Client: / Server: 両方表示されること。

terminal
docker run hello-world

「hello-world」が表示されること。

terminal
docker compose version

これでdockerセットアップは完了です。

環境調整

swapを4GBに拡張
※メモリが4GB以下の場合実施
Dify 初回起動時は api が一瞬で 2GB 超えることがあります。
なので file swap を厚くします。

確認

terminal
swapon --show
free -h

「Memory:4GB、zram2GB」の場合+「filwswap 2GB」とします

terminal
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

確認

terminal
swapon --show
free -h

「zram0 2G、swapfile 2G」
「Swap:4.0Gi」
となっていることを確認できればOKです!

③ Dify のインストール

フォルダ構成
/home/user
└─ services/
  └─ dify/
作業ディレクトリ作成

termminal
mkdir -p ~/services/dify
cd ~/services/dify

公式リポジトリを clone

termminal
git clone https://github.com/langgenius/dify.git

環境ファイルをコピー

termminal
cp .env.example .env

編集
※ローカル以外からもアクセスする場合は、設定が必要です。

termminal
nano .env

下記3か所の部分にアドレスを設定して保存

CONSOLE_API_URL=http://[IPaddress]
CONSOLE_WEB_URL=http://[IPaddress]
SERVICE_API_URL=http://[IPaddress]

例:CONSOLE_API_URL=http://192.168.0.10
 
「Ctrl+o」→[Enter]:保存
「Ctrl+x」:閉じる

termminal
docker compose up -d

ブラウザアクセス

http://localhost

or

http://[IPaddress]

Web表示確認
下記画面が表示されれば、Difyのインストールは完了です。
image.png

④Dify設定

アカウント設定
アドレス、ユーザ名、パスワードを入力
「セットアップ」をクリックし次に進みます。
image.png


Difyログイン
メールアドレス、パスワードを入力
「サインイン」をクリックし次に進みます。
image.png


Difyログイン完了確認
ログインできることを確認
image.png

おつかれさまでした!
上記画面が確認できれば、Difyセットアップが完了です。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?