yum install vsftpd dhcp system-config-kickstart tftp-server

在虚拟机装载rhel5.4光盘

mount /dev/cdrom /var/ftp/pub

配置yum本地源:

vi /etc/yum.repos.d/local.repo

[base] #这里必须设置为base,否则在后面kickstart中Package Selection中无法显示包列表

name=rhel-server

baseurl=file:///var/ftp/pub/Server

enabled=1

gpgcheck=0

[Cluster]

name=rhel-cluster

baseurl=file:///var/ftp/pub/Cluster

enabled=1

gpgcheck=0

[ClusterStorage]

name=rhel-clusterstorage

baseurl=file:///var/ftp/pub/ClusterStorage

enabled=1

gpgcheck=0

yum clean all

yum makecache

cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

vi /etc/dhcpd.conf

subnet 172.16.10.0 netmask 255.255.255.0 {

option routers 172.16.10.1;

option subnet-mask 255.255.255.0;

next-server 172.16.10.2;

filename "pxelinux.0";

range dynamic-bootp 172.16.10.128 172.16.10.254;

default-lease-time 21600;

max-lease-time 43200;

}

startx

system-config-kickstart

clip_image002

将制作的ks.cfg 文件保存至/var/ftp

vi /etc/xinetd.d/tftp

service tftp

{

socket_type = dgram

protocol = udp

wait = yes

user = root

server = /usr/sbin/in.tftpd

server_args = -s /tftpboot

disable = no #把yes该为no

per_source = 11

cps = 100 2

flags = IPv4

}

cp /var/ftp/pub/images/pxeboot/initrd.img /tftpboot

cp /var/ftp/pub/images/pxeboot/vmlinuz /tftpboot

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

mkdir /tftpboot/pxelinux.cfg

vi /tftpboot/pxelinux.cfg/default

default linux

prompt 1

timeout 6

display boot.msg

F1 boot.msg

F2 options.msg

F3 general.msg

F4 param.msg

F5 rescue.msg

label linux

kernel vmlinuz

append initrd=initrd.img ks=ftp://172.16.10.2/ks.cfg

clip_image004

Service dhcpd start

Service vsftpd start

Service xinetd start

Pxelinux.cfg 配置文件参考:

https://code.google.com/p/redhatsolution/wiki/RHEL_PXE_Installation_Server

http://www.syslinux.org/wiki/index.php/SYSLINUX