mirror of
https://github.com/oneclickvirt/oneclickvirt.github.io.git
synced 2026-05-22 17:08:02 +08:00
fix: 更新说明
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
outline: deep
|
||||
---
|
||||
|
||||
## WebVirtCloud 安装指南
|
||||
# WebVirtCloud 安装指南
|
||||
|
||||
[](https://hits.spiritlhl.net)
|
||||
|
||||
@@ -12,24 +12,21 @@ outline: deep
|
||||
|
||||
应该算是全网中文第一份完整的部署指南,官方的指南实际上有很多地方是和本项目部署的方式有出入的。
|
||||
|
||||
## 控制端安装
|
||||
## 1. 控制端安装
|
||||
|
||||
### 系统要求
|
||||
|
||||
**最低配置要求:**
|
||||
|
||||
- CPU: 1 核
|
||||
- 内存: 1 GB RAM
|
||||
- 硬盘: 空余 10 GB
|
||||
- 系统:Debian11+,Ubuntu20.04+
|
||||
|
||||
### 默认登录信息
|
||||
|
||||
- 用户名: `admin@webvirt.cloud`
|
||||
- 密码: `admin`
|
||||
|
||||
### 面板地址
|
||||
|
||||
- 用户面板: `https://192-168-0-114.nip.io`
|
||||
- 管理后台: `https://192-168-0-114.nip.io/admin`
|
||||
|
||||
@@ -37,45 +34,40 @@ outline: deep
|
||||
|
||||
### 安装命令
|
||||
|
||||
国际
|
||||
|
||||
国际版本:
|
||||
```bash
|
||||
curl -slk https://raw.githubusercontent.com/oneclickvirt/webvirtcloud/main/scripts/install_webvirt_cloud.sh -o install_webvirt_cloud.sh \
|
||||
&& chmod +x install_webvirt_cloud.sh \
|
||||
&& bash install_webvirt_cloud.sh
|
||||
```
|
||||
|
||||
国内
|
||||
|
||||
国内版本:
|
||||
```bash
|
||||
curl -slk https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/webvirtcloud/main/scripts/install_webvirt_cloud.sh -o install_webvirt_cloud.sh \
|
||||
&& chmod +x install_webvirt_cloud.sh \
|
||||
&& bash install_webvirt_cloud.sh
|
||||
```
|
||||
|
||||
## 计算节点安装
|
||||
## 2. 计算节点安装
|
||||
|
||||
> **重要提示:** Hypervisor 和 Controller 不能在同一虚拟机上安装,否则网络会出现冲突。
|
||||
|
||||
### 系统要求
|
||||
|
||||
**建议配置:**
|
||||
|
||||
- CPU: 2 核
|
||||
- 内存: 4 GB RAM
|
||||
- 硬盘: 空余 40 GB
|
||||
- 系统:AlmaLinux8+,RockyLinux8+
|
||||
|
||||
> **额外说明:**
|
||||
>
|
||||
> - 实际使用建议更高配置,测试环境只够开 4 台最小的虚拟机。
|
||||
> - 服务器推荐支持 KVM 嵌套虚拟化的,若```VM-x/AMD-V/Hyper-V```未启用也可以,会自动切换为QEMU使用TCG仿真开设虚拟机,只不过性能会有所损耗。
|
||||
> - 服务器推荐支持 KVM 嵌套虚拟化的,若`VM-x/AMD-V/Hyper-V`未启用也可以,会自动切换为QEMU使用TCG仿真开设虚拟机,只不过性能会有所损耗。
|
||||
> - 跳过 env 检测安装,直接使用二进制文件,无需安装依赖。
|
||||
|
||||
### 环境检测
|
||||
|
||||
检测服务器是否支持 KVM 嵌套虚拟化:
|
||||
|
||||
```bash
|
||||
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && ./goecs.sh install && goecs
|
||||
```
|
||||
@@ -84,40 +76,33 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
|
||||
|
||||
### 计算节点安装步骤
|
||||
|
||||
下载安装脚本:
|
||||
1. 下载安装脚本:
|
||||
|
||||
国际
|
||||
国际版本:
|
||||
```bash
|
||||
curl -slk https://raw.githubusercontent.com/oneclickvirt/webvirtcloud/main/scripts/install_hypervisor.sh -o install_hypervisor.sh \
|
||||
&& chmod +x install_hypervisor.sh
|
||||
```
|
||||
|
||||
```bash
|
||||
curl -slk https://raw.githubusercontent.com/oneclickvirt/webvirtcloud/main/scripts/install_hypervisor.sh -o install_hypervisor.sh \
|
||||
&& chmod +x install_hypervisor.sh
|
||||
```
|
||||
国内版本:
|
||||
```bash
|
||||
curl -slk https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/webvirtcloud/main/scripts/install_hypervisor.sh -o install_hypervisor.sh \
|
||||
&& chmod +x install_hypervisor.sh
|
||||
```
|
||||
|
||||
国内
|
||||
2. 执行安装(替换为你的 Controller IP):
|
||||
```bash
|
||||
bash install_hypervisor.sh x.x.x.x
|
||||
```
|
||||
> 请将 `x.x.x.x` 替换为你的 Controller 控制端的实际 IP 地址。
|
||||
|
||||
```bash
|
||||
curl -slk https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/webvirtcloud/main/scripts/install_hypervisor.sh -o install_hypervisor.sh \
|
||||
&& chmod +x install_hypervisor.sh
|
||||
```
|
||||
|
||||
执行安装(替换为你的 Controller IP):
|
||||
|
||||
```bash
|
||||
bash install_hypervisor.sh x.x.x.x
|
||||
```
|
||||
|
||||
> 请将 `x.x.x.x` 替换为你的 Controller 控制端的实际 IP 地址。
|
||||
|
||||
面板纳管节点
|
||||
|
||||
执行完毕后会有提示需要在Controller面板端需要填写的内容。
|
||||
|
||||
面板端要填入Hostname的是当前计算节点的IPV4地址,还有要填入Token识别节点。
|
||||
3. 面板纳管节点
|
||||
执行完毕后会有提示需要在Controller面板端需要填写的内容。
|
||||
面板端要填入Hostname的是当前计算节点的IPV4地址,还有要填入Token识别节点。
|
||||
|
||||
### NetworkManager 版本问题
|
||||
|
||||
安装过程中可能会出现以下错误:
|
||||
|
||||
```
|
||||
Connection 'eth0' (bed050e9-ff49-4665-8112-24ddf2a1cd3c) successfully deleted.
|
||||
Warning: nmcli (1.48.10) and NetworkManager (1.42.2) versions don't match. Restarting NetworkManager is advised.
|
||||
@@ -129,7 +114,7 @@ Error: Failed to add 'br-ext' connection: connection.autoconnect-ports: unknown
|
||||
### 安装耗时提示
|
||||
|
||||
- 整个过程大约耗时 **10~25 分钟**。
|
||||
- 大部分时间用于下载 `finnix-125.iso` 至 `/var/lib/libvirt/isos/finnix-125.iso`,有时候下载快有时候下载慢。
|
||||
- 大部分时间用于下载 `finnix-125.iso` 至 `/var/lib/libvirt/isos/finnix-125.iso`。
|
||||
- 该部分无法加速,**建议使用 tmux 或 screen** 等工具防止中断。
|
||||
|
||||
### 添加计算节点到控制面板
|
||||
@@ -138,14 +123,14 @@ Error: Failed to add 'br-ext' connection: connection.autoconnect-ports: unknown
|
||||
|
||||
路径: `Admin Panel > Computers > Add Computer`
|
||||
|
||||
`HostName` 需要填写计算节点的公网IPV4地址
|
||||
- `HostName` 需要填写计算节点的公网IPV4地址
|
||||
- `Token` 填在计算节点上获取到的token密钥
|
||||
|
||||
`Token` 填在计算节点上获取到的token密钥
|
||||
## 3. 公网IPV4端口映射
|
||||
|
||||
### 公网IPV4端口映射
|
||||
|
||||
### 自动映射
|
||||
### 3.1 自动映射
|
||||
|
||||
自动映射功能特点:
|
||||
- **自动监控**:实时监控虚拟机状态变化,自动应用或清理端口映射规则
|
||||
- **智能端口分配**:根据虚拟机IP地址自动计算和分配不冲突的端口
|
||||
- **规则持久化**:使用firewall-cmd确保端口映射规则在宿主机重启后依然有效
|
||||
@@ -155,22 +140,19 @@ Error: Failed to add 'br-ext' connection: connection.autoconnect-ports: unknown
|
||||
#### 安装方法
|
||||
|
||||
1. 下载脚本到临时目录:
|
||||
|
||||
```bash
|
||||
wget -O /tmp/vm_port_mapping_setup.sh https://raw.githubusercontent.com/oneclickvirt/webvirtcloud/refs/heads/main/extra_scripts/vm_port_mapping_daemon.sh
|
||||
```
|
||||
```bash
|
||||
wget -O /tmp/vm_port_mapping_setup.sh https://raw.githubusercontent.com/oneclickvirt/webvirtcloud/refs/heads/main/extra_scripts/vm_port_mapping_daemon.sh
|
||||
```
|
||||
|
||||
2. 添加执行权限:
|
||||
|
||||
```bash
|
||||
chmod +x /tmp/vm_port_mapping_setup.sh
|
||||
```
|
||||
```bash
|
||||
chmod +x /tmp/vm_port_mapping_setup.sh
|
||||
```
|
||||
|
||||
3. 运行安装程序:
|
||||
|
||||
```bash
|
||||
/tmp/vm_port_mapping_setup.sh
|
||||
```
|
||||
```bash
|
||||
/tmp/vm_port_mapping_setup.sh
|
||||
```
|
||||
|
||||
脚本会自动完成以下操作:
|
||||
- 将自身复制到系统目录 `/usr/local/sbin/vm_port_mapping_daemon.sh`
|
||||
@@ -196,7 +178,6 @@ chmod +x /tmp/vm_port_mapping_setup.sh
|
||||
#### 映射文件
|
||||
|
||||
所有端口映射信息保存在 `/etc/vm_port_mapping/mapping.txt` 文件中,格式为:
|
||||
|
||||
```
|
||||
虚拟机名字 IP地址 MAC地址 SSH映射端口 额外端口起始 额外端口结束
|
||||
```
|
||||
@@ -208,45 +189,37 @@ Virtance-1 192.168.33.114 52:54:00:5f:77:92 21422 31400 31409
|
||||
|
||||
#### 服务管理
|
||||
|
||||
##### 查看服务状态
|
||||
- **查看服务状态**:
|
||||
```bash
|
||||
systemctl status vm-port-mapping
|
||||
```
|
||||
|
||||
```bash
|
||||
systemctl status vm-port-mapping
|
||||
```
|
||||
- **启动服务**:
|
||||
```bash
|
||||
systemctl start vm-port-mapping
|
||||
```
|
||||
|
||||
##### 启动服务
|
||||
- **停止服务**:
|
||||
```bash
|
||||
systemctl stop vm-port-mapping
|
||||
```
|
||||
|
||||
```bash
|
||||
systemctl start vm-port-mapping
|
||||
```
|
||||
- **禁用自启动**:
|
||||
```bash
|
||||
systemctl disable vm-port-mapping
|
||||
```
|
||||
|
||||
##### 停止服务
|
||||
- **查看日志**:
|
||||
```bash
|
||||
journalctl -u vm-port-mapping
|
||||
# 或
|
||||
cat /var/log/vm_port_mapping.log
|
||||
```
|
||||
|
||||
```bash
|
||||
systemctl stop vm-port-mapping
|
||||
```
|
||||
|
||||
##### 禁用自启动
|
||||
|
||||
```bash
|
||||
systemctl disable vm-port-mapping
|
||||
```
|
||||
|
||||
##### 查看日志
|
||||
|
||||
```bash
|
||||
journalctl -u vm-port-mapping
|
||||
# 或
|
||||
cat /var/log/vm_port_mapping.log
|
||||
```
|
||||
|
||||
##### 手动触发规则更新
|
||||
|
||||
如果需要手动触发规则更新,可以重启服务:
|
||||
|
||||
```bash
|
||||
systemctl restart vm-port-mapping
|
||||
```
|
||||
- **手动触发规则更新**:
|
||||
```bash
|
||||
systemctl restart vm-port-mapping
|
||||
```
|
||||
|
||||
#### 常见问题
|
||||
|
||||
@@ -280,7 +253,6 @@ systemctl restart vm-port-mapping
|
||||
##### 清理所有规则
|
||||
|
||||
如需清理所有端口映射规则:
|
||||
|
||||
```bash
|
||||
systemctl stop vm-port-mapping
|
||||
iptables -t nat -F PREROUTING
|
||||
@@ -297,7 +269,6 @@ firewall-cmd --reload
|
||||
#### 卸载方法
|
||||
|
||||
如需卸载此服务:
|
||||
|
||||
```bash
|
||||
systemctl stop vm-port-mapping
|
||||
systemctl disable vm-port-mapping
|
||||
@@ -307,7 +278,7 @@ rm -rf /etc/vm_port_mapping
|
||||
systemctl daemon-reload
|
||||
```
|
||||
|
||||
#### 手动映射
|
||||
### 3.2 手动映射
|
||||
|
||||
假设此时你的虚拟机在用户端控制面板显示为
|
||||
|
||||
@@ -335,7 +306,7 @@ systemctl daemon-reload
|
||||
|
||||
可见公网IPV4地址绑定的接口是`ens3`,所以后面的命令这里用`ens3`
|
||||
|
||||
那么映射当前虚拟机的22端口到公网IPV4的3322端口的命令为
|
||||
那么映射当前虚拟机的22端口到公网IPV4的3322端口的命令为:
|
||||
|
||||
```shell
|
||||
# 添加 DNAT 规则:将公网3322流量转发到宿主机本地的192.168.33.130:22
|
||||
@@ -348,73 +319,53 @@ iptables -I INPUT -p tcp --dport 3322 -j ACCEPT
|
||||
|
||||
这样内网的虚拟机就被映射出来,可以直接远程登录使用了。
|
||||
|
||||
## 问题排查
|
||||
## 4. 问题排查
|
||||
|
||||
### 添加计算节点错误排查
|
||||
|
||||
在Controller控制端执行:
|
||||
|
||||
```shell
|
||||
telnet <node ip> 8884
|
||||
```
|
||||
|
||||
在计算节点执行:
|
||||
|
||||
```shell
|
||||
systemctl status webvirtcompute
|
||||
```
|
||||
|
||||
```shell
|
||||
systemctl status libvirtd
|
||||
```
|
||||
|
||||
```shell
|
||||
systemctl status prometheus
|
||||
```
|
||||
|
||||
```shell
|
||||
systemctl status prometheus-libvirt-exporter
|
||||
```
|
||||
|
||||
如果以上都查不出问题,那么就需要到Controller控制端执行:
|
||||
|
||||
```shell
|
||||
docker exec -it webvirtcloud-backend /bin/sh
|
||||
```
|
||||
|
||||
```shell
|
||||
vi webvirtcloud/settings/production.py
|
||||
```
|
||||
|
||||
将 DEBUG=False 改成 DEBUG=True
|
||||
|
||||
然后保存文件后,容器内执行
|
||||
|
||||
将 `DEBUG=False` 改成 `DEBUG=True`,然后保存文件后,容器内执行:
|
||||
```shell
|
||||
UV_PROJECT_ENVIRONMENT=/usr/local uv sync --dev
|
||||
```
|
||||
|
||||
然后```exit```退出容器后,执行
|
||||
|
||||
然后`exit`退出容器后,执行:
|
||||
```shell
|
||||
docker restart webvirtcloud-backend
|
||||
sleep 3
|
||||
docker logs webvirtcloud-backend -f
|
||||
```
|
||||
|
||||
然后前端去触发错误的位置,这块日志实时加载就会看到对应的报错了
|
||||
然后前端去触发错误的位置,这块日志实时加载就会看到对应的报错了。
|
||||
|
||||
### Controller 重启后 Docker 容器不自重启
|
||||
|
||||
如果 Docker 容器在系统重启后没有自动重启,执行以下命令:
|
||||
|
||||
```bash
|
||||
docker start $(docker ps -a -q)
|
||||
```
|
||||
|
||||
## 缺点
|
||||
## 5. 缺点
|
||||
|
||||
系统镜像是写死的,没法使用自己制作的自定义镜像,也没办法导出使用
|
||||
系统镜像是写死的,没法使用自己制作的自定义镜像,也没办法导出使用。
|
||||
|
||||
同 https://github.com/retspen/webvirtcloud 不是同一个项目,不要搞混淆了。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user