# 下载到 /opt 目录
wget -O /opt/web-ssh-client https://vnc.hlwidc.com/web-ssh-client
# 设置执行权限
chmod +x /opt/web-ssh-client
# 验证文件
ls -lh /opt/web-ssh-client
使用 SQLite 数据库(推荐新手):
# 创建服务文件
sudo nano /etc/systemd/system/web-ssh-client.service
将以下内容写入服务文件:
[Unit]
Description=Web SSH Client Service
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt
ExecStart=/opt/web-ssh-client -port 8080 -db-type sqlite
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
使用 MySQL 数据库(推荐生产环境):
[Unit]
Description=Web SSH Client Service
After=network.target mysql.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt
ExecStart=/opt/web-ssh-client \
-port 8080 \
-db-type mysql \
-db-host localhost \
-db-port 3306 \
-db-user root \
-db-password your_password \
-db-name machine_manage
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
⚠️ 注意:请将 your_password 替换为实际的数据库密码
启用 SSL/TLS(HTTPS):
[Unit]
Description=Web SSH Client Service
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt
ExecStart=/opt/web-ssh-client \
--enable-ssl \
--server-host example.com \
--port 80 \
-db-type sqlite
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
提示:启用 SSL 后,系统会自动生成自签名证书(有效期10年)。如果端口是80,会自动改为443。证书文件保存在 /opt/server.crt 和 /opt/server.key。请将 example.com 替换为您的实际域名或IP地址。
# 重新加载 systemd 配置
sudo systemctl daemon-reload
# 启动服务
sudo systemctl start web-ssh-client
# 设置开机自启
sudo systemctl enable web-ssh-client
# 查看服务状态
sudo systemctl status web-ssh-client
sudo systemctl start web-ssh-client
sudo systemctl stop web-ssh-client
sudo systemctl restart web-ssh-client
sudo systemctl status web-ssh-client
# 查看最新日志
sudo journalctl -u web-ssh-client -n 50
# 实时查看日志
sudo journalctl -u web-ssh-client -f
# 查看最近1小时的日志
sudo journalctl -u web-ssh-client --since "1 hour ago"
sudo systemctl enable web-ssh-client
sudo systemctl disable web-ssh-client
# 修改服务文件后需要执行
sudo systemctl daemon-reload
sudo systemctl restart web-ssh-client
检查步骤:
sudo journalctl -u web-ssh-client -n 100ls -l /opt/web-ssh-clientnetstat -tlnp | grep 8080sudo systemctl status web-ssh-clientsudo nano /etc/systemd/system/web-ssh-client.servicesudo systemctl daemon-reloadsudo systemctl restart web-ssh-client# 查看服务进程
ps aux | grep web-ssh-client
# 查看端口监听
netstat -tlnp | grep 8080
# 或使用 ss 命令
ss -tlnp | grep 8080