> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/jp/tong-he/connections/ollama.md).

# OllamaをUnslothに接続する方法

Ollamaを使うと、自分のハードウェア上でローカルLLMを実行でき、 [Unsloth](https://github.com/unslothai/unsloth) これらのモデルをオープンソースのUIチャットインターフェースに直接接続して実行するのが簡単になります。このガイドでは、Ollamaのインストール方法、ネイティブのOllamaモデルやHugging FaceのGGUFモデルの実行方法、OllamaをUnslothに接続する方法、そしてローカルAIモデルとのチャットを始める方法を学びます。

次のようなモデルを使いたい場合でも [Qwen](/docs/jp/moderu/qwen3.6.md)、GGUFファイルをインポートする場合でも、ローカルのOllamaサーバーをOpenAI互換のエンドポイント経由で公開する場合でも、この手順ではインストールから最初のチャットまでの全体設定をカバーします。

### セットアップ

{% stepper %}
{% step %}

#### Ollamaをインストールまたは準備する

{% tabs %}
{% tab title="macOS" %}
インストールスクリプトを使ってOllamaをインストールします:

```bash
curl -fsSL https://ollama.com/install.sh | sh
```

また、以下からOllamaを手動でダウンロードすることもできます [ollama.com/download](https://ollama.com/download).
{% endtab %}

{% tab title="Windows" %}
PowerShellからOllamaをインストールします:

```powershell
irm https://ollama.com/install.ps1 | iex
```

また、以下からOllamaを手動でダウンロードすることもできます [ollama.com/download](https://ollama.com/download/OllamaSetup.exe).
{% endtab %}

{% tab title="Linux" %}
インストールスクリプトを使ってOllamaをインストールします:

```bash
curl -fsSL https://ollama.com/install.sh | sh
```

また、以下からOllamaを手動でダウンロードすることもできます [ollama.com/download](https://docs.ollama.com/linux#manual-install).
{% endtab %}

{% tab title="Docker" %}
Ollamaの公式Dockerイメージは `ollama/ollama` です（Docker Hub上）。

```bash
docker run -d \
  -v ollama:/root/.ollama \
  -p 11434:11434 \
  --name ollama \
  ollama/ollama
```

{% endtab %}
{% endtabs %}

通常、Ollamaは次の場所で実行されます:

```
http://localhost:11434
```

{% endstep %}

{% step %}

#### モデルを実行する

モデルの選び方は、一般的に次の2通りです:

* ネイティブのOllamaモデルを以下で検索します [ollama.com/search](https://ollama.com/search)、その後モデル名をコピーします。
* Hugging FaceのGGUFモデルを使い、次の場所からOllamaコマンドをコピーします **このモデルを使用する**.

Ollamaモデルの場合は、プルして実行します:

```bash
ollama pull qwen3.6:35b-a3b
ollama run qwen3.6:35b-a3b
```

Ollamaアプリまたはサービスがまだ起動していない場合は、先に起動してください:

```bash
ollama serve
```

#### Hugging FaceからGGUFを選ぶ

Hugging FaceのGGUFモデルを使う場合、コマンドを取得する最も簡単な方法はモデルページからです。

使いたいモデルを開いて、 **このモデルを使用する**をクリックし、次に **Ollama** をローカルアプリ一覧から選択します。ドロップダウンから使いたい量子化を選び、生成されたコマンドをコピーします。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FRSR0qWpzSRJgeSIghoWO%2Fexport-1779051800964-small.gif?alt=media&amp;token=8e557e60-2e11-420e-a7f4-dd80533bd86b" alt=""><figcaption></figcaption></figure>

たとえば、Ollamaでは:

```bash
ollama run hf.co/unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_XL
```

これにより、リポジトリ名や量子化タグの間違いを防ぐことができます。
{% endstep %}

{% step %}

#### OllamaをUnslothに接続する

開く **設定 → 接続**、次に **接続を追加**.

選択 **Ollama**を開き、接続情報を入力します:

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FIKDXfJZmRQVA742rXAHA%2Fimage.png?alt=media&amp;token=6c7105a0-9f6e-435b-bafb-1502e22331bd" alt="" width="563"><figcaption></figcaption></figure>

Unslothのフォームに表示されるOllamaのURLを使用します。ほとんどのローカル設定では、これは次のとおりです:

```
http://localhost:11434
```

UnslothがOpenAI互換のベースURLを求める場合は、次を使用します:

```
http://localhost:11434/v1
```

通常、OllamaにAPIキーは不要です。プロキシが必要とする場合を除き、APIキー欄は空欄のままにしてください。

クリックします **モデルを読み込む** Ollamaで実行中のモデルを取得するか、 **モデルID** を直接入力します。たとえば `qwen3.6`.
{% endstep %}

{% step %}

#### チャット準備完了

をクリックすると、 **接続を追加**で有効化したモデルが表示されるようになります。 **接続済み** の **モデルを選択** ドロップダウンに表示されます。
{% endstep %}
{% endstepper %}

#### よく使うOllamaコマンド

Unslothに公開したいモデルを設定する際に、これらを使います:

| コマンド                          | 機能                     |
| ----------------------------- | ---------------------- |
| `ollama run qwen3.6:35b-a3b`  | モデルを実行して対話型チャットを開く     |
| `ollama pull qwen3.6:35b-a3b` | チャットを開始せずにモデルをダウンロードする |
| `ollama ls`                   | ダウンロード済みモデルを一覧表示する     |
| `ollama ps`                   | 現在実行中のモデルを一覧表示する       |
| `ollama stop qwen3.6:35b-a3b` | 実行中のモデルを停止する           |
| `ollama rm qwen3.6:35b-a3b`   | ダウンロードしたモデルを削除する       |
| `ollama serve`                | Ollamaサーバーを起動する        |

ローカルのGGUFをOllamaに取り込む場合は、 `Modelfile`を作成してから、次を実行します:

```bash
ollama create -f Modelfile
```

Ollamaが検出されない場合は、Ollamaアプリまたはサービスが実行中であることを確認してください。その後、Unslothで **モデルを読み込む** をもう一度クリックします。

完全なコマンド一覧については、以下を参照してください [Ollama CLIリファレンス](https://docs.ollama.com/cli).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/jp/tong-he/connections/ollama.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
