####unit自动安装系统####

####1.kickstart脚本####
kickstart脚本是自动应答系统在安装过程中一切问题的脚本文件
这个文件可以实现系统的自动安装
再系统安装完毕后会在系统的root家目录中生成
anaconda-ks.cfg 这个文件就是以此系统为木板生成的kickstart脚本

####2.kickstart脚本的制作####
手动编写kickstart的难度很大
系统中system-config-kickstart工具可以以图形的方式制作kickstart

yum install system-config-kickstart -y ##安装图形制作工具
system-config-kickstart                ##打开图形ks制作工具
ksvalidator ks.cfg                     ##检测ks语法

看10.29的截图

wKiom1gZauHxH_1VAAS-cdJxzeY421.png-wh_50

wKioL1gZa1aySrqWAAR70BOvypg446.png-wh_50

wKiom1gZavaAr6PXAASSKIUX_GU945.png-wh_50

wKioL1gZaviBcR-jAATj8_xTL1U580.png-wh_50

wKioL1gZavqj8669AAQtDUaykUw136.png-wh_50

wKioL1gZavyymgm4AARFnIkdT1s042.png-wh_50

wKiom1gZav-hxueDAARF7900ygY305.png-wh_50

wKioL1gZawGRwqV1AASC2ShhFIU816.png-wh_50

wKiom1gZawOx3NApAANzoy31tL4346.png-wh_50

wKiom1gZawTSaqbpAAN4jsWg0LQ679.png-wh_50

wKioL1gZawaBaY1IAAQBfW9Bbog311.png-wh_50


####3.kickstart文件共享####
yum install httpd -y
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl start httpd
systemctl enable httpd
cp ks.cfg /var/www/html

####4.测试ks文件####
[root@foundation22 ~]# virt-install  \
> --name test  \
> --ram 800  \
> --file /var/lib/libvirt/p_w_picpaths/test.qcow2  \
> --file-size 8  \
> --location ftp://172.25.254.250/pub/rhel7.2  \
> --extra-args "ks=http://172.25.254.100/ks.cfg"  &

####附加pxe网络安装服务####
1.相应软件安装
yum install dhcp tftp-server syslinux httpd -y 注:xinetd.x86._64
systemctl stop firewalld.service
systemctl disable firewalld.service
vim /etc/xinetd.d/tftp
[ disable = yes ] =====> [ disable = no ]
systemctl restart xinetd
systemctl start httpd
systemctl enable httpd

2.必须文件的下载复制
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
把安装镜像中isolinux/* 全部复制/var/lib/tftpboot/
mkdir /var/lib/tftpboot /pxelinux.cfg
cp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pexlinux.cfg/default

3.dhcpd服务的配置
subnet 172.25.254.0 netmask 255.255.255.0 {
    range 172.25.254.200 172.25.254.220;
     option routers 172.25.254.254;
     filename "pxelinux.0";
      next-server 172.25.254.100;
}