包准备: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 1timeout 600display boot.msgmenu background splash.jpgmenu title Welcome to Red Hat Enterprise Linux 6.4!menu color border 0 #ffffffff #00000000menu color sel 7 #ffffffff #ff000000menu color title 0 #ffffffff #00000000menu color tabmsg 0 #ffffffff #00000000menu color unsel 0 #ffffffff #00000000menu color hotsel 0 #ff000000 #ffffffffmenu color hotkey 7 #ffffffff #ff000000menu color scrollbar 0 #ffffffff #00000000label locallocalboot 0label linuxkernel vmlinuzappend 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 configurationfirewall --enabled --ssh# Install OS instead of upgradeinstall# Use NFS installation medianfs --server=192.168.46.98 --dir=/mnt# Root password#rootpw --iscrypted $1$kC9vxUwe$l.U7ZGNt9Yjcvt2YHy3J50# System authorization informationauth --useshadow --passalgo=sha512# Use text mode installtext# System keyboardkeyboard us# System languagelang en_US# SELinux configurationselinux --disabled# Do not configure the X Window Systemskipx# Installation logging levellogging --level=info# Reboot after installationreboot# System timezonetimezone --isUtc Asia/Shanghai# Network informationnetwork --bootproto=dhcp --device=eth0 --onboot=on# System bootloader configurationbootloader --location=mbr# Clear the Master Boot Recordzerombr# Partition clearing informationclearpart --all --initlabel# Disk partitioning informationpart /boot --asprimary --fstype="ext4" --size=128part swap --asprimary --fstype="swap" --size=2048part / --asprimary --fstype="ext4" --size=8000part /data --asprimary --fstype="ext4" --size=1%packages@base@chinese-support%end
开启服务
tftp包含于xinetd中,所以要进入配置文件中开启
# vi /etc/xinetd.d/tftp
service tftp{socket_type = dgramprotocol = udpwait = yesuser = rootserver = /usr/sbin/in.tftpdserver_args = -s /var/lib/tftpbootdisable = noper_source = 11cps = 100 2flags = IPv4}
开启
# service dhcpd start
# service xinetd start
# service httpd start
# service nfs start