记录我的一些生活写照、无聊的牢骚、内心世界的活动 注册 | 登陆

OneClickVirt 虚拟化管理平台

OneClickVirt 虚拟化管理平台

一个可扩展的通用虚拟化管理平台,支持 LXD、Incus、Docker 和 Proxmox VE。
Github:https://github.com/oneclickvirt/oneclickvirt
官方教程:https://www.spiritlhl.net/guide/dashboard.html
hubdocker:https://hub.docker.com/r/spiritlhl/oneclickvirt
快速部署
方式一:使用预构建镜像
使用已构建好的多架构镜像,会自动根据当前系统架构下载对应版本:
基础使用(不配置域名):
XML/HTML代码
  1. docker run -d \
  2.   --name oneclickvirt \
  3.   -p 80:80 \
  4.   -v oneclickvirt-data:/var/lib/mysql \
  5.   -v oneclickvirt-storage:/app/storage \
  6.   --restart unless-stopped \
  7.   spiritlhl/oneclickvirt:latest
配置域名访问:
如果你需要配置域名,需要设置 FRONTEND_URL 环境变量:
XML/HTML代码
  1. docker run -d \
  2.   --name oneclickvirt \
  3.   -p 80:80 \
  4.   -e FRONTEND_URL="https://your-domain.com" \
  5.   -v oneclickvirt-data:/var/lib/mysql \
  6.   -v oneclickvirt-storage:/app/storage \
  7.   --restart unless-stopped \
  8.   spiritlhl/oneclickvirt:latest
说明:FRONTEND_URL 用于配置前端访问地址,影响 CORS、OAuth2 回调等功能。系统会自动检测 HTTP/HTTPS 协议并调整相应配置,协议头可以是http或https。
或者使用 GitHub Container Registry:
XML/HTML代码
  1. docker run -d \
  2.   --name oneclickvirt \
  3.   -p 80:80 \
  4.   -e FRONTEND_URL="https://your-domain.com" \
  5.   -v oneclickvirt-data:/var/lib/mysql \
  6.   -v oneclickvirt-storage:/app/storage \
  7.   --restart unless-stopped \
  8.   ghcr.io/oneclickvirt/oneclickvirt:latest
方式二:自己编译打包
如果需要修改源码或自定义构建:
XML/HTML代码
  1. git clone https://github.com/oneclickvirt/oneclickvirt.git
  2. cd oneclickvirt

  3. docker build -t oneclickvirt .

  4. docker run -d \
  5.   --name oneclickvirt \
  6.   -p 80:80 \
  7.   -v oneclickvirt-data:/var/lib/mysql \
  8.   -v oneclickvirt-storage:/app/storage \
  9.   --restart unless-stopped \
  10.   oneclickvirt
方式三:手动开发部署
环境要求
Go 1.24.5
Node.js 22+
MySQL 8.0+
npm 或 yarn
环境部署
构建前端
XML/HTML代码
  1. cd web
  2. npm i
  3. npm run serve
构建后端
XML/HTML代码
  1. cd server
  2. go mod tidy
  3. go run main.go
开发模式下不需要反代后端,vite已自带后端代理请求。
在mysql中创建一个空的数据库oneclickvirt,记录对应的账户和密码。
访问前端地址,自动跳转到初始化界面,填写数据库信息和相关信息,点击初始化。
完成初始化后会自动跳转到首页,可以开始开发测试了。
本地开发
前端:http://localhost:8080
后端 API:http://localhost:8888
API 文档:http://localhost:8888/swagger/index.html
默认账户
系统初始化后会生成以下默认账户:
管理员账户:admin / Admin123!@#
普通用户:testuser / TestUser123!@#
提示:请在首次登录后立即修改默认密码。
配置文件
主要配置文件位于 server/config.yaml
演示截图

      

Docker安装:https://www.spiritlhl.net/guide/docker/docker_install.html
LXD安装:https://www.spiritlhl.net/guide/lxd/lxd_install.html
开设虚拟内存(SWAP)(非必须的可选项)
XML/HTML代码
  1. 国际
  2. curl -L https://raw.githubusercontent.com/spiritLHLS/addswap/main/addswap.sh -o addswap.sh && chmod +x addswap.sh && bash addswap.sh
  3. 国内
  4. curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/spiritLHLS/addswap/main/addswap.sh -o addswap.sh && chmod +x addswap.sh && bash addswap.sh
Docker安装
XML/HTML代码
  1. 国际
  2. curl -L https://raw.githubusercontent.com/oneclickvirt/docker/main/scripts/dockerinstall.sh -o dockerinstall.sh && chmod +x dockerinstall.sh && bash dockerinstall.sh
  3. 国内
  4. curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/docker/main/scripts/dockerinstall.sh -o dockerinstall.sh && chmod +x dockerinstall.sh && bash dockerinstall.sh
LXD主体安装
XML/HTML代码
  1. 国际
  2. curl -L https://raw.githubusercontent.com/oneclickvirt/lxd/main/scripts/lxdinstall.sh -o lxdinstall.sh && chmod +x lxdinstall.sh && bash lxdinstall.sh
  3. 国内
  4. curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/lxd/main/scripts/lxdinstall.sh -o lxdinstall.sh && chmod +x lxdinstall.sh && bash lxdinstall.sh 
使用此项目可以在docker中运行,管理其他设备的lxd和docker容器,或者kvm虚拟机,简单易用,支持nat v4和ipv6,作为自用的管理小鸡平台。

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):