Linux自动安装虚拟机

kickstart
使用kickstart,系统管理员可以创建一个包含安装期间所有常见问题的答案的文件,以自动安装Red HatEnterprise Linux;

Kickstart 类似于Oracle solaris中的Jumpstart或Microsoft Windows的无人值守安装
一、环境

二、用system-config-kickstart工具配置自动安装脚本步骤:
1.命令system-config-kickstart打开kickstart工具

[root@foundation68 ~]# system-config-kickstart           

2.配置kickstart图形信息
1)Basic Configuration设置

选定时区Asia/Shanghai

设定root超级用户密码

勾选Encrypt root passwd给root密码加密

Target Architecture选择x86,AMD64,or inter EM64T架构

扫描二维码关注公众号,回复: 3845148 查看本文章

勾选Reboot 安装完成后执行重启密令

勾选Perform 只安装文本,不安装图形

2)Installation Method 里设置

method 选择perform new installation

source 选择HTTP:

sever配置为172.25.254.68  yum源的ip地址

directory配置为/rhel7.2  iso镜像文件存放目录

3)引导装载程序

type选择install new boot loader  建立新的引导程序

options选择install boot loader on Master Boot Record(MBR)

4)磁盘分区配置

在layout中添加三个分区:

file system type中选择swap分区,配置500M空间,点击OK

mount point中选择/boot分区,配置200M空间,点击OK

mount point中选择/分区,勾选fill all unused space disk配置所有剩余空间,点击OK

        

                                

5)网络配置

点击add network device,配置设备名称为eth0,选择网络模式为DHCP

6)Authentication配置

保持默认设置

7)防火墙配置

SELinux选择Disabled  关闭

Security level选择disable firewall  开机不开启防火墙

 

8)Display Configuration配置

保持默认设置

9)Package Selection配置

存在bug,无需设置

10)执行脚本前执行此命令

保持默认配置

11)执行脚本后执行此命令

12)点左上角file保存ks.cfg到/var/www/html/目录中(即保存到httpd服务的网络共享目录)

3.编辑ks.cfg文件,完善配置

  

设置packages安装方式,在编辑时必须以“%”开头,并以“%end”结尾

@表示软件组;若添加@x11表示安装图形,本次实验为快速安装未安装图形界面

   

4.用ksvalidator命令检查ks.cfg是否存在格式错误

三、编辑KS自动安装脚本

[root@foundation68 mnt]# vim vm_create.sh     ##写自动安装的脚本

[root@foundation28 mnt]# chmod +x /mnt/vm_create.sh     ##给它一个执行权限
[root@foundation28 mnt]# /mnt/vm_create.sh  ks        ##自动安装一个虚拟机名字ks(自定义)

 

猜你喜欢

转载自blog.csdn.net/msm05138240/article/details/83314360