WebVirtCloud

更新时间:2026年1月15日 10:50 浏览:7

github:
https://github.com/retspen/webvirtcloud

快速安装

wget https://raw.githubusercontent.com/retspen/webvirtcloud/master/install.sh
chmod 744 install.sh
# run with sudo or root user
./install.sh

git 下载失败处理

install.sh 会下载一个 webvirtcloud.sh 的文件,修改 webvirtcloud.sh 中的 git 网址,改为代理网址

# readonly APP_REPO_URL="https://github.com/retspen/webvirtcloud.git"

# 示例,使用 gh-proxy.org 代理
readonly APP_REPO_URL="https://gh-proxy.org/https://github.com/retspen/webvirtcloud.git"

pip 安装报错处理

# 修改 webvirtcloud.sh 中 pip3 install 改为国内源
# pip3 install -U pip
# pip3 install -r conf/requirements.txt -q
pip3 install -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install -r conf/requirements.txt -q -i https://pypi.tuna.tsinghua.edu.cn/simple

构建为 docker 镜像 & docker 部署

# 拉取最新代码
git clone https://github.com/retspen/webvirtcloud

cd webvirtcloud

# 生成配置文件
cp webvirtcloud/settings.py.template webvirtcloud/settings.py

修改配置文件 settings.py ,缺少本操作构建 docker 镜像会报错

import os

...

# 找到并修改代码中的 SECRET_KEY, 从 ENV 讯取随机字符串
SECRET_KEY = os.getenv('SECRET_KEY', 'xxxxx')
# 找到并修改代码中的 CSRF_TRUSTED_ORIGINS 配置部署的域名
CSRF_TRUSTED_ORIGINS = ['http://localhost', os.getenv('CSRF_TRUSTED_ORIGIN', 'xxxxx')]

构建 docker 镜像 & 运行


# 构建镜像
docker build -t webvirtcloud:v1.0 .


# 部署
# db.sqlite3 可选不挂载,启动后从容器内拷出来,再挂载进去
docker run \
  --restart always \
  --name webvirtcloud \
  -p 80:80 \
  -p 6080:6080 \
  -v /data/docker/webvirtcloud/db.sqlite3:/srv/webvirtcloud/db.sqlite3 \
  -v /data/docker/webvirtcloud/ssh:/var/www/.ssh \
  -e SECRET_KEY=H1FhC1106RWUw1hm \
  -e CSRF_TRUSTED_ORIGIN=https://kvm.xxx.com \
  -itd \
  webvirtcloud:v1.0

# 新增kvm窠主机后,需要要进到容器里 ssh 里连一下,以保存到 known_hosts
docker exec -i -t webvirtcloud /sbin/setuser www-data ssh root@10.x.x.x

访问

httpsL//部署的域名
默认账号
admin / admin

导航