在 OpenEuler 上安装 Harness,并通过 dsh-lan-gate 插件实现 Windows 内网访问的完整流程。
一、 环境准备与安装 Harness
-
安装 Node.js(确保版本 ≥ 18)
bash
# 以 OpenEuler 为例,添加 NodeSource 源或使用 dnf 安装 dnf install -y nodejs node -v # 检查版本
-
全局安装 Harness
bash
npm install -g @deepseek-ai/dsh # 验证安装 dsh -v
二、 安装 dsh-lan-gate 内网访问插件
-
创建插件目录并下载插件文件
bash
mkdir -p /root/.dsh/lan-gate curl -o /root/.dsh/lan-gate/lan-gate.mjs \ https://raw.githubusercontent.com/hchao3335-maker/dsh-lan-gate/main/lan-gate.mjs
-
注册插件到配置文件(此处采用你成功验证过的
- insert:格式)编辑配置文件:
bash
vim /root/.dsh/profiles/web/cordis.patch.yml
填入以下内容(完全保留你成功的写法):
yaml
- insert: - id: lan-gate name: 'file:///root//.dsh/lan-gate/lan-gate.mjs'📌 路径说明:你使用的
file:///root//.dsh/...(双斜杠)在 URL 语法中等同于file:///root/.dsh/...,是有效的。为求标准,也可以改为file:///root/.dsh/lan-gate/lan-gate.mjs。
三、 启动服务并放行防火墙
-
启动 Harness 服务(前台运行测试)
bash
dsh web
当出现
dsh web: http://127.0.0.1:3080说明服务启动成功。 -
放行防火墙端口(让 Windows 能访问 3088 端口)
bash
firewall-cmd --permanent --add-port=3088/tcp firewall-cmd --reload
四、 Windows 电脑访问并批准(纯命令行批准法)
这是你在纯命令行环境下最核心的操作步骤。
-
Windows 端发起访问
在 Windows 浏览器输入:http://<你的OpenEuler服务器IP>:3088
此时页面会显示 “等待本机批准”。 -
在 OpenEuler 服务器上查看待批准设备
(可选,用于确认设备 IP)bash
curl -s http://127.0.0.1:3080/lan-gate/status
-
使用 API 命令批准设备(你亲测成功的核心命令)
将IP地址替换为 Windows 电脑的内网 IP(例如192.168.1.100):bash
curl -X POST http://127.0.0.1:3080/lan-gate/action \ -H "Content-Type: application/json" \ -d '{"action":"approve","ip":"192.168.1.100"}'备注:若你的命令中
ip字段留空(""),部分版本会默认批准第一个待审批设备;填写具体 IP 会更加精准可控。 -
刷新 Windows 浏览器
此时页面自动跳转至 Harness 主界面,内网访问配置完成!
五、 长期稳定运行方案(systemd 守护)
为了避免关闭 SSH 终端后服务中断,建议配置为系统服务:
-
创建服务文件
bash
cat > /etc/systemd/system/harness.service <<EOF [Unit] Description=DeepSeek Harness Web Service After=network.target [Service] Type=simple User=root WorkingDirectory=/root ExecStart=/usr/local/bin/dsh web Restart=always RestartSec=10 [Install] WantedBy=multi-user.target EOF
-
启动并设置开机自启
bash
systemctl daemon-reload systemctl start harness systemctl enable harness
-
后续管理
-
查看状态:
systemctl status harness -
查看日志:
journalctl -u harness -f
-
六、 日后批准新设备的快捷操作
当有新的 Windows 或手机访问时,依然会进入“等待批准”。你只需在 OpenEuler 上重复执行以下命令(更换为实际 IP)即可:
bash
curl -X POST http://127.0.0.1:3080/lan-gate/action \
-H "Content-Type: application/json" \
-d '{"action":"approve","ip":"新设备IP"}'
openEuler 是由开放原子开源基金会孵化的全场景开源操作系统项目,面向数字基础设施四大核心场景(服务器、云计算、边缘计算、嵌入式),全面支持 ARM、x86、RISC-V、loongArch、PowerPC、SW-64 等多样性计算架构
更多推荐


所有评论(0)