虚拟机环境centOS6.2 (ip:10.0.0.8)

首先安装必要工具
yum -y install httpd* tftp-server system-config-kickstart dhcp syslinux 
mount /dev/cdrom /mnt
cp -rf /mnt/* /var/www/html
配置tftp server 

  1. [root@shanker html]# cat /etc/xinetd.d/tftp 
  2. # default: off 
  3. # description: The tftp server serves files using the trivial file transfer \ 
  4. #       protocol.  The tftp protocol is often used to boot diskless \ 
  5. #       workstations, download configuration files to network-aware printers, \ 
  6. #       and to start the installation process for some operating systems. 
  7. service tftp 
  8.         socket_type             = dgram 
  9.         protocol                = udp 
  10.         wait                    = yes 
  11.         user                    = root 
  12.         server                  = /usr/sbin/in.tftpd 
  13.         server_args             = -s /tftpboot 
  14.         disable                 = no 
  15.         per_source              = 11 
  16.         cps                     = 100 2 
  17.         flags                   = IPv4 
  18. [root@shanker html]# 

service xinetd restart
建立tftpboot文件夹,并把配置文件复制过去 

  1. mkdir /tftpboot 
  2.  
  3. cp /usr/share/syslinux/pxelinux.0 /tftpboot 
  4.  
  5. cd /var/www/html/p_w_picpath/pxeboot/  
  6.  
  7. cp initrd.img vmlinux /tftpboot 
  8.  
  9. cp /var/www/html/isolinux/*.msg /tftpboot 
  10.  
  11. mkdir /tftpboot/pxelinux.cfg 
  12.  
  13. cp /var/www/html/isolinux/isolinux.cfg  /tftpboot/pxelinux.cfg/default 

下面配置dchp服务器

  1. [root@shanker html]# cat /etc/dhcp/dhcpd.conf 
  2. option domain-name-servers 10.0.0.1; 
  3. max-lease-time 7200; 
  4. authoritative; 
  5.  
  6.  subnet 10.0.0.0 netmask 255.255.255.0 { 
  7.  range 10.0.0.1 10.0.0.253; 
  8.  next-server 10.0.0.8; 
  9.  filename "pxelinux.0"; 
  10.  } 
  11. [root@shanker html]# service dhcpd start

然后是system-config-kickstart图形界面下配置kickstart 

vmware+CentOS6.2+PXE+Apache+DHCP+tftp+kickstart实验_pxe

 

vmware+CentOS6.2+PXE+Apache+DHCP+tftp+kickstart实验_kickstart_02

 

vmware+CentOS6.2+PXE+Apache+DHCP+tftp+kickstart实验_休闲_03

 

vmware+CentOS6.2+PXE+Apache+DHCP+tftp+kickstart实验_kickstart_04

 

vmware+CentOS6.2+PXE+Apache+DHCP+tftp+kickstart实验_休闲_05

最后点击file将文件另存到/var/www/html下,然后修改/tftpboot/pxelinux.cfg/default

  1. [root@shanker html]# cat /tftpboot/pxelinux.cfg/default 
  2. default linux 
  3. prompt 1 
  4. timeout 6
  5.  
  6. display boot.msg 
  7.  
  8. menu background splash.jpg 
  9. menu title Welcome to CentOS 6.2! 
  10. menu color border 0 #ffffffff #00000000 
  11. menu color sel 7 #ffffffff #ff000000 
  12. menu color title 0 #ffffffff #00000000 
  13. menu color tabmsg 0 #ffffffff #00000000 
  14. menu color unsel 0 #ffffffff #00000000 
  15. menu color hotsel 0 #ff000000 #ffffffff 
  16. menu color hotkey 7 #ffffffff #ff000000 
  17. menu color scrollbar 0 #ffffffff #00000000 
  18.  
  19. label linux 
  20.   menu label ^Install or upgrade an existing system 
  21.   menu default 
  22.   kernel vmlinuz 
  23.   append ks=http://10.0.0.8/ks.cfg initrdinitrd=initrd.img 
  24. label vesa 
  25.   menu label Install system with ^basic video driver 
  26.   kernel vmlinuz 
  27.   append initrdinitrd=initrd.img xdriver=vesa nomodeset 
  28. label rescue 
  29.   menu label ^Rescue installed system 
  30.   kernel vmlinuz 
  31.   append initrdinitrd=initrd.img rescue 
  32. label local 
  33.   menu label Boot from ^local drive 
  34.   localboot 0xffff 

然后就可以添加新的虚拟机启动了。 

如图

vmware+CentOS6.2+PXE+Apache+DHCP+tftp+kickstart实验_centos6.2_06

 

vmware+CentOS6.2+PXE+Apache+DHCP+tftp+kickstart实验_pxe_07

 

vmware+CentOS6.2+PXE+Apache+DHCP+tftp+kickstart实验_pxe_08

done ~!

 

 

参考文章: http://xiaosu.blog.51cto.com/2914416/667890

《构建高可用服务器》