再用TFTP(trivial file transfer protocol)或MTFTP(multicast trivial file transfer protocol)协议下载一个启动软件包到本机内存中执行,由这个启动软件包完成终端(客户?)基本软件设置,从而引导预先安装在服务器中的终端操作系统。PXE可以引导多种操作系统,如:Windows95/98/2000/windows2003/windows2008/winXP/win7/win8,linux等。
例子
[root@PXE ~]# yum install syslinux xinetd tftp-server dhcp -y
Dependencies Resolved
===============================================
Package Arch Version Repository Size
===============================================
Installing:
syslinux x86_64 4.04-3.el6 base 346 k
tftp-server x86_64 0.49-7.el6 base 39 k
xinetd x86_64 2:2.3.14-39.el6_4 base 121 k
Installing for dependencies:
mtools x86_64 4.0.12-1.el6 base 194 k
syslinux-nonlinux noarch 4.04-3.el6 base 584 k
Transaction Summary
=====================================================================================================================================
Install 5 Package(s)
Total download size: 1.3 M
Installed size: 2.8 M
############DHCP############
[root@PXE ~]# yum install dhcp
[root@PXE ~]# cat /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS=eth0
############安装apache############
[root@PXE ~]# yum install httpd
[root@PXE ~]# rpm -qa|grep httpd
httpd-tools-2.2.15-47.el6.centos.1.x86_64
httpd-2.2.15-47.el6.centos.1.x86_64
[root@PXE ~]# /etc/init.d/httpd start
############镜像拷贝到apache根目录############
[root@PXE ~]# mkdir /mnt/cdrom
[root@PXE ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@PXE ~]# cp -r /mnt/cdrom/ /var/www/html/ #yum apache 默认路径是/var/www/html
############网络守护进程服务程序############
[root@PXE ~]# cp /etc/xinetd.d/tftp /etc/xinetd.d/tftp.bk$(date +%F)
disable = yes
修改为 disable = no
[root@PXE ~]# /etc/init.d/xinetd restart
############必要镜像############
[root@PXE ~]# cp /var/www/html/cdrom/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/
[root@PXE ~]# cp /var/www/html/cdrom/isolinux/*.msg /var/lib/tftpboot/
[root@PXE ~]# cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
[root@PXE ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@PXE ~]# cp /var/www/html/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@PXE ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@PXE ~]# ll /var/lib/tftpboot/pxelinux.cfg/default
-r--r--r--. 1 root root 936 Jan 23 15:00 /var/lib/tftpboot/pxelinux.cfg/default
[root@PXE ~]# cp /var/www/html/cdrom/isolinux/vesamenu.c32 /var/lib/tftpboot/
[root@PXE ~]# ll /var/lib/tftpboot/
total 38316
-r--r--r--. 1 root root 84 Jan 23 15:45 boot.msg
-r--r--r--. 1 root root 34815427 Jan 23 15:45 initrd.img #这是一个初始化文件,一个最小的系统镜像
-rw-r--r--. 1 root root 61796 Jan 23 15:48 menu.c32
-rw-r--r--. 1 root root 26759 Jan 23 15:51 pxelinux.0 #这文件是为legcay启动,它是legcay的启动镜像
drwxr-xr-x. 2 root root 4096 Jan 23 15:50 pxelinux.cfg #该文件夹下放的是启动菜单,手动创建
-r--r--r--. 1 root root 163728 Jan 23 15:54 vesamenu.c32 #legacy BIOS引导菜单工具,可以从光盘或 /usr/share/syslinux/ 中找到
-r-xr-xr-x. 1 root root 4152336 Jan 23 15:45 vmlinuz #内核文件