← 返回 Skills 市场
microsnow

Wsl Service Deploy

作者 microsnow · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ⚠ suspicious
18
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install wsl-service-deploy
功能描述
WSL Ubuntu 服务一键部署。通过 wsl.exe + su -c root + aptitude,无需 SSH 即可在 Windows 宿主机上安全、快速地安装和管理后端服务。 覆盖 MySQL、Redis、Nginx、PostgreSQL、MongoDB 等任意 aptitude 可搜到的包。适用场景:...
使用说明 (SKILL.md)

WSL Service Deploy

在 Windows 宿主机的 WSL Ubuntu 中,通过 wsl.exe 直接执行命令,使用 aptitude 包管理器安装和管理后端服务。

核心工作流

原则

  1. 首选 wsl.exe -e bash -c — 直接从 Windows 侧调用 WSL 命令,无需 SSH
  2. 以 root 执行 — 使用 echo '\x3Croot密码>' | su -c '\x3C命令>' - root 绕过 sudo 密码
  3. 脚本先写再跑 — 将多步操作写入 /tmp/ 脚本,一次性执行,通过 /tmp/*.log 查看结果
  4. 用 aptitude 不用 apt — aptitude 依赖处理更可靠

标准执行模式

# 第一步:在 WSL 中写入安装脚本
wsl.exe -e bash -c 'cat > /tmp/install_\x3Cservice>.sh \x3C\x3C "EOF"
#!/bin/bash
set -e
exec &> /tmp/install_\x3Cservice>.log
echo "=== START $(date) ==="
# ... 安装步骤 ...
echo "=== END $(date) ==="
EOF
chmod +x /tmp/install_\x3Cservice>.sh'

# 第二步:以 root 执行脚本(后台运行,避免超时)
wsl.exe -e bash -c "echo '\x3Croot密码>' | su -c 'bash /tmp/install_\x3Cservice>.sh' - root" &

# 第三步:等待后检查日志(sleep 时间视包大小调整:Redis~10s,MySQL~30-60s)
sleep 10
wsl.exe -e bash -c 'tail -30 /tmp/install_\x3Cservice>.log'

卸载服务

systemctl stop \x3Cservice>
DEBIAN_FRONTEND=noninteractive aptitude purge -y \x3Cpackage-names>
rm -rf \x3Cdata-directories>
aptitude purge -y ~c   # 清理残留配置

检查状态

wsl.exe -e bash -c 'systemctl status \x3Cservice> --no-pager; ss -tlnp | grep \x3Cport>'

通用部署流程(适用于 aptitude search 找到的任何包)

当用户要求安装一个不在下方速查表中的服务时,按以下步骤自行推理:

  1. 搜索包名aptitude search \x3C关键词> | head -20
  2. 确定包名 — 通常就是 \x3C服务名>\x3C服务名>-server(如 nginxpostgresql
  3. 查端口和配置路径aptitude show \x3C包名> | grep -E "Homepage|Depends",或用 dpkg -L \x3C包名> 安装后查看
  4. 套用标准执行模式 — 写入 /tmp/install_\x3Cservice>.sh,通过 su -c 执行
  5. 安装后操作
    • systemctl enable \x3Cservice> && systemctl start \x3Cservice> — 自启 + 启动
    • 有配置文件则 cp \x3Cconfig> \x3Cconfig>.bak 备份后修改
    • 有默认认证则通过服务自带 CLI 设置密码
  6. 验证 — 版本号 + 端口监听 + 功能测试

示例:用户说"装 Nginx" → 搜索 nginx → 包名 nginx → 写脚本安装 → systemctl enable nginx → 验证 curl localhost

服务速查表

MySQL

  • 包名: mysql-server
  • 数据目录: /var/lib/mysql
  • 配置目录: /etc/mysql
  • root 密码: 安装后通过 ALTER USER 设置
  • 认证插件: mysql_native_password
  • 默认端口: 3306 (MySQL), 33060 (X Protocol)
  • 自启: systemctl enable mysql

Redis

  • 包名: redis-server
  • 配置文件: /etc/redis/redis.conf
  • 关键配置:
    • requirepass \x3C密码> — 设置认证密码
    • bind 0.0.0.0 — 允许外部连接
  • 默认端口: 6379
  • 验证: redis-cli -a \x3C密码> PING
  • 自启: systemctl enable redis-server

通用规范

  • 安装前先 apt update(镜像源已配置为阿里云)
  • 安装前确认包未安装:which \x3Cbinary> || echo NOT_INSTALLED
  • 安装前清理残留锁文件:rm -f /var/lib/dpkg/lock* /var/lib/apt/lists/lock /var/cache/apt/archives/lock
  • 有残留 dpkg 进程时先 killall apt; killall dpkg; dpkg --configure -a(需在 root 下执行)
  • 修改配置文件前先备份:cp \x3Cconfig> \x3Cconfig>.bak
  • 安装完成后必须验证:密码登录、版本号、端口监听

环境信息

详见 references/wsl-commands.md,关键参数:

项目
Ubuntu 版本 26.04 LTS (resolute)
镜像源 https://mirrors.aliyun.com/ubuntu/
Root 密码 123456
包管理器 aptitude

注意事项

  • WSL IP 动态变化:SSH 方式不可靠,优先用 wsl.exe 直接调用
  • 安全策略:需要在 WorkBuddy 安全中心启用「系统级工具」策略
  • 多层引号wsl.exe -e bash -c 中避免复杂嵌套引号,改用 heredoc 脚本
  • 前台超时:长时间操作(下载/安装)用后台执行 + 日志轮询
安全使用建议
Review carefully before installing. Use this only in disposable or tightly controlled WSL environments, replace all example passwords, avoid remote Redis exposure unless you add firewalling and strong authentication, and do not run purge or rm -rf cleanup steps unless you have backups and explicitly intend to erase service data.
能力评估
Purpose & Capability
The stated purpose of installing and managing WSL services is coherent, but the documented workflow uses root-level package installation, service enablement, data deletion, and Redis external exposure with weak static credentials.
Instruction Scope
Instructions explicitly recommend piping a root password into su, describe bypassing sudo password friction, include a hardcoded root password, and provide root SSH fallback guidance without adequate warnings or user confirmation boundaries.
Install Mechanism
The artifact is a text-only skill with README, SKILL.md, and reference documentation; there is no executable installer, hidden payload, or package-time persistence mechanism evident.
Credentials
The skill requires system-level WSL access and encourages broad package-manager recovery actions such as deleting apt/dpkg lock files and killing package-manager processes, which is disproportionate as default operational guidance.
Persistence & Privilege
The skill enables services at boot, modifies system service configuration, exposes Redis on all interfaces, and documents hardcoded root/service passwords, creating persistent privileged and network-facing effects.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install wsl-service-deploy
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /wsl-service-deploy 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
wsl-service-deploy 0.1.0 - 初始版本发布,支持在 Windows 宿主机下通过 wsl.exe 一键部署 WSL Ubuntu 后端服务,无需 SSH。 - 提供标准服务安装、卸载、状态检查流程,基于 aptitude 包管理器,增强依赖和异常处理。 - 覆盖 MySQL、Redis、Nginx、PostgreSQL、MongoDB 等常用服务的自动化安装及自定义包扩展。 - 优化脚本执行安全性与流程,包括 root 权限控制、日志输出、配置备份与安装后验证。 - 内置服务速查表和通用运维规范,适用于 WSL 环境下的服务部署与管理。
元数据
Slug wsl-service-deploy
版本 0.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Wsl Service Deploy 是什么?

WSL Ubuntu 服务一键部署。通过 wsl.exe + su -c root + aptitude,无需 SSH 即可在 Windows 宿主机上安全、快速地安装和管理后端服务。 覆盖 MySQL、Redis、Nginx、PostgreSQL、MongoDB 等任意 aptitude 可搜到的包。适用场景:... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 18 次。

如何安装 Wsl Service Deploy?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install wsl-service-deploy」即可一键安装,无需额外配置。

Wsl Service Deploy 是免费的吗?

是的,Wsl Service Deploy 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Wsl Service Deploy 支持哪些平台?

Wsl Service Deploy 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Wsl Service Deploy?

由 microsnow(@microsnow)开发并维护,当前版本 v0.1.0。

💬 留言讨论