Tilbage til Linux og Unix


PXE Server

yum update -y
yum install httpd xine.std syslinux tftp-server dhcp -y
sed -i '/disable/s/no/yes/' /etc/xinetd.d/tftp
sed -i '/SELINUX=/s/enforcing/disabled/' /etc/selinux/config

cp /usr/share/syslinux/{reboot.c32,pxelinux.0,menu.c32,memdisk,mboot.c32,chain.c32} /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg

systemctl enable dhcpd
systemctl enable httpd
systemctl disable firewalld
systemctl stop firewalld
reboot
cat <<'EOT' >/var/lib/tftpboot/pxelinux.cfg/default

default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

menu title ########## PXE Boot Menu ##########

label 1
menu label ^1) Install CentOS 7
kernel centos7_x64/images/pxeboot/vmlinuz
append initrd=centos7_x64/images/pxeboot/initrd.img method=http://192.168.1.150/centos7_x64 devfs=nomount

label 2
menu label ^2) Boot from local drive localboot
EOT
cat <<'EOT' > /etc/dhcp/dhcpd.conf
allow booting;
allow bootp;

subnet 10.0.0.0 netmask 255.255.255.0 {
      option domain-name-servers 10.0.0.1;
      option broadcast-address 10.0.0.255;
      option routers 10.0.0.1;
      range 10.0.0.101 10.0.0.200;
      next-server 10.0.0.1;
      filename "pxelinux.0";
}
EOT
systemctl restart dhcpd