PXE+Kickstart
1.关闭firewall和selinux
firewall-cmd --set-default-zone=trusted vi /etc/selinux/config reboot getenforce firewall-cmd --list-all
2.配置vsftp服务
通过ftp来共享系统镜像文件
yum -y install vsftpd rpm -qc vsftpd vim /etc/vsftpd/vsftpd.conf 配置anonymous_enable=YES systemctl restart vsftpd mkdir /var/ftp/iso mount -t iso9660 /dev/sr0 /var/ftp/iso 使用ftp://本机地址/iso来访问镜像
3.配置dhcp服务
通过dhcp服务来下发网络配置、引导文件名字、存放内核文件的tftp服务器地址
yum -y install dhcp-server rpm -qc dhcp-server vim /etc/dhcp/dhcpd.conf rpm -ql dhcp-server | grep example cat /usr/share/doc/dhcp-server/dhcpd.conf.example > /etc/dhcp/dhcpd.conf vim /etc/dhcp/dhcpd.conf subnet 192.168.10.0 netmask 255.255.255.0 { range 192.168.10.26 192.168.10.30; option domain-name-servers 192.168.10.254; option domain-name "huawei.com"; option routers 192.168.10.254; option broadcast-address 192.168.10.255; next-server 192.168.10.130; filename "/pxelinux.0"; default-lease-time 600; max-lease-time 7200; } systemctl restart dhcpd
4.配置tftp服务
yum -y install tftp-server systemctl enable tftp --now systemctl list-unit-files | grep tftp tftp.socket enabled cd /var/lib/tftpboot/ ls yum -y install syslinux yum -y install syslinux-tftpboot rpm -ql syslinux-tftpboot cp -a /tftpboot/* /var/lib/tftpboot/ ls mkdir pxelinux.cfg cd /var/ftp/iso/images/pxeboot/ cp initrd.img vmlinuz /var/lib/tftpboot/ cd /var/ftp/iso/isolinux/ cp isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default chmod u+x /var/lib/tftpboot/pxelinux.cfg/default cd /var/lib/tftpboot/pxelinux.cfg/ vim default 1 default rhel8 3 timeout 0 62 label rhel8 63 menu label ^Install CentOS Linux 8 64 kernel vmlinuz 65 append initrd=initrd.img inst.repo=ftp://192.168.10.130/iso/ quiet
5.简单配置KickStart应答文件
cd /var/lib/tftpboot/pxelinux.cfg/ vim default 65 #append initrd=initrd.img inst.repo=ftp://192.168.10.130/iso/ quiet 66 append initrd=initrd.img inst.ks=ftp://192.168.10.130/ks.cfg quiet systemctl restart tftp cp /root/anaconda-ks.cfg /var/ftp/ks.cfg cd /var/ftp/ chmod 644 ks.cfg vim ks.cfg 2 reboot 11 #cdrom 21 #repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream 12 url --url="ftp://192.168.10.130/iso/"
对于应答文件进行语法正误检测
yum whatprovides ksvalidator yum -y install pykickstart ksvalidator ks.cfg | echo $?