自动安装虚拟机(kickstart)

xiaoxiao2021-02-28  60

*****************************自动安装虚拟机********************************

1.在虚拟机下载httpd和system-config-kickstart.noarch

2.

systemctl stop firewalld.service #关火墙 systemctl disable firewalld.service #设置火墙开机不启动 systemctl start httpd #开启httpd systemctl enable httpd #设置httpd开机启动

3.执行system-config-kickstart,生成ks.cfg文件

5.将ks.cfg文件保存到/var/www/hmtl目录中

6.vim /var/www/html/ks.cfg  在末尾添加

   %packages

   @base

   lftp

   %end

7.ksvalidator /var/www/hmtl/ks.cfg       #检测ks.cfg文件有无语法错误

 8.编写自动安装脚

#!/bin/bash #命令运行环境的指定 virt-install \ #安装虚拟机 --location http://172.25.254.65/rhel7.0 \ #安装源指定 --ram 1024 \ #内存 --cpus 1 \ #cpu数 --disk /var/lib/libvirt/images/$1.qcow2,size=9,bus=virtio \ #硬盘位置,大小,类型=虚拟IO --name $1 \ #指定虚拟机名称 --network source=br0,model=virtio #网络 --extra-args "ks=http://172.25.254.233/ks.cfg"

9.安装

转载请注明原文地址: https://www.6miu.com/read-2623465.html

最新回复(0)