文章目录
- [安装 goose](#安装 goose)
- [配置 goose 的 provider](#配置 goose 的 provider)
-
- [使用 qwen 作为 provider](#使用 qwen 作为 provider)
- [使用 command-line-assistant 作为 provider](#使用 command-line-assistant 作为 provider)
- 切换使用的模型
- [使用 goose](#使用 goose)
- 参考
安装 goose
- 确认 RHEL 版本是 RHEL 至少是 10.2 或 9.8 版本。本文使用的是 RHEL 10.2。
bash
$ cat /etc/redhat-release
Red Hat Enterprise Linux release 10.2 (Coughlan)
- 配置 RHEL 10 的 YUM Repo。
bash
$ subscription-manager repos --enable=rhel-10-for-$(arch)-extensions-rpms
- 安装 goose-redhat 软件包。goose-redhat 包中不但包括了 goose,还包括 goose-proxy 和 goose-proxy-selinux。
bash
$ dnf install -y goose-redhat
- 为了 goose 的配置使生效,启用一个新的 shell 会话。
- (可选)参照《RHEL - 在离线的 RHEL 10 中部署 Lightspeed》一文安装 RHEL Lightspeed 的 command-line-assistant 工具。说明:goose 可以直接调用本机的 command-line-assistant,也可调用多种大语言模型。
配置 goose 的 provider
- 运行命令,配置 goose。
bash
$ goose configure
- 在
Share anonymous usage data to help improve goose?步骤选择合适的选项。

- 在
How would you like to set up your provider?步骤选择Manual Configuration (Choose a provider and enter credentials manually)

使用 qwen 作为 provider
- 可在另一个终端窗口先确认当前 qwen 模型可以访问。
bash
$ URL=<YOUR_HOST>
$ TOKEN=<YOUR_ACCESS_TOKEN>
$ curl -sk $URL/v1/completions \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d '{"model":"Qwen3.6-35B-A3B","prompt":"Red Hat OpenShift AI is","max_tokens":128}' | jq
{
"id": "cmpl-b4ee7eea9082e3ed",
"object": "text_completion",
"created": 1792737965,
"model": "qwen38-27b-fp8",
"choices": [
{
"stop_reason": null,
"token_ids": null,
"prompt_logprobs": null,
"prompt_token_ids": null,
"routed_experts": null,
"finish_reason": "length",
"index": 0,
"text": " an AI platform that enables AI practitioners, data scientists, and developers to create, deploy, and manage AI models and pipelines in a secure and efficient manner.\nFor OpenShift AI 2.13, it includes OpenShift Pipelines, an event-driven, GitOps-native, continuous integration/continuous delivery (CI/CD) framework that enables developers to build, test, and deploy applications to any platform.\nOpenShift AI supports both the v1 and the v2 pipelines engine (TektonCD), and allows users to opt in to either engine. The v1 pipeline engine was removed in 2.14. The",
"logprobs": null
}
],
"usage": {
"completion_tokens": 128,
"prompt_tokens": 6,
"total_tokens": 134,
"completion_tokens_details": null,
"prompt_tokens_details": null
},
"system_fingerprint": "vllm-0.28.0-tp4-518e74d4",
"service_tier": null,
"kv_transfer_params": null,
"ec_transfer_params": null,
"metrics": null
}
- 在原有终端的
What would you like to configure?步骤中选择Configure Providers。

- 在
Which model provider should we use?步骤选择OpenAI (GPT-4 and other OpenAI models, including OpenAI compatible ones)。

- 在
Would you like to set OPENAI_API_KEY? (optional)步骤选择 Yes。

- 在
Enter value for OPENAI_API_KEY后提供访问 qwen 模型的 OPENAI_API_KEY 内容。

- 在
Would you like to configure advanced settings?步骤选择 Yes。

- 跳过
Enter OPENAI_BASE_URL (optional, press Enter to skip)步骤。 - 在
Provider OpenAI requires OPENAI_HOST, please enter a value步骤提供访问 Qwen 模型的主机地址。

- 在
Provider OpenAI requires OPENAI_BASE_PATH, please enter a value步骤中接受默认值。 - 跳过
Enter OPENAI_ORGANIZATION (optional, press Enter to skip)步骤。 - 跳过
Enter OPENAI_PROJECT (optional, press Enter to skip)步骤。 - 在
Would you like to set OPENAI_CUSTOM_HEADERS? (optional)步骤选择 No。

- 在
Enter OPENAI_TIMEOUT (optional, press Enter to skip)步骤中接受默认值。 - 如果前面提供的配置有效,在
Select a model步骤中可以显示出能访问的模型。可以选择一个可用的模型。

- 最后 goose 会验证所有配置,并将其保存到当前用户下的 ~/.config/goose/config.yaml 配置文件中。

- 查看 config.yaml 配置文件中已包含以下内容。
bash
$ cat ~/.config/goose/config.yaml
。。。
OPENAI_HOST: https://litemaas.rhoai.rh-aiservices-bu.com
OPENAI_BASE_PATH: v1/chat/completions
OPENAI_TIMEOUT: '600'
active_provider: openai
providers:
openai:
enabled: true
model: Qwen3.6-35B-A3B
configured: true
- 执行 goose 命令,确认使用了前面选择的 Qwen3.6-35B-A3B 模型。
bash
$ goose

注意:可以用环境变量覆盖 config.yml 中的配置。
bash
$ export GOOSE_PROVIDER=openai
$ export GOOSE_MODEL=Qwen3.6-35B-A3B
$ export OPENAI_HOST=<YOUR_HOST>
$ export OPENAI_API_KEY=<YOUR_API_KEY>
$ goose session
使用 command-line-assistant 作为 provider
注意:首先确保当前 RHEL 已安装了 command-line-assistant。另外在 goose configure 的 provider 列表中默认是没有 command-line-assistant 的,只有在创建以下 custom provider 后才会出现(创建过程:系统会自动发现并创建,也可手动按以下文件命和内容创建)。
- 确认手动或系统已自动在 ~/.config/goose/custom_providers 目录下创建了含有以下内容的 rhel_cla.json 文件。
json
$ cat ~/.config/goose/custom_providers/rhel_cla.json
{
"name": "rhel_cla",
"engine": "openai",
"display_name": "RHEL command line assistant",
"description": "Inference provided by Red Hat with RHEL specific knowledge",
"api_key_env": "",
"base_url": "http://127.0.0.1:7080",
"base_path": "v1/chat/completions",
"models": [
{
"name": "RHEL-command-line-assistant",
"context_limit": 128000,
"input_token_cost": null,
"output_token_cost": null,
"currency": null,
"supports_cache_control": null
}
],
"headers": {},
"timeout_seconds": null,
"supports_streaming": true,
"requires_auth": true
}
- 执行配置命令。
bash
$ goose configure
- 先进入
Configure Providers,然后在Which model provider should we use?步骤中选择RHEL command line assistant。

- 其他步骤接受默认配置,直到完成配置即可。

- 执行命令,确认使用的是
RHEL command line assistant
bash
$ goose run -t "What is the current OS version and kernel release?"

切换使用的模型
- 在 goose 提示符后输入以下命令,可以切换当前会话使用的 provider 模型。
bash
> /model Qwen3.6-35B-A3B
mode: Session model switched from 'RHEL-command-line-assistant' to 'Qwen3.6-35B-A3B' for provider 'rhel_cla'
使用 goose
单次模式
- 每执行以下命令可完成一次 goose 调用。
bash
$ goose run -t "What is the current OS version and kernel release?"
- 执行完会回到 bash。
bash
__( O)> ● new session · openai Qwen3.6-35B-A3B
\____) 20261023_4 · /root/.config
L L goose is ready
────────────────────────────────────────
▸ shell
command: cat /etc/os-release 2>/dev/null | head -5; echo "---"; uname -r
NAME="Red Hat Enterprise Linux"
VERSION="10.2 (Coughlan)"
RELEASE_TYPE=stable
ID="rhel"
ID_LIKE="centos fedora"
---
6.12.0-211.67.1.el10_2.x86_64
Here's the current system info:
**OS:** Red Hat Enterprise Linux 10.2 (Coughlan)
**Kernel release:** 6.12.0-211.67.1.el10_2.x86_64
交互模式
- 运行 goose 命令进入交互模式,界面停在
> Enter to send · Ctrl+J newline提示符处。
bash
$ goose
__( O)> ● new session · rhel_cla RHEL-command-line-assistant
\____) 20261022_8 · /root
L L goose is ready
⚠️ This tool uses AI technology. Do not include any personal information or other sensitive information in your input. Interactions may be used to improve Red Hat's products or services.
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ 0% 0/128k
> Enter to send · Ctrl+J newline
- 在提示符后输入
What is the current OS version and kernel release?命令,然后查看返回结果。
bash
> What is the current OS version and kernel release?
────────────────────────────────────────
▸ shell
command: cat /etc/redhat-release && uname -r
Red Hat Enterprise Linux release 10.2 (Coughlan)
6.12.0-211.67.1.el10_2.x86_64
The current OS version is Red Hat Enterprise Linux release 10.2 (Coughlan) and the kernel release is 6.12.0-211.67.1.el10_2.x86_64.
**Sources:**
- None
⏱ 9.47s
Always review AI-generated content prior to use.
━╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ 7% 9k/128k
参考
https://access.redhat.com/articles/7142302
https://www.redhat.com/en/blog/supercharge-rhel-troubleshooting-agentic-ai-introducing-goose
https://developers.redhat.com/articles/2026/10/08/manage-rhel-mcp-servers-and-red-hat-lightspeed
https://github.com/rhel-lightspeed/goose
https://goose-docs.ai/docs/quickstart