(在真机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  &

linux中自动安装的脚本

 

/mnt/create-vm.sh xxx    ##创建虚拟机  (半自动创建)

 

 

linux中自动安装的脚本

 

 

 

(在真机44)cd /mnt

1.yum install system-config-kickstart  httpd -y

2.systm-config-kickstart

linux中自动安装的脚本

 

linux中自动安装的脚本

linux中自动安装的脚本

linux中自动安装的脚本

linux中自动安装的脚本

linux中自动安装的脚本

 

linux中自动安装的脚本

linux中自动安装的脚本

cd  /var/www/html

ls(会显示有ks.cfg)

linux中自动安装的脚本

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

linux中自动安装的脚本

ksvalidator ks.cfg

systemctl start httpd

systemctl disable firewalld

systemctl stop firewalld

systemctl enable httpd

linux中自动安装的脚本

(在真机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 &

linux中自动安装的脚本

/mnt/create_vm.sh   xxx    ##自动完全创建虚拟机

linux中自动安装的脚本

相关文章:

  • 2021-05-02
  • 2021-10-28
  • 2021-10-20
  • 2021-08-17
  • 2021-06-21
  • 2021-06-21
  • 2021-05-24
猜你喜欢
  • 2021-10-31
  • 2021-09-20
  • 2021-04-09
  • 2022-01-01
  • 2022-01-08
相关资源
相似解决方案