环境 服务器为腾讯云2核4G ubuntu24,openclaw版本2026.4.23
目标 linux服务器的安装配置、安装openclaw、配置minimax的token plan、使用minimax的token plan送的mcp网页搜索、安装openclaw插件、接入飞书和微信、外网安全访问openclaw的webUI后台
相关操作 vim常用操作
SCP上传文件到服务器
ssh密钥连接 把腾讯云的密钥文件下载,放在~/.ssh中,更改权限
1 chmod 400 ~/.ssh/openclaw.pem
打开或新建~/.ssh/config文件,写入
1 2 3 4 5 6 7 Host openclaw #这里是openclaw, 所以用ssh openclaw连接 HostName 服务器IPV4 User ubuntu #服务器ssh用户名 Port 22 IdentityFile ~/.ssh/openclaw.pem ServerAliveInterval 60 #心跳包,防止长时间不使用ssh断连 ServerAliveCountMax 3
终端输入即可连接
如果出现下面一段,连接失败
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ED25519 key sent by the remote host is SHA256:ucc8fIUa3ZCneIBoVoYH1dhLFymZH4xPd99V1SGGqFk. Please contact your system administrator.
原因是重装了服务器系统,但是原来的连接记录还没删除 打开~/.ssh/known_hosts文件,把带有服务器IPV4地址的几行删掉即可
更改ssh端口 1 sudo vim /etc/ssh/sshd_config
找到#Port 22修改成其他端口,然后去腾讯云后台放行对应的端口,重启服务器,本地的~/.ssh/config文件也要修改为对应的端口,连不上可以稍微等几分钟再试一下
升级软件包 1 2 3 sudo apt updatesudo apt upgrade -ysudo apt-get install build-essential libopus-dev
出现Configuring openssh-server弹窗,保持默认keep the local version currently installed即可,直接按下回车
安装node 1 2 3 4 curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - sudo apt install nodejs -ysudo npm install -g npm@latest npm config set registry http://mirrors.cloud.tencent.com/npm/
安装openclaw 1 2 curl -fsSL https://openclaw.ai/install.sh | bash sudo npm install -g openclaw@latest --loglevel verbose
提前打开另一个终端,用ssh连接上服务器,当进行到node download-lib.js的时候
1 2 3 npm info run openclaw@2026.4.5 postinstall node_modules/openclaw node scripts/postinstall-bundled-plugins.mjs npm info run openclaw@2026.4.5 postinstall { code: 0, signal: null } npm info run @matrix-org/matrix-sdk-crypto-nodejs@0.4.0 postinstall node_modules/openclaw/node_modules/@matrix-org/matrix-sdk-crypto-nodejs node download-lib.js
在另外一个终端输入
1 sudo pkill -f "download-lib.js"
打断安装,node download-lib.js从github上下载一个20MB左右的文件,如果连接不上github或者下载速度慢会一直卡住,手动完成xxx的安装
1 2 sudo mkdir -p /usr/lib/node_modules/openclaw/node_modules/@matrix-org/matrix-sdk-crypto-nodejs cd /usr/lib/node_modules/openclaw/node_modules/@matrix-org/matrix-sdk-crypto-nodejs
手动用gihtub代理下载
1 sudo wget -O matrix-sdk-crypto-nodejs.linux-x64-gnu.node https://gh-proxy.org/https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/releases/download/v0.4.0/matrix-sdk-crypto.linux-x64-gnu.node
创建 package.json
1 2 3 4 5 6 7 sudo tee /usr/lib/node_modules/openclaw/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json > /dev/null <<'EOF' { "name" : "@matrix-org/matrix-sdk-crypto-nodejs" , "version" : "0.4.0" , "main" : "index.js" } EOF
创建 index.js 加载器
1 2 3 4 5 6 7 8 9 10 11 12 13 sudo tee /usr/lib/node_modules/openclaw/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.js > /dev/null <<'EOF' const path = require('path' ); const binaryPath = path.join(__dirname, 'matrix-sdk-crypto-nodejs.linux-x64-gnu.node' ); try { module.exports = require(binaryPath); } catch (err) { throw new Error( `Failed to load matrix-sdk-crypto-nodejs native binding. Expected file: ${binaryPath} \n` + `Error: ${err.message} ` ); } EOF
验证是否成功
1 2 cd /usr/lib/node_modules/openclawnode -e "try { require('@matrix-org/matrix-sdk-crypto-nodejs'); console.log('✅ 加载成功!'); } catch(e) { console.error('❌ 加载失败:', e.message); }"
显示加载成功即可,回到home
配置openclaw 1 2 openclaw onboard --install-daemon openclaw configure
openclaw飞书配置
接入微信的方法看官方仓库的README文档
看看有没有没有配对的设备,发现有Pending (1),这个是openclaw的webui,配对一下即可
1 2 openclaw devices list openclaw devices approve Request值
openclaw常用指令 1 2 3 4 5 6 7 8 openclaw gateway restart openclaw gateway status openclaw security audit openclaw devices list openclaw tui sudo vim ~/.openclaw/openclaw.json sudo ss -tlnp | grep 18789 sudo journalctl _PID=进程PID -f --no-pager
openclaw插件安装 1 2 3 cd ~sudo npm install -g clawhub clawhub install xxx
openclaw配置mcp服务器 安装uv,实测这个链接腾讯云服务器访问不了,需要自行下载这个脚本,用scp或者其他方式上传到服务器,再运行sh install.sh即可
1 curl -LsSf https://astral.sh/uv/install.sh | sh
更换uv国内镜像源
1 sudo vim ~/.config/uv/uv.toml
写入
1 2 3 [[index]] url = "https://mirrors.cloud.tencent.com/pypi/simple/" default = true
安装mcporter
1 sudo npm install -g mcporter
配置mcporter,以minimax为例
1 2 3 4 5 6 7 8 9 mcporter config add minimax \ --command uvx \ --arg minimax-coding-plan-mcp \ --arg -y \ --transport stdio \ --env MINIMAX_API_KEY="你的API_KEY" \ --env MINIMAX_API_HOST="https://api.minimaxi.com" \ --description "MiniMax MCP server with web search" \ --scope home
测试配置是否成功
添加minimax的网络搜索skill,叫openclaw帮忙新建skill即可,skill内容如下
minimax搜索skill
openclaw配置文件修改 1 sudo vim ~/.openclaw/openclaw.json
切换默认模型,修改
1 2 3 "model" : { "primary" : "zai/glm-5-turbo" }
node这一堆没什么用,可以删掉
1 2 3 "nodes" : { "denyCommands" : [ ] }
查看token
1 2 3 4 5 6 "gateway" : { "mode" : "local" , "auth" : { "mode" : "token" , "token" : "xxx" }
openclaw外网访问 修改openclaw配置文件
1 2 3 4 5 6 7 8 9 "trustedProxies" : [ "127.0.0.1" ] , "controlUi" : { "allowInsecureAuth" : false , "allowedOrigins" : [ "https://openclaw.djj45.cn" ] }
nginx配置
在浏览器打开页面,填入token,点击连接,显示未配对,手动配对重启网关即可
1 2 openclaw devices list openclaw devices approve xxx