managing-local-cloudnms

leochanai's avatarfrom leochanai

管理本地 Cloud NMS 服务器的完整部署流程,包括卸载、上传、全新安装和保留数据升级。当用户需要重新安装 Cloud NMS、部署新版本、或在开发环境中重置 NMS 服务时使用。

⭐1stars🔀0forks📁View on GitHub🕐Updated Jan 9, 2026

When & Why to Use This Skill

This Claude skill automates the complete deployment lifecycle of local Cloud NMS servers, providing a robust framework for uninstallation, package transfer, fresh installation, and data-preserving upgrades. It streamlines environment setup by orchestrating complex bash scripts and SSH-based tasks, ensuring consistency and efficiency in local development and testing workflows.

Use Cases

  • Rapidly resetting local development environments to a clean state by automating the uninstallation and fresh installation of Cloud NMS services.
  • Performing seamless version upgrades on local servers using the 'lite' mode to preserve existing database records and configurations.
  • Automating multi-step deployment procedures including database initialization, license verification, and service health checks to reduce manual errors.
  • Managing remote server deployments via automated SSH commands and package uploads for consistent environment synchronization.
namemanaging-local-cloudnms
description管理本地 Cloud NMS 服务器的完整部署流程,包括卸载、上传、全新安装和保留数据升级。当用户需要重新安装 Cloud NMS、部署新版本、或在开发环境中重置 NMS 服务时使用。

管理本地 Cloud NMS 服务器

自动化管理本地 Cloud NMS 开发环境的部署、升级和维护。

脚本架构

scripts/
├── common.sh            # 公共配置和工具函数
├── 01_uninstall.sh      # 步骤1: 卸载服务
├── 02_upload.sh         # 步骤2: 上传安装包
├── 03_install.sh        # 步骤3: 安装服务 (含数据库初始化)
└── deploy_cloudnms.sh   # 主脚本(调度器)

使用方法

单步执行(推荐调试)

每个脚本都包含校验功能,可独立运行:

cd scripts/

# 步骤 1: 卸载服务
./01_uninstall.sh          # 交互式卸载
./01_uninstall.sh --check  # 仅检查状态,不卸载

# 步骤 2: 上传安装包
./02_upload.sh 1.1.0.6          # 上传(跳过已存在)
./02_upload.sh 1.1.0.6 --check  # 仅检查,不上传
./02_upload.sh 1.1.0.6 --force  # 强制重新上传

# 步骤 3: 安装服务
./03_install.sh 1.1.0.6 fresh   # 全新安装 (含数据库初始化)
./03_install.sh 1.1.0.6 lite    # 保留数据升级
./03_install.sh 1.1.0.6 --check # 仅检查安装条件

校验逻辑

脚本 校验项
01_uninstall.sh 检查 /usr/local/cloud_nms/service 目录、~/CloudNMS*.zip 文件
02_upload.sh 检查本地和服务器上的 ~/CloudNMSDummyBusiness_{version}.zip
03_install.sh 检查 /usr/local/cloud_nms/service 目录、安装包、许可证

完整流程

使用主脚本一键完成所有步骤:

# 交互式模式(菜单选择)
./scripts/deploy_cloudnms.sh

# 命令行模式
./scripts/deploy_cloudnms.sh 1.1.0.6 fresh  # 上传 + 全新安装
./scripts/deploy_cloudnms.sh 1.1.0.6 lite   # 上传 + 保留数据升级

安装模式说明

模式 说明 包含步骤
fresh 全新安装 解压、安装、启动、数据库初始化
lite 保留数据升级 解压、升级安装、启动

环境配置

配置项 值
服务器 IP 192.168.0.98
SSH 用户 cloud_nms / Genew1234
数据库密码 1Z_kF8s2mHcTnQHC
本地构建路径 /Users/farghost/IdeaProjects/HuahaiPlatform2/output
Web 访问地址 https://192.168.0.98:31943

前置要求

安装 sshpass(用于自动化 SSH):

brew install sshpass

故障排除

数据库初始化失败 (mysql: command not found)

03_install.sh 会自动尝试多个 MySQL 路径:

  1. /usr/local/cloud_nms/env/mysql/bin/mysql
  2. /usr/bin/mysql
  3. mysql

若全部失败,会上传 SQL 文件并生成手动执行指南:

ssh cloud_nms@192.168.0.98
/usr/local/cloud_nms/env/mysql/bin/mysql -u cloud_nms -p'1Z_kF8s2mHcTnQHC' cloud_nms < /tmp/init_cloudnms_users.sql

Web 访问失败

检查 nginx 服务:

ssh cloud_nms@192.168.0.98 "sudo systemctl status nginx"
ssh cloud_nms@192.168.0.98 "sudo systemctl start nginx"

注意事项

  • ⚠️ 开发环境专用 - 包含硬编码凭据,不可用于生产环境
  • 📦 许可证文件 - 确保服务器 ~ 目录下存在 license.xml.sig
  • 💾 数据备份 - 全新安装会清空所有数据
  • 🌐 网络连接 - 需要能访问 192.168.0.98 服务器