通过使用PXE实现无人值守安装操作系统

时间:2025-03-25 07:21:42
[root@pxe ~]# cat /etc/dhcp/ subnet 172.16.16.0 netmask 255.255.255.0 { range 172.16.16.10 172.16.16.210; #地址范围 default-lease-time 3600; #默认超时时间 next-server 172.16.16.253; #TFTP服务器地址 filename "pxelinux.0"; #引导文件syslinux } [root@pxe ~]# cat /etc//tftp # default: off # description: The tftp server serves files using the trivial file transfer \ # protocol. The tftp protocol is often used to boot diskless \ # workstations, download configuration files to network-aware printers, \ # and to start the installation process for some operating systems. service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/ server_args = -s /var/lib/tftpboot disable = no #修改此处为no per_source = 11 cps = 100 2 flags = IPv4 } cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot cp /mnt/isolinux/vmlinuz /var/lib/tftpboot cp /mnt/isolinux/ /var/lib/tftpboot mkdir touch default [root@pxe ]# vim default default menu.c32 #调用菜单文件 timeout 300 #设置超时时间 prompt 0 label 1 #菜单 menu label ^1) install centos7 #显示内容 menu default #默认菜单 kernel vmlinuz #调用内核文件 append initrd= method=http://172.16.16.253/centos7 ks=http://172.16.16.253/ mkdir /var/www/html/centos7 cp /mnt/* /var/www/html/centos7 cp /var/www/html/