1、系统环境
Centos 5.5
IP:192.168.11.5, Gateway: 192.168.11.1
2 、使用yum方式安装软件包
yum install -y tftp* xinetd dhcpd
3 、配置dhcp服务器
cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
[[email protected] tftpboot]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
filename "/pxelinux.0";
next-server 192.168.11.5;
allow booting;
allow bootp;
subnet 192.168.11.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.11.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.11.1;
option time-offset -18000; # Eastern Standard Time
# 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.11.128 192.168.11.254;
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;
}
}
4、配置tftp服务器
[[email protected] tftpboot]# vi /etc/xinetd.d/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/in.tftpd
server_args = -u nobody -s /tftpboot #指定目录
disable = no #将yes改为no
per_source = 11
cps = 100 2
flags = IPv4
}
~
~
~
~
"/etc/xinetd.d/tftp" 18L, 519C
5、配置NFS服务器,添加共享目录
[[email protected] ~]# vi /etc/exports
/mnt *(ro,sync)
/tftpboot *(ro,sync)
6、复制pxelinux.0、initrd.img、vmlinuz、isolinux/*.msg
mount /dev/cdrom /mnt
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
cp /mnt/p_w_picpaths/pxeboot/{initrd.img,vmlinuz} /tftpboot/
mkdir /tftpboot/pxelinux.cfg
touch /tftpboot/pxelinux.cfg/default
vi /tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
# append initrdinitrd=initrd.img
append initrdinitrd=initrd.img ks=nfs:192.168.11.5:/tftpboot/ks.cfg
label text
kernel vmlinuz
append initrdinitrd=initrd.img text 以文本模式安装
label ks
kernel vmlinuz
append ks initrdinitrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -
Pxe已经完成了,想用ks完成全自动安装的可以往下看。
[[email protected] tftpboot]# pwd
/tftpboot
[[email protected] tftpboot]# ls
initrd.img ks.cfg pxelinux.0 pxelinux.cfg vmlinuz
[[email protected] tftpboot]# vi ks.cfg
install
nfs --server=192.168.11.5 --dir=/mnt
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp --hostname localhost
rootpw --iscrypted $1$kE50pGl1$imqt12NcqN6KiJGToKNZo0
firewall --disable
authconfig --enableshadow --enablemd5
selinux --enforcing
timezone Asia/Shanghai
bootloader --location=mbr--driveorder=sda
# 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 --initlabel
part /boot --fstype ext3 --size=100
part swap --size=2048
part / --fstype ext3 --size=1 --grow
%packages
@core
@base
device-mapper-multipath
imake
*******************************************************************************
8、启动服务
service dhcpd start
service xinetd start
service portmap start
service nfslock start
service nfs start
9、被安装服务器上安装测试(选择pxe启动方式)
到这一步说明我们配置的dhcp服务器起作用了,我们直接回撤,系统开始查找系统文件自动安装
转载于:https://blog.51cto.com/b0undless/1243253