PXE

PXE+DHCP+HTTP+TFTP

光盘挂在/mnt下并且已经配置好yum源

yum -y install syslinux xinetd tftp-server dhcp httpd

mkdir /var/lib/tftpboot/pxelinux.cfg

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

vim /etc/xinetd.d/tftp

   

# line 14: change

disable = no

   

systemctl start xinetd

systemctl enable xinetd

vim /etc/dhcp/dhcpd.conf

   

subnet 10.30.40.0 netmask 255.255.255.0 {

range dynamic-bootp 10.30.40.240 10.30.40.250;

option routers 10.30.40.254;

filename "pxelinux.0";

next-server 10.30.40.150;

}

   

systemctl restart dhcpd

   

mkdir -p /var/pxe/centos7

mkdir /var/lib/tftpboot/centos7

cp -r /mnt/* /var/pxe/centos7/

   

cp /var/pxe/centos7/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7/

cp /var/pxe/centos7/images/pxeboot/initrd.img /var/lib/tftpboot/centos7/

cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/

   

  

使用http共享系统镜像

想要使用ftp或者nfs共享镜像的,以下的http://可以替换为对应的ftp://或者nfs://都可以

vim /var/lib/tftpboot/pxelinux.cfg/default

   

timeout 100

default menu.c32

   

label 1

menu label ^1) Install CentOS 7

kernel centos7/vmlinuz

append initrd=centos7/initrd.img method=http://10.30.40.150/centos7 devfs=nomount

   

label 2

menu label ^2) Boot from local drive

localboot

   

vim /etc/httpd/conf.d/pxeboot.conf

   

Alias /centos7 /var/pxe/centos7

<Directory /var/pxe/centos7>

Options Indexes FollowSymLinks

Require all granted

</Directory>

   

systemctl restart httpd

  

修改kickstart文件添加内容

cp ./anaconda-ks.cfg /var/pxe/centos7/ks.cfg

chmod a+r /var/pxe/centos7/ks.cfg

vim /var/pxe/centos7/ks.cfg

   删除其中的cdrom

install

url --url="http://10.30.40.150/centos7"

   

vim /var/lib/tftpboot/pxelinux.cfg/default

   添加以下内容至label 1最后一行的后面

ks=http://10.30.40.150/centos7/ks.cfg

原文地址:https://www.cnblogs.com/wangmuchen/p/11226630.html