Kickstart + kvm generate testing machines in batches 01 kickstart + kvm generate testing machines in batches 02 031. you can use RHEL6.0's built-in kickstart tool to create a template: ks. choose 04 *************************************** * ************** 05 # platform = x86, AMD64, or Intel EM64T06 # version = DEVEL07 # Firewall configuration08firewall -- disabled09 # Install OS instead of upgrade10install11 # Use network installation12url -- url =" ftp://192.168.0.254/pub/rhel6/dvd "13 # Root certificate -- plaintext westos15 # Network information16network -- bootproto = dhcp -- device = eth0 -- onboot = on17 # System authorization information18auth -- useshadow -- passalgo = md519 # Use text mode install20text21 # System keyboard22keyboard us23 # System language24lang en_US25 # SELinux plugin -- disabled27 # Do not configure the X Window plugin # Installation logging level30logging -- level = info31 # Reboot after installation32reboot33 # System Development Asia/platform # System bootloader # configuration36bootloader -- location = mbr37 # Clear the Master Boot Loader # Partition clearing ionion40clearpart -- all -- initlabel41 # Disk partitioning information42part/boot -- fstype = "ext4" -- size = 20043 part/-- fstype = "ext4" -- size = 600044 part swap -- fstype = "swap" -- size = 100045 46% post47cd/etc/yum. repos. d/; 48cat> test. repo <end49 [server] 50 name = server51baseurl = http://192.168.0.254/pub/rhel6/52gpgckeck=053end54mkdir -P/var/cache/yum/x86_64/6 Server; 55yum clean all; 56yum install lftp-y57 % end58 59% packages60 @ base61 @ dial-up62 63% end64 ************************* * **************************** 65 662. test with virt-intall: 67 use the dd command to generate the Virtual Machine hard disk 68 dd if =/dev/zero of =/var/lib/libvirt/images/server. img bs = 1G count = 869 virt-install -- vnc -- noautoconsole -- name = server -- ram = 512 -- arch = x86_64 -- vcpus = 1 -- OS-type = linux -- OS- variant = rhel6 -- hvm -- accelerate -- disk =/var/lib/libvirt/images/server. img size = 8G -- location = ftp://192.168.0.254/pub/rhel6/dvd -- Extra-args = "ks = http://192.168.0.158/ks.cfg "& Virt-install -- autostart server70 713. generate multiple virtual machine shell72 #! /Bin/bash73 # function: add test servers74 75 echo "input servers Num you need:" 76 read Num; 77 78i = 1; 79for (I = 1; I <= $ Num; I ++) 80do81 dd if =/dev/zero of =/var/lib/libvirt/images/server $ I. img bs = 1G count = 882 virt-install -- vnc \ 83 -- noautoconsole \ 84 -- name = server $ I \ 85 -- ram = 512 -- arch = x86_64 \ 86 -- vcpus = 1 -- OS-type = linux \ 87 -- OS-variant = rhel6 \ 88 -- hvm -- accelerate \ 89 -- disk =/var/lib/libvirt/images/server $ I. img size = 8G \ 90 -- location = ftp://192.168.0.254/pub/rhel6/dvd \ 91 -- extra-args = "ks = http://192.168.0.158/ks.cfg ">/Dev/null92 echo" server $ I created OK! "93 done