包准备:xinetd,tftp-server,dhcp,httpd,system-config-kickstart,syslinux,nfs
试验环境:
本机地址:192.168.46.98
本地网关:192.168.46.254
配置DHCP服务器:
Sample:
--------------------------------------------------------------------------------
subnet 192.168.46.0 netmask 255.255.255.0 {
range 192.168.46.100 192.168.46.105;
option routers 192.168.46.254;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.46.98; /*指向tftp服务器*/
filename="pxelinux.0"; } /*ftp根目录的相对路径*/
--------------------------------------------------------------------------------
参考文件:
ddns-update-style interim; /*dhcp支持的dns动态更新方式*/
ignore client-updates; /*忽略客户端DNS动态更新*/
authoritative; /*授权*/
allow booting; /*支持PXE启动*/
allow bootp; /*支持boottp*/
subnet 192.168.129.0 netmask 255.255.255.0 { /*作用域*/
range 192.168.129.30 192.168.129.78; /*ip地址段范围*/
option routers 192.168.129.1; /*网关*/
option subnet-mask 255.255.255.0; /*子网掩码*/
option domain-name-servers 203.103.24.68; /*DNS服务器的地址*/
default-lease-time 21600; /*租期,秒数*/
max-lease-time 43200; /*最大租期,秒数*/
next-server 192.168.129.22; /*TFTPServer的IP*/
filename "/pxelinux.0"; /*Bootstrap文件*/
挂载系统光盘到 /mnt
配置TFTP根目录(tftpboot)
# cp /mnt/images/pxeboot/vmlinuz /mnt/images/pxeboot/initrd.img /var/lib/tftpboot
# cp /mnt/isolinux/boot.msg /mnt/isolinux/splash.jpg /var/lib/tftpboot
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
# mkdir /var/lib/tftpboot/pxelinux.cfg
# cp -p /media/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
TFTP下default配置
# vi /var/lib/tftpboot/pxelinux.cfg/default
--------------------------------------------------------------------------------
default linux
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to Red Hat Enterprise Linux 6.4!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label local
localboot 0
label linux
kernel vmlinuz
append initrd=initrd.img devfs=nomount ks=http://192.168.46.98/ks.cfg
--------------------------------------------------------------------------------
NFS共享目录配置
# vi /etc/exports
--------------------------------------------------------------------------------
/mnt 192.168.46.0/255.255.255.0(ro,sync)
--------------------------------------------------------------------------------
配置Kickstart文件ks.cfg
# cd /var/www/html
# vi ks.cfg
--------------------------------------------------------------------------------
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --enabled --ssh
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=192.168.46.98 --dir=/mnt
# Root password
#rootpw --iscrypted $1$kC9vxUwe$l.U7ZGNt9Yjcvt2YHy3J50
# System authorization information
auth --useshadow --passalgo=sha512
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone --isUtc Asia/Shanghai
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --asprimary --fstype="ext4" --size=128
part swap --asprimary --fstype="swap" --size=2048
part / --asprimary --fstype="ext4" --size=8000
part /data --asprimary --fstype="ext4" --size=1
%packages
@base
@chinese-support
%end
--------------------------------------------------------------------------------
KS文件参考:
开启服务
tftp包含于xinetd中,所以要进入配置文件中开启
# vi /etc/xinetd.d/tftp