(在真机44中)
cd /mnt
vim create_vm.sh
#!/bin/bash
virt-install \
--name $1 \
-- ram 1024 \
--cpus 1 \
--disk /var/lib/libvirt/images/$1.qcow2,size=9,bus=virtio \
-- network bridge=br0,model=virtio \
--location http://172.25.254.44/rhel7.2 &
/mnt/create-vm.sh xxx ##创建虚拟机 (半自动创建)
(在真机44)cd /mnt
1.yum install system-config-kickstart httpd -y
2.systm-config-kickstart
cd /var/www/html
ls(会显示有ks.cfg)
vim ks.cfg内容如下:+
%packages
@base
lftp
%end
%post
cat >>/etc/yum.repos.d/yum.repo <<EOF
[rhel7.2]
name=rhel7.2
baseurl=http://172.25.254.44/rhel7.2
gpgcheck=0
EOF
%end
ksvalidator ks.cfg
systemctl start httpd
systemctl disable firewalld
systemctl stop firewalld
systemctl enable httpd
(在真机44中)
cd /mnt
vim create_vm.sh
#!/bin/bash
virt-install \
--name $1 \
-- ram 1024 \
--cpus 1 \
--disk /var/lib/libvirt/images/$1.qcow2,size=9,bus=virtio \
-- network bridge=br0,model=virtio \
--location http://172.25.254.44/rhel7.2
--extra-args ks=http://172.25.254.144/ks.cfg &
/mnt/create_vm.sh xxx ##自动完全创建虚拟机