1. Install system-config-kickstart
to check whether the ks.cfg file has errors
ksvalidator /mnt/ks.cfg
vim automatically vm_create.sh
#!/bin/bash
virt-install \
--location http://172.25.254.8/rhel7.2 \
--memory 1024 \
--vcpus 2 \
- -disk /var/lib/libvirt/images/$1.qcow2,bus=virtio,size=9 \
--name $1 \
--network model=virtio,source=br0 \
yum install system-config-kickstart -y
system-config-kickstart
Select time zone, set password
Fill in the http mount location
choose the first
Select all the first and partition, /boot partition is 200 /swap partition is 500 /partition is the rest
Firewall choose not to start
The network option is eth0
Finally, select sever to save to /mnt. After the save is successful, ls can check whether the save is successful.
to check whether the ks.cfg file has errors
ksvalidator /mnt/ks.cfg
Note: Edit ks.cfg file with system-config-kickstart ks.cfg check
scp ks.cfg [email protected]:/var/www/html/ Note: It can be shared on the real machine and can be called by all virtual machine installations
vim automatically vm_create.sh
#!/bin/bash
virt-install \
--location http://172.25.254.8/rhel7.2 \
--memory 1024 \
--vcpus 2 \
- -disk /var/lib/libvirt/images/$1.qcow2,bus=virtio,size=9 \
--name $1 \
--network model=virtio,source=br0 \
--extra-args "ks=http://172.25.254.148/ks.cfg" &
sh vm_create.sh VM-NAME