[root@pxe ~]# hostnamectl
Static hostname: pxe.timinglee.org
Icon name: computer-vm
Chassis: vm
Machine ID: 380f481f1fef42d7ab5705f1fca7b016
Boot ID: 3ffde0969f6f4203b3a86ba00700d7e4
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.9 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.9:GA:server
Kernel: Linux 3.10.0-1160.el7.x86_64
Architecture: x86-64
# 查看有没有pxe
[root@pxe ~]# yum search pxelinux
[root@pxe ~]# yum install syslinux.x86_64
[root@pxe ~]# yum install tftp-server.x86_64
[root@pxe ~]# rpm -ql tftp-server
[root@pxe ~]# systemctl enable --now tftp
[root@pxe ~]# netstat -antluple
[root@pxe ~]# systemctl enable --now tftp
[root@pxe ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@pxe ~]# cd /var/lib/tftpboot/
[root@pxe tftpboot]# ls
boot.cat initrd.img memtest TRANS.TBL vmlinuz
boot.msg isolinux.bin pxelinux.0 upgrade.img
grub.conf isolinux.cfg splash.png vesamenu.c32
# 创建pxelinux.cfg
[root@pxe tftpboot]# mkdir pxelinux.cfg
[root@pxe tftpboot]# cp isolinux.cfg pxelinux.cfg/default
# 修改dhcp文件
[root@pxe tftpboot]# vim /etc/dhcp/dhcpd.conf
subnet 172.25.254.0 netmask 255.255.255.0 {
range 172.25.254.30 172.25.254.40;
option routers 172.25.254.0;
next-server 172.25.254.100;
filename "pxelinux.0";
[root@pxe tftpboot]# systemctl restart dhcpd
# 修改default文件
[root@pxe ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
timeout 30
label linux
menu label ^Install Red Hat Enterprise Linux hahahahha
menu default
kernel vmlinuz
append initrd=initrd.img repo=http://172.25.254.100/rhel7 ks=http://172.25.254.100/ks.cfg quiet
[root@pex ~]# systemctl enable --now dhcpd
### 新建立一个虚拟机进行测试

