> 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 ファイルをインポートしたい場合でも、あるいは OpenAI 互換エンドポイントを通じてローカルの Ollama サーバーを公開したい場合でも、このウォークスルーではインストールから最初のチャットまでの完全なセットアップをカバーします。

### セットアップ

{% 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 モデルの場合は、pull して実行します:

```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="/files/ffd3a12d07e5420b67e685372ca47f9b8f14b381" 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="/files/3a10b646e3b31f48ba1b8c3e33475be009091473" alt="" width="563"><figcaption></figcaption></figure>

Unsloth のフォームに表示されている Ollama URL を使用してください。ほとんどのローカルセットアップでは、これは次のとおりです:

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

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

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

通常、Ollama に API キーは不要です。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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
