> For AI agents: the complete documentation index is available at /docs/llms.txt, the full documentation bundle is available at /docs/llms-full.txt.

# 远端 AI

## 环境

切换用户

```bash
sudo useradd -m -s /bin/bash agent-user
echo "agent-user:123456" | sudo chpasswd
sudo chown -R agent-user:agent-user /home/agent-user
# 切换到
su - agent-user
```

通过 mise 安装如下环境：

```bash
# 安装 node
mise use --global node@24
node -v
# 配置 npm 镜像源
npm config set registry https://registry.npmmirror.com
npm config get registry

# 安装 java
mise use --global java@21
java -version

# 安装 maven
mise use --global maven@3.9.16
mvn -v
# 阿里云代理配置在 mise 的全局配置中
mvn help:effective-settings

# 安装 python
mise use --global python@3.12
python --version
```

## 模型网关

### magpie

直接安装，通过代理下载 release

```bash
curl -fsSL https://usemagpie.ai/install.sh | sh -s -- --mirror https://gh-proxy.com/

```

本地 ssh 配置端口转发，打开 magpie web 页面进行模型配置，以 [tabby](https://tabby.sh/) 为例：

## Agent

安装 agent

- claude code。`npm install -g @anthropic-ai/claude-code`
- codex。`npm install -g @openai/codex`

## T3 Code

```bash
## 配置代理
export T3CODE_RELEASE_BASE_URL=https://gh-proxy.com/https://github.com/pingdotgg/t3code/releases/download
export T3CODE_TELEMETRY_ENABLED=false

## npm 方式安装
npm install -g t3@0.1.7
t3 service install
```

为了开启外部连接，配置 systemd：

```bash
# 创建配置目录
mkdir -p ~/.config/systemd/user/t3code.service.d

# 写入 Host 配置
cat > ~/.config/systemd/user/t3code.service.d/override.conf <<'EOF'
[Service]
Environment=T3CODE_HOST=0.0.0.0
Environment=T3CODE_TELEMETRY_ENABLED=false

EOF

# 重新加载并重启服务
systemctl --user daemon-reload
systemctl --user restart t3code

# 验证配置
systemctl --user show t3code -p Environment
t3 service status

# 远程连接
t3 pair
```

## orca

[orca](https://github.com/stablyai/orca) 是一个桌面应用，在 linux 上以 server 形式运行，不启动桌面窗口，并通过手机端或其他电脑桌面端访问 orca server。

下载后先安装 xvfb。orca 在 linux 检测缺少 `DISPLAY` 时会启动 xvfb，需预先安装 xvfb，具体安装命令可让大模型提供：

```bash
sudo dnf install xorg-x11-server-Xvfb -y
```

尝试启动，验证环境：

```bash
LIBGL_ALWAYS_SOFTWARE=1 ./orca-linux.AppImage serve --port 6768
```

如果出现报错，错误信息说明缺少依赖或文件，则需要补足依赖，直到能够正常启动

在腾讯云 opencloudos 上需安装如下依赖：

```bash
yum install -y libgbm alsa-lib
```

### systemd

确定能够正常启动后，配置 systemd。

`--pairing-address` 替换为可供外界连接的公网ip。

```bash
mkdir -p /etc/systemd/system && touch /etc/systemd/system/orca-serve.service

cat > /etc/systemd/system/orca-serve.service <<'EOF'
[Unit]
Description=Orca runtime server
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=300
StartLimitBurst=5

[Service]
Type=simple
User=agent-user
WorkingDirectory=/home/agent-user/orca
Environment=LIBGL_ALWAYS_SOFTWARE=1
ExecStart=/home/agent-user/orca/orca-linux.AppImage serve --port 6768 --pairing-address <my-open-ip>
StandardOutput=journal
StandardError=journal
KillMode=mixed
Restart=on-failure
RestartPreventExitStatus=3
RestartSec=5

[Install]
WantedBy=multi-user.target


EOF
```

启动

```bash
systemctl daemon-reload
systemctl enable --now orca-serve.service
systemctl disable orca-serve.service
systemctl start orca-serve.service
systemctl stop orca-serve.service
systemctl restart orca-serve.service

journalctl -u orca-serve.service -f
```

启动成功后，通过日志检索出配对链接：

```bash
journalctl -u orca-serve.service -o cat \
  | jq -Rrc 'fromjson? | select(.type == "orca_server_ready" and .schemaVersion == 1)'
```

安装 skill。linux server 没有设置界面，该用 cli 安装：

```bash

orca skills install                                   # 列出可安装技能
orca skills install --skill orca-cli --skill orchestration
orca skills install --all --dry-run                   # 只打印将执行的命令
```
