5.8 KiB
#ubuntu #vibe-kanban #vibe-coding #npm #npx #pm2
Ubuntu Server 下安装、管理 Vibe-Kanban + OpenCode 的完整文档,以 shenwei 用户操作、使用 Node 20 和 pm2 管理进程,包含详细命令和验证步骤。
以下是完整 Markdown 文档:
title: Vibe-Kanban + OpenCode 在 Ubuntu Server 上安装与管理指南 author: shenwei tags: [npm, npx, pm2, ubuntu, vibe-coding, vibe-kanban]
title: Vibe-Kanban + OpenCode 在 Ubuntu Server 上安装与管理指南 source: author: shenwei published: created: description: tags: [npm, npx, pm2, ubuntu, vibe-coding, vibe-kanban]
Vibe-Kanban + OpenCode 在 Ubuntu Server 上安装与管理指南
本文档详细说明了如何在 Ubuntu Server 上使用非 root 用户(shenwei)安装 Node 20、Vibe-Kanban 与 OpenCode,并通过 pm2 管理进程,同时提供完整的验证步骤。
1️⃣ 清理旧的安装
目的:清理之前安装的 Node、Vibe-Kanban、OpenCode、工作树等,避免权限冲突和端口占用。
步骤:
- 停止所有旧进程
# 查看旧的 vibe-kanban 或 opencode 进程
ps aux | grep -E 'vibe-kanban|opencode' | grep -v grep
# 停掉进程
kill <PID>
- 删除旧工作树与缓存
rm -rf /var/tmp/vibe-kanban/worktrees/*
rm -rf ~/.vibe-kanban
- 确保用户
shenwei对目录有读写权限
sudo chown -R shenwei:shenwei /var/tmp/vibe-kanban
sudo chown -R shenwei:shenwei ~/.vibe-kanban
- 如果之前系统安装了旧 Node 或全局 npm 包,可选择卸载
sudo apt remove nodejs npm -y
sudo rm -rf /usr/local/lib/node_modules
sudo rm -f /usr/local/bin/node /usr/local/bin/npm
2️⃣ 安装 Node 20(使用 nvm)
目的:确保 Node 版本为 20,兼容最新 Vibe-Kanban 和 OpenCode。
安装 nvm
# 下载并安装 nvm(代理环境下可用 proxychains)
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# 添加环境变量到 shenwei 的 bash 配置
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.bashrc
# 重新加载 bash
source ~/.bashrc
安装 Node 20
nvm install 20
nvm use 20
nvm alias default 20
# 验证 Node 和 npm
node -v # 应该显示 v20.x.x
npm -v
3️⃣ 安装 Vibe-Kanban 与 OpenCode(用户 shenwei)
安装 Vibe-Kanban
# 安装最新版本
npm install -g vibe-kanban
# 创建工作目录
mkdir -p ~/vibe-kanban-projects
cd ~/vibe-kanban-projects
安装 OpenCode
# 安装 OpenCode CLI
npm install -g opencode-ai
# 验证安装
opencode --version
⚠️ 注意:不要用 root 启动 OpenCode serve,vibe-kanban 会自动 spawn executor
4️⃣ 查看安装后的进程和验证
查看进程
# 查看 Node 相关进程
ps aux | grep -E 'vibe-kanban|opencode' | grep -v grep
# 查看监听端口
ss -lntp | grep opencode
ss -lntp | grep vibe-kanban
参考用pm2启动进程
验证 vibe-kanban 启动
# 使用 debug 模式启动
RUST_LOG=debug HOST=0.0.0.0 PORT=9999 npx vibe-kanban
- 日志中应包含:
Server running on http://0.0.0.0:9999
Starting executor on port <random_port>
- 如果浏览器无法自动打开,可手动访问:http://192.168.3.45:9999
验证 OpenCode executor
-
vibe-kanban 启动后会 spawn executor(随机端口),可通过日志查看端口
-
检查端口是否在监听:
ss -lntp | grep opencode
- 用 curl 测试 executor 健康(假设端口 40829):
curl http://127.0.0.1:40829/health
# 返回 OK
⚠️ 遇到 I/O error 时,通常是 executor 没启动或端口被占用
5️⃣ 使用 pm2 管理进程
安装 pm2
npm install -g pm2
使用 pm2 启动 Vibe-Kanban
pm2 start "RUST_LOG=debug HOST=0.0.0.0 PORT=9999 npx vibe-kanban" --name vibe-kanban
# 查看状态
pm2 status
# 查看日志
pm2 logs vibe-kanban
使用 pm2 启动 OpenCode Executor
pm2 start "opencode serve --hostname 127.0.0.1 --port 40829" --name opencode-executor
# 查看状态
pm2 status
# 查看日志
pm2 logs opencode-executor
6️⃣ 完整验证步骤
-
清理旧工作树和进程
-
确认 Node 20 已正确安装
-
确认 Vibe-Kanban 与 OpenCode 已安装并属于
shenwei用户 -
启动 vibe-kanban:
RUST_LOG=debug HOST=0.0.0.0 PORT=9999 npx vibe-kanban
- 检查日志:
Server running on http://0.0.0.0:9999
Starting executor on port <random_port>
- 检查监听端口:
ss -lntp | grep node
- 用浏览器或 curl 访问:
http://127.0.0.1:9999
curl http://127.0.0.1:<executor_port>/health
- pm2 管理进程:
pm2 start "RUST_LOG=debug HOST=0.0.0.0 PORT=9999 npx vibe-kanban" --name vibe-kanban
pm2 logs vibe-kanban
pm2 save
pm2 startup systemd -u shenwei --hp /home/shenwei
- 完整测试:
-
创建测试项目
-
创建任务
-
日志中不应再出现:
OpenCode executor error: I/O error: error sending request ...
✅ 总结
-
不要用 root 启动 OpenCode serve
-
vibe-kanban 自行 spawn executor,随机端口即可
-
pm2 只管理 vibe-kanban,executor 随进程一起管理
-
保证
/var/tmp/vibe-kanban和~/.vibe-kanban权限属于用户 -
Node 版本 20 + npm 最新即可