【教程】如何利用脚本批量创建kvm小鸡

初状态:

末状态:

  • 系统要求:Debian 8 (建议debian11而不是debian12,因为后者是beta版本,debian11安装的才是稳定版)

  • 硬件要求:2核2G内存x86_64架构服务器硬盘至少20G

  • 可开KVM的硬件要求:VM-X或AMD-V支持 (部分VPS和全部独服支持)

  • 如果硬件或系统需求不满足,可使用LXD批量开LXC容器

第一步:检测环境

bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/check_kernal.sh)

  • 查看是否符合安装PVE的要求,不符合则无法使用后续的脚本
  • 检测硬件配置是否满足最低要求
  • 检测硬件环境是否可嵌套虚拟化KVM类型的服务器
  • 检测系统环境是否可嵌套虚拟化KVM类型的服务器
  • 不可嵌套虚拟化KVM类型的服务器也可以开LXC虚拟化的服务器,但不推荐安装PVE,不如使用LXD

第二步:开设虚拟内存

curl -L https://raw.githubusercontent.com/spiritLHLS/addswap/main/addswap.sh -o addswap.sh && chmod x addswap.sh && bash addswap.sh

建议添加虚拟内存为内存的2倍

第三步:安装PVE

curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/install_pve.sh -o install_pve.sh && chmod x install_pve.sh && bash install_pve.sh

安装后执行 sudo reboot 重启系统

使用SSH登录后,等待至少20秒再次执行次脚本

curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/install_pve.sh -o install_pve.sh && chmod x install_pve.sh && bash install_pve.sh

安装后即可打开HTTPS网页
用户名、密码就是服务器所使用的用户名、密码(如root和root用户的密码)

第四步:配置环境

bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_backend.sh)

sudo reboot

bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/build_nat_network.sh)

第五步:一键生小鸡

curl -L https://raw.githubusercontent.com/spiritLHLS/pve/main/scripts/create_vm.sh -o create_vm.sh && chmod x create_vm.sh && bash create_vm.sh

致谢官方教程:https://virt.spiritlhl.net/

点赞
  1. songshi说道:

    好文,后果后面支持kubevirt就更好了

  2. 山木说道:

    绑定【教程】如何利用脚本批量创建kvm小鸡

发表回复

电子邮件地址不会被公开。必填项已用 * 标注

×
订阅图标按钮