openclaw部署

参考:
openclaw中文站安装引导
opencalw文档wsl安装引导

wsl设置mirror模式使用windows代理

错误现象:openclaw使用web_search技能与Duckduckgo通信失败
错误关键词:

wsl: 出现了内部错误。
错误代码: CreateInstance/CreateVm/ConfigureNetworking/0x8007054f
wsl: 检测到 localhost 代理配置,但未镜像到 WSL。
NAT 模式下的 WSL 不支持 localhost 代理

参考内容:
wsl: 无法配置网络 (networkingMode Nat),回退到无网络
虽然问题不同,同样有参考价值
其他博客内容类似在C盘用户的.wslconfig文件中配置内容貌似无作用

设置openclaw代理环境变量、配置 systemd 代理

错误现象,可以ping外网,却无法http访问?(描述不准,反正就是无法正常使用ddg等搜索)

openclaw环境变量

ip为本地环回地址
端口为代理软件自定义值

# 1. 把代理加到 ~/.bashrc
cat >> ~/.bashrc << 'EOF'

# Proxy for OpenClaw and other tools
export HTTP_PROXY=http://127.0.0.1:7897
export HTTPS_PROXY=http://127.0.0.1:7897
export http_proxy=http://127.0.0.1:7897
export https_proxy=http://127.0.0.1:7897
EOF

# 2. 立即生效
source ~/.bashrc

# 3. 验证
echo $HTTPS_PROXY

# 4. 重启 OpenClaw Gateway
openclaw gateway stop
sleep 2
openclaw gateway start

systemd

# 1. 创建 user systemd 覆盖配置目录
mkdir -p ~/.config/systemd/user/openclaw-gateway.service.d/

# 2. 创建代理配置
tee ~/.config/systemd/user/openclaw-gateway.service.d/proxy.conf << 'EOF'
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:7897"
Environment="HTTPS_PROXY=http://127.0.0.1:7897"
Environment="http_proxy=http://127.0.0.1:7897"
Environment="https_proxy=http://127.0.0.1:7897"
EOF

# 3. 重载 user systemd 配置
systemctl --user daemon-reload

# 4. 重启 Gateway
openclaw gateway stop
sleep 2
openclaw gateway start

# 5. 等 5 秒
sleep 5

# 6. 验证 Gateway 进程的环境变量
PID=$(systemctl --user show openclaw-gateway.service --property=MainPID --value)
echo "Gateway PID: $PID"
cat /proc/$PID/environ 2>/dev/null | tr '\0' '\n' | grep -i proxy
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐