# 手動インストール

> Docker Compose を使用して PentAGI を手動でデプロイします。作業ディレクトリを作成し、.env ファイルを設定して LLM provider を追加し、スタックを起動します。

設定を完全に制御したい場合や、対話型インストーラーを実行できない場合は、手動でのセットアップを行ってください。

## [1. 作業ディレクトリの作成](https://pentagi.com/ja/docs/getting-started/manual-installation/#1-create-a-working-directory)

```bash
mkdir -p ~/pentagi && cd ~/pentagi
```

## [2. 環境ファイルのダウンロード](https://pentagi.com/ja/docs/getting-started/manual-installation/#2-download-the-environment-file)

```bash
test -f .env || curl -fo .env.new https://raw.githubusercontent.com/vxcontrol/pentagi/main/.env.example
test -f .env.new && openssl rand -hex 32 | xargs -I VALUE sed -E -i.bak 's/^COOKIE_SIGNING_SALT=salt( .*)?$/COOKIE_SIGNING_SALT=VALUE/' .env.new
test -f .env.new && openssl rand -hex 16 | xargs -I VALUE sed -E -i.bak 's/^PENTAGI_POSTGRES_PASSWORD=postgres( .*)?$/PENTAGI_POSTGRES_PASSWORD=VALUE/' .env.new
test -f .env || mv .env.new .env
```

Composeファイルは3つの[provider](https://pentagi.com/ja/docs/glossary/#provider)設定ファイルをマウントするため、それらを作成してください（空ファイルで問題ありません）。

```bash
touch example.custom.provider.yml example.ollama.provider.yml example.bedrock.provider.yml
```

カスタムのOpenAI互換エンドポイントやOllamaを使用する予定がある場合は、空ファイルの代わりにサンプル設定を取得し、`.env`内の`LLM_SERVER_CONFIG_PATH`または`OLLAMA_SERVER_CONFIG_PATH`を`/opt/pentagi/conf/custom.provider.yml`または`/opt/pentagi/conf/ollama.provider.yml`に向けます。カスタムの例では、2026年10月23日にOpenAIが退役させる`o3-mini`を含むOpenAIモデルが指定されています。各[agent type](https://pentagi.com/ja/docs/glossary/#agent-type)の`model`を、あなたのエンドポイントが提供するものに設定してください。

```bash
curl -o example.custom.provider.yml https://raw.githubusercontent.com/vxcontrol/pentagi/main/examples/configs/custom-openai.provider.yml
curl -o example.ollama.provider.yml https://raw.githubusercontent.com/vxcontrol/pentagi/main/examples/configs/ollama-llama318b.provider.yml
```

## [3. LLM providerの追加](https://pentagi.com/ja/docs/getting-started/manual-installation/#3-add-at-least-one-llm-provider)

`.env`を編集し、少なくとも1つのproviderのキーを設定します。

```bash
OPEN_AI_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
GEMINI_API_KEY=your_gemini_key
```

その他のproviders（AWS Bedrock、Ollama、DeepSeek、GLM、Kimi、Qwen、MiniMax、Mistral、xAI、およびカスタムエンドポイント）については、[LLM providers](https://pentagi.com/ja/docs/configuration/llm-providers/)で説明されています。[Search engines](https://pentagi.com/ja/docs/glossary/#search-engine)はオプションです。DuckDuckGoとSploitusにはキーは不要です。

```bash
DUCKDUCKGO_ENABLED=true
SPLOITUS_ENABLED=true
TAVILY_API_KEY=your_tavily_key
```

## [4. スタックの起動](https://pentagi.com/ja/docs/getting-started/manual-installation/#4-start-the-stack)

```bash
curl -O https://raw.githubusercontent.com/vxcontrol/pentagi/main/docker-compose.yml
test -f .env && docker compose up -d
```

Web UIは`https://localhost:8443`で提供されます。`admin@pentagi.com` / `admin`でサインインし、パスワードを変更してください。

Web UI と他のサービスは localhost にバインドされていますが、各 [flow](https://pentagi.com/ja/docs/glossary/#flow) の [sandbox](https://pentagi.com/ja/docs/glossary/#sandbox) は、デフォルトで `28000`–`29999` の2つのコールバックポートを Docker ホストのすべてのインターフェース上で公開し、ufw はそれらをフィルタリングしません。他のユーザーがアクセス可能なホストでは、まずその範囲を制限してください。詳細は [Network exposure](https://pentagi.com/ja/docs/configuration/security/#network-exposure) を参照してください。後でインストールを更新するには、[Upgrading](https://pentagi.com/ja/docs/deployment/upgrade/) に従ってください。

## [オプションスタック](https://pentagi.com/ja/docs/getting-started/manual-installation/#optional-stacks)

各オプションサービスは個別のComposeファイルとして提供されており、ベースのスタックに重ねて使用できます。

| スタック                                               | Composeファイル                                                                                        | 追加される機能                                           |
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| LLM可観測性                                            | [`docker-compose-langfuse.yml`](https://pentagi.com/ja/docs/configuration/observability/#langfuse)                       | ClickHouse、Redis、MinIOを含むLangfuse                 |
| [Knowledge graph](https://pentagi.com/ja/docs/glossary/#knowledge-graph) | [`docker-compose-graphiti.yml`](https://pentagi.com/ja/docs/concepts/memory/#knowledge-graph-optional)                   | GraphitiおよびNeo4j                                  |
| システム可観測性                                           | [`docker-compose-observability.yml`](https://pentagi.com/ja/docs/configuration/observability/#grafana-and-opentelemetry) | Grafana、OpenTelemetry、VictoriaMetrics、Jaeger、Loki |

> [!WARNING]
> 本番環境や信頼されていないコードが実行される環境では、[tool](https://pentagi.com/ja/docs/glossary/#tool)コンテナを専用の[worker node](https://pentagi.com/ja/docs/deployment/worker-node/)上で分離してください。