跳转到内容

安装

组件要求
OSLinux、macOS、Windows
Rust1.95+
Memory4 GB RAM
Disk2 GB 可用空间
组件要求
Rust1.95+(最新支持版本)
Memory8 GB RAM
CPU多核处理器

如果你还没有安装 Rust:

Terminal window
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

设置正确的 toolchain 版本:

Terminal window
rustup default 1.95

添加用于构建 components 的 WASM target:

Terminal window
rustup target add wasm32-wasip2

先安装 gtc router,然后让 gtc install 安装 Greentic companion tools。正常使用时不要直接安装 greentic-cli 或单独的 companion crates;gtc install 会让 delegated binaries 与 router 保持一致。

Terminal window
cargo install cargo-binstall
cargo binstall gtc
gtc install
gtc doctor
Terminal window
gtc --version
gtc doctor

用于生产环境中的 session 持久化:

Terminal window
docker run -d --name redis -p 6379:6379 redis:alpine

用于基于 webhook 的 providers(Telegram、Slack 等):

Terminal window
# Install
brew install ngrok/ngrok/ngrok # macOS
# or download from https://ngrok.com/download
# Configure
ngrok config add-authtoken YOUR_TOKEN
# Run
ngrok http 8080

安装或更新 gtc router 使用的 delegated Greentic binaries:

Terminal window
gtc install

使用 gtc install --dry-run 预览安装计划。对于受控环境,可以固定 toolchain:

Terminal window
gtc install --release 1.0.15
gtc install --manifest ./greentic-toolchain.json

gtc install 会安装标准 companion tools。对于独立 component development,也可以安装 cargo-component

Terminal window
cargo binstall cargo-component

然后使用 delegated component surface:

Terminal window
gtc dev component --help

运行以下命令以确认一切正常:

Terminal window
# Check GTC CLI
gtc --help
# Check Rust WASM target
rustup target list --installed | grep wasm32-wasip2
# Create and run a test bundle
gtc wizard --dry-run

错误:“wasm32-wasip2 target not found”

Terminal window
rustup target add wasm32-wasip2

错误:“Permission denied”

Terminal window
# On Linux/macOS, ensure binary is executable
chmod +x /usr/local/bin/gtc