[root@station201 Server]# rpm -ivh xinetd-2.3.14-10.el5.i386.rpm
warning: xinetd-2.3.14-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:xinetd                 ########################################### [100%]
[root@station201 Server]# rpm -ivh tftp-server-0.42-3.1.i386.rpm
warning: tftp-server-0.42-3.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:tftp-server            ########################################### [100%]

## 在安装一个http或者vsftp之类的软件,再或者这两种都不装,用nfs也可以。



[root@station201 Server]# vim /etc/xinetd.d/tftp
        disable                 = yes           ## 改成no
## 再重启xinetd服务。

[root@station201 tftpboot]# mount /dev/cdrom /var/ftp/pub/Server/
## 我用的VM,把rhel5放到vm的光驱里面,把光驱挂载到/var/ftp/pub/Server目录,作为我的安装源。

[root@station201 Server]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/              ## pxe引导必须的
[root@station201 Server]# cp /usr/lib/syslinux/menu.c32 /tftpboot/                ## 显示启动菜单必须的
[root@station201 Server]# cp /var/ftp/pub/Server/isolinux/vmlinuz /tftpboot/      ## 下面这两个不用说了
[root@station201 Server]# cp /var/ftp/pub/Server/isolinux/initrd.img /tftpboot/
## 把这四个文件cp的tftpboot



[root@station201 Server]# cp /root/anaconda-ks.cfg /var/ftp/pub/ks/ks.cfg
## 用nfs/ftp/http中的一种可以正常访问才行。用于自动安装linux,我是用的/root/anaconda-ks.cfg,经过简单的修改得到。
## 你也可以自己用图形化工具进行生成。再或者你很牛,直接vim编辑出来一个也可以。



## dchpd.conf很关键:
next-server 192.168.1.201;                   ## 这句的意思是指定TFTP服务器。
allow booting;                               ## 可以PXE启动
allow bootp;                                 ## 支持boottp
filename "/pxelinux.0";                      ## pxelinux.o文件位置


## 下面是我的dhcp配置文件。
[root@station201 tftpboot]# more /etc/dhcpd.conf | grep -v "#"
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.1.0 netmask 255.255.255.0 {

option routers 192.168.1.1;
option domain-name-servers 192.168.1.1;
option time-offset -18000;
option root-path "/tftpboot";               ## 指定根目录,没有这个的话,filename “绝对路径”

range dynamic-bootp 192.168.1.12 192.168.1.24;
default-lease-time 21600;
max-lease-time 43200;

next-server 192.168.1.201;
filename "/pxelinux.0";                     ## 这里的实际路径是/tftpboot/pxelinux.0
}


## 插入一个提示:在cisco的交换机下,client所连的port口,要起用spanning-tree  portfast(这个是我的网上看到的一个注意

事项,也没有办法试验,就先记下了。)


## 对于安装源的配置方法,ftp和http篇幅就比较大了。nfs比较简单。(可以google下,一大把的教程。)
## 总之,这些东西配置好,都要可以测试。比如说,ftp可以访问到。http也可以看到文件列表(启用indexes选项)。。。

[root@station201 tftpboot]# more /etc/exports
/var/ftp/pub/Server     192.168.1.0/24(ro)

## nfs就这样,然后重启nfs服务就OK


## 最后来写pxe相关的配置文件
[root@station201 tftpboot]# mkdir /tftpboot/pxelinux.cfg      ## 相关的配置文件都放这个下面(插一句,这个文件名不要

弄错了,我就弄错,费了很多时间才找出来,很多很多时间。错误提示不明显,很难找到。痛苦。)。
## 客户端从dhcp获取到地址后,就来找这里的配置文件。
## 首先,他会找文件名为16位mac地址的文件,没有就去掉最后一位,再找。。。。。。最后找default文件。
## 这个过程大家都会看到的。
## 所以我们把所有的配置都写在default就可以了。

## 下面是我的default内容:
[root@station201 tftpboot]# more /etc/exports
/var/ftp/pub    192.168.1.0/24(ro)
/var/ftp/pub/Server     192.168.1.0/24(ro)
[root@station201 tftpboot]# more /tftpboot/pxelinux.cfg/default
default menu.c32                                      ## 选择一种菜单格式,主要有两种,还有一种是vesamenu.c32
prompt 0
timeout 9999999

MENU TITLE Enjoying the RHCE class.

LABEL rescue
MENU LABEL Boot in a RHEL5.3 rescue mode
kernel vmlinuz
append initrd=initrd.img rescue

MENU SEPARATOR

LABEL linux
MENU LABEL Install RHEL5.3 ^Manually
kernel vmlinuz
append initrd=initrd.img

MENU SEPARATOR

LABEL Einstall
MENU LABEL ^Automatical install RHEL5.3 in ^English
kernel vmlinuz
append ksdevice=eth0 load_ramdisk=1 initrd=initrd.img network ks=http://192.168.1.201/ks/ks.cfg noipv6

MENU SEPARATOR

 LABEL Cinstall
MENU LABEL ^Automatical install RHEL5.3 in ^Chinese
kernel vmlinuz
append ksdevice=eth0 load_ramdisk=1 initrd=initrd.img network ks=http://192.168.1.201/ks/c-ks.cfg noipv6



## 关于syslinux可以参照下面的内容:
############################################################################################
SYSLINUX引导文件解释
isolinux.bin............................................光盘镜像引导文件
isolinux.cfg............................................启动菜单配置文件
memdisk................................................引导IMG镜像的文件
vesamenu.c32........................................二种窗口模块之一
menu.c32..............................................二种窗口模块之一
chain.c32...............................................指定分区启动  如:chain.c32 hd0,1 (或chain.c32 hd1,1)
reboot.c32.............................................重新启动计算机
back.png................................................窗口背景图片
SYSLINUX.CFG菜单解释
default vesamenu.c32...............................默认使用vesamenu.c32窗口模块
timeout 60..............................................菜单停留时间,计时单位1/10秒
F1 readme.txt..........................................按F1阅读自述文件
F2 syslinux.cfg..........................................按F2显示启动菜单配置文件
MENU BACKGROUND back.png....................运行窗口背景图片
MENU TITLE............................................菜单标题                           
MENU WIDTH 40......................................菜单选择条长度
MENU MARGIN 0.......................................菜单选择条缩进,0不缩进
MENU ROWS 30........................................菜单选择条切换,0不能切换
MENU HELPMSGROW 30
MENU TIMEOUTROW 13............................倒计时条下移,0不下移
MENU TABMSGROW 2...............................TAB显示条下移,0不下移
MENU CMDLINEROW 2...............................TAB信息条下移,0不下移
上面这2项的参数必须一致,以免按TAB键后弹出的信息条易位
MENU HSHIFT 5........................................菜单选择条右移,0不右移
MENU VSHIFT 1........................................菜单选择条顶端,0不下移
MENU color border 0 #0000 #0000 none..设置背景图片上的整个菜单外框的线条颜色,线条粗细,单线条或双线条等,还可设置

为不显示菜单外框

#########################################################################################################

## 最后把相关的服务器都起来,
## 最好设置成开始启动。
[root@station201 tftpboot]# chkconfig xinetd on
[root@station201 tftpboot]# chkconfig dhcpd on
[root@station201 tftpboot]# chkconfig httpd on          ## 下面三个启用你选择的那种就可以了
[root@station201 tftpboot]# chkconfig vsftpd on
[root@station201 tftpboot]# chkconfig nfs on


## 最后关于启动菜单,可以google menu.c32


## 最后,客户机通过网络引导后,出现下面的菜单:



## 再最后,我上传我的ks.cfg,做个参考: