新增wiki命令文件

This commit is contained in:
2026-04-14 16:02:50 +08:00
parent 65803c911d
commit c6e3d3c5db
485 changed files with 12578 additions and 396 deletions

View File

@@ -0,0 +1,301 @@
#ubuntu #vibe-kanban #vibe-coding #npm #npx #pm2
```table-of-contents
```
**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、工作树等避免权限冲突和端口占用。
### 步骤:
1. 停止所有旧进程
```bash
# 查看旧的 vibe-kanban 或 opencode 进程
ps aux | grep -E 'vibe-kanban|opencode' | grep -v grep
# 停掉进程
kill <PID>
```
2. 删除旧工作树与缓存
```bash
rm -rf /var/tmp/vibe-kanban/worktrees/*
rm -rf ~/.vibe-kanban
```
3. 确保用户 `shenwei` 对目录有读写权限
```bash
sudo chown -R shenwei:shenwei /var/tmp/vibe-kanban
sudo chown -R shenwei:shenwei ~/.vibe-kanban
```
4. 如果之前系统安装了旧 Node 或全局 npm 包,可选择卸载
```bash
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
```bash
# 下载并安装 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
```bash
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
```bash
# 安装最新版本
npm install -g vibe-kanban
# 创建工作目录
mkdir -p ~/vibe-kanban-projects
cd ~/vibe-kanban-projects
```
### 安装 OpenCode
```bash
# 安装 OpenCode CLI
npm install -g opencode-ai
# 验证安装
opencode --version
```
> ⚠️ 注意:不要用 root 启动 OpenCode servevibe-kanban 会自动 spawn executor
---
## 4⃣ 查看安装后的进程和验证
### 查看进程
```bash
# 查看 Node 相关进程
ps aux | grep -E 'vibe-kanban|opencode' | grep -v grep
# 查看监听端口
ss -lntp | grep opencode
ss -lntp | grep vibe-kanban
```
### 参考用pm2启动进程
### 验证 vibe-kanban 启动
```bash
# 使用 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](http://192.168.3.45:9999/)
### 验证 OpenCode executor
- vibe-kanban 启动后会 spawn executor随机端口可通过日志查看端口
- 检查端口是否在监听:
```bash
ss -lntp | grep opencode
```
- 用 curl 测试 executor 健康(假设端口 40829
```bash
curl http://127.0.0.1:40829/health
# 返回 OK
```
> ⚠️ 遇到 I/O error 时,通常是 executor 没启动或端口被占用
---
## 5⃣ 使用 pm2 管理进程
### 安装 pm2
```bash
npm install -g pm2
```
### 使用 pm2 启动 Vibe-Kanban
```bash
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
``` bash
pm2 start "opencode serve --hostname 127.0.0.1 --port 40829" --name opencode-executor
# 查看状态
pm2 status
# 查看日志
pm2 logs opencode-executor
```
---
## 6⃣ 完整验证步骤
1. 清理旧工作树和进程
2. 确认 Node 20 已正确安装
3. 确认 Vibe-Kanban 与 OpenCode 已安装并属于 `shenwei` 用户
4. 启动 vibe-kanban
```bash
RUST_LOG=debug HOST=0.0.0.0 PORT=9999 npx vibe-kanban
```
5. 检查日志:
```
Server running on http://0.0.0.0:9999
Starting executor on port <random_port>
```
6. 检查监听端口:
```bash
ss -lntp | grep node
```
7. 用浏览器或 curl 访问:
```
http://127.0.0.1:9999
curl http://127.0.0.1:<executor_port>/health
```
8. pm2 管理进程:
```bash
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
```
9. 完整测试:
- 创建测试项目
- 创建任务
- 日志中不应再出现:
```
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 最新即可