环境:虚拟机VM,Centos5.0
说明:我的ip地址为192.168.141.3,为客户机分配的ip地址范围为
192.168.141.180-192.168.141.182
ddns-update-style interim;
ignore client-updates;
allow booting; #定义可以PXE方式启动
allow bootp; #定义支持boottp
class "pxeclients" {
match if substring(option vendor-class-identifier,0,9) = "PXEClient";
filename "/pxelinux.0"; #pxelinux.0启动引导文件存放路径
next-server 192.168.141.3; #TFTP服务器ip地址,所以dhcpd与TFTP服务器不一定在一个机器
上
}
subnet 192.168.141.0 netmask 255.255.255.0 { #DHCP服务器自身网段及子网掩码
# --- default gateway
option routers 192.168.141.2;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.141.2; #域名服务器ip,可以不使,但最好
设置一个免得安装中提示
option time-offset -18000;
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.141.180 192.168.141.182; #DHCP地址池
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
# host ns {
使
# next-server marvin.redhat.com;
# hardware ethernet 12:34:56:78:AB:CD;
# fixed-address 207.175.42.254;
# }
}
# 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
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
prompt 1
timeout 60
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
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks=ftp://192.168.141.3/anaconda-ks.cfg initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -
F;修改/var/ftp/anaconda-ks.cfg如下:
install
url --url=ftp://192.168.141.3/pub
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$oK96NKbn$9vjtYYXYpWTjuicKjciMH0
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --enforcing
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --initlable
part /boot --fstype ext3 --size=100 --asprimary
part swap --size=256
part / --fstype ext3 --size=1 --grow --asprimary
%packages
@admin-tools
@base
@base-x
@core
@development-libs
@development-tools
@dialup
@editors
@games
@gnome-desktop
@graphical-internet
@graphics
@network-server
@office
@printing
@sound-and-video
@system-tools
@text-internet
kernel-devel
另外:
clearpart --all --initlabel
--all 擦除系统上原有所有分区;
--initlabel 初始化磁盘卷标为系统架构的默认卷标
加了--initlabel可防止如下情况的出现: