2026年10月22日木曜日

Codex CLI + ollama + gemma4 設定メモ

Codex CLI + ollama + gemma4 設定メモ

概要

大事なのはコンテキストでした

環境

  • Ubuntu 24.04
  • 8vCPU 32GBメモリ
  • gemma4:26b

ollama インストール

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

codex インストール

  • curl -fsSL https://chatgpt.com/codex/install.sh | sh

モデルダウンロード

  • ollama pull gemma4:26b

ollama 設定

  • sudo systemctl edit ollama.service
### Editing /etc/systemd/system/ollama.service.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file

[Service]
Environment="OLLAMA_CONTEXT_LENGTH=66536"


### Edits below this comment will be discarded


### /etc/systemd/system/ollama.service
# [Unit]
# Description=Ollama Service
# After=network-online.target
#
# [Service]
# ExecStart=/usr/local/bin/ollama serve
# User=ollama
# Group=ollama
# Restart=always
# RestartSec=3
# Environment="PATH="
#
# [Install]
# WantedBy=default.target
  • sudo systemctl daemon-reload
  • sudo systemctl restart ollama

サンドボックス設定

codex 起動

  • ollama launch codex

で gemma4:26b を選択

動作確認

あとは命令するだけです
コンテキストを長くしないと codex cli が命令を実行してくれません

最後に

メモリが十分にないとコンテキストを64kにできないのでメモリを潤沢にしましょう

0 件のコメント:

コメントを投稿