前提条件:
将Centos6.2 二章光盘挂载拷贝到/var/ftp/pub/centos/6.2/下
[root@server Packages]# du -sh /var/ftp/pub/centos/6.2/
5.4G /var/ftp/pub/centos/6.2/
一、安装TFTP
[root@server ~]# yum -y install tftp-server
[root@server ~]# vim /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
per_source = 11
cps = 100 2
flags = IPv4
}
[root@server ~]# service xinetd restart
[root@server ~]# chkconfig xinetd on
[root@server ~]# netstat -ln | grep :69
udp 0 0 0.0.0.0:69 0.0.0.0:*
[root@server ~]# mkdir /tftpboot/centos6.2 -p
[root@server ~]# cp /var/ftp/pub/centos/6.2/images/pxeboot/* /tftpboot/centos6.2/
[root@server ~]# cp /var/ftp/pub/centos/6.2/isolinux/* /tftpboot/centos6.2/
[root@server ~]# yum -y install syslinux
[root@server ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/
[root@server ~]# mkdir /tftpboot/pxelinux.cfg
[root@server ~]# cp /tftpboot/centos6.2/isolinux.cfg /tftpboot/pxelinux.cfg/default
[root@server ~]# vim /tftpboot/pxelinux.cfg/default
#default vesamenu.c32
default linux
……
label linux
menu label ^Install or upgrade an existing system
menu default
kernel centos6.2/vmlinuz
append initrd=centos6.2/initrd.img ks=http://192.168.10.254/ks_centos6.cfg
[root@server ~]# chmod 755 /tftpboot/pxelinux.cfg/default
二、配置DHCP
[root@server ~]# yum -y install dhcp
[root@server ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
[root@server ~]# vim /etc/dhcp/dhcpd.conf
option domain-name "maidi.com";
option domain-name-servers 192.168.10.254,202.106.0.20;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.10.254;
filename "pxelinux.0";
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.10 192.168.10.20;
option routers 192.168.10.254;
}
[root@server ~]# service dhcpd restart
[root@server ~]# chkconfig dhcpd on
三、配置NFS/HTTP
[root@server ~]# yum -y install httpd
[root@server ~]# mv ks_centos6.cfg /var/www/html/
[root@server ~]# yum -y install nfs-utils
[root@server ~]# cat /etc/exports
/var/ftp/pub/centos/6.2/ *(ro)
[root@server ~]# /etc/init.d/rpcbind restart
[root@server ~]# /etc/init.d/nfs restart
[root@server ~]# /etc/init.d/httpd restart
四、配置Kickstart
[root@server ~]# yum -y install system-config-kickstart
附:ks_centos6.cfg
[root@server ~]# cat /var/www/html/ks_centos6.cfg
firewall --disabled
install
nfs --server=192.168.10.254 --dir=/var/ftp/pub/centos/6.2/
rootpw --iscrypted $1$jh50MQCb$XcqqaAtp9B/MXmV1buQId0
auth --useshadow --passalgo=sha512
text
firstboot --disable
keyboard us
lang en_US
selinux --disabled
logging --level=info
reboot
timezone --isUtc Asia/Shanghai
network --bootproto=dhcp --device=eth0 --onboot=on
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part /data --fstype="ext4" --size=5000
part swap --fstype="swap" --size=2048
part /boot --fstype="ext4" --size=200
part / --fstype="ext4" --size=10000
%packages
@base
%end
Chmod 755 /var/www/html/ks_centos6.cfg