Linux 全自动安装脚本安装虚拟机

作用:批量安装虚拟机

[root@localhost Desktopl]# yum install -y system-config-kickstart.noarch 	
[root@localhost Desktopl]# yum install -y httpd
[root@localhost Desktopl]# systemctl start httpd
[root@localhost Desktopl]# systemctl stop firewalld
[root@localhost Desktopl]# systemctl disable firewalld
[root@localhost Desktopl]# system-config-kickstart

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

[root@localhost ~]# cd /var/www/html/
[root@localhost html]# vim ks.cfg  # 完善安装脚本 
50 %packages 
51 @base 
52 lftp 
53 %end

在这里插入图片描述

[root@localhost html]# ksvalidator ks.cfg   # 检测语法正确性,但是不能检测设定的合理性

测试

[root@foundation78 ~]# cd /mnt
[root@foundation78 mnt]# vim vm_install.sh   # 这是7.2版本虚拟机的自动安装脚本
1 #!/bin/bash  
2 virt-install \  
3 --name $1 \  
4 --ram 1000 \  
5 --vcpus 1 \  
6 --disk /var/lib/libvirt/images/$1.qcow2,size=8,bus=virtio \  
7 --network source=br0,model=virtio \  
8 --location http://172.25.254.78/rhel7.2 \  
9 --extra-args "ks=http://172.25.254.138/ks.cfg"   &> /dev/null &

在这里插入图片描述

[root@foundation78 mnt]# sh vm_install.sh lala	  # 执行脚本

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值