Linux 脚本—-PXE脚本。
#!/bin/bash #zxs read -p "请输入IP地址:" name read -p "请输入网段:" a read -p "请输入地址池:" b read -p "请输入网关:" c iptables -F &> /dev/null systemctl stop firewalld &> /dev/null setenforce 0 &> /dev/null yum -y install vsftpd &> /dev/null echo $? " ok" [ -d /var/ftp/asd ] || mkdir /var/ftp/asd yum -y install tftp-server syslinux dhcp &> /dev/null rpm -q tftp-server rpm -q dhcp umount /dev/sr0 mount /dev/sr0 /var/ftp/asd sed -i "s/yes/no/g" /etc/xinetd.d/tftp cd /var/ftp/asd/isolinux cp vmlinuz initrd.img /var/lib/tftpboot/ cp /root/anaconda-ks.cfg /var/ftp/ks.cfg chmod 777 /var/ftp/ks.cfg sed -i "s/cdrom/#cdrom/" /var/ftp/ks.cfg sed -i "s/url/#url/" /var/ftp/ks.cfg sed -i "5a url --url=ftp://${name}/asd" /var/ftp/ks.cfg cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ cp /var/ftp/asd/isolinux/isolinux.cfg /var/lib/tftpboot/ chmod 644 /var/lib/tftpboot/isolinux.cfg mkdir /var/lib/tftpboot/pxelinux.cfg mv /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default sed -i "s/default vesamenu.c32/default linux/" /var/lib/tftpboot/pxelinux.cfg/default sed -i ‘2a prompt 0‘ /var/lib/tftpboot/pxelinux.cfg/default sed -i "65a append initrd=initrd.img inst.repo=ftp://${name}/asd inst.ks=ftp://${name}/ks.cfg" /var/lib/tftpboot/pxelinux.cfg/default rm -rf /etc/dhcp/dhcpd.conf cat>/etc/dhcp/dhcpd.conf /dev/nullsystemctl start dhcpdsystemctl enable dhcpd &> /dev/nullsystemctl start vsftpdsystemctl enable vsftpd &> /dev/null
以上就是
为各位朋友分享的 相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多 等着你!