测试环境:Redhat 5.4 关闭iptables 和Selinux 

所需服务:Dhcp Vsftp Tftp Xinted

2.开始安装:

(1)安装所需服务

 
  
  1. DHCP:  
  2. [root@station5 ~]# yum -y install dhcp.i*  
  3. [root@station5 ~]# chkconfig dhcpd on 
  4.  
  5. TFTP:  
  6. [root@station5 ~]# yum -y install tftp.i* 
  7.  
  8. VSFTPD:  
  9. [root@station5 ~]# yum -y install vsftpd 
  10.  
  11. kickstart:  
  12. [root@station5 ~]# yum -y install system-config-kickstart 

(2)安装配置DHCP服务

修改以下内容:

(3)将TFTP服务状态设置为可运行 
 

 
  
  1. [root@station5 ~]# vim /etc/xinetd.d/tftp  
  2. 14         disable                 = no        #修改第14行把原来的yes修改成no 
  3.  
  4. [root@station5 ~]# /etc/init.d/xinetd restart      

(4)复制Linux启动、内核文件及启动镜像文件:

 
  
  1. [root@station5 ~]# mount /dev/hdc /mnt    #挂载光盘到/mnt目录下  
  2. [root@station5 ~]# cp /mnt/isolinux/initrd.img /tftpboot/  
  3. [root@station5 ~]# cp /mnt/isolinux/vmlinuz /tftpboot/  
  4. [root@station5 ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/ 

(5)将RHEL光盘所有内容复制到/var/ftp/pub目录下

 
  
  1. [root@station5 ~]# cp -r * /var/ftp/pub/ 

(6)kickstart配置文件的生成: 
通过system-config-kickstart 生成无人值守文件,再将生成的ks.cfg无人值守文件保存到/var/ftp下。

基本配置: 

安装方法(这是是通过FTP安装的) 
p_w_picpath

分区信息:这里我选的是:清除主引导记录和清除现有分区 
接下来是新建分区信息,可根据实际情况配置: 
p_w_picpath

网络配置:选择 Add Network Device ---OK  使用DHCP网络类型:

p_w_picpath

其他的按照自己的装机需求设置

接下来单击菜单:File--Save File 将ks.cfg保存到/var/ftp目录下面 
 p_w_picpath

配置新生成的ks.cfg文件,配置安装的软件包 
可以从当前系统安装时自动生成的安装信息/root/anaconda-ks.cfg将软件包信息 复制到ks.cfg文件里 
[root@station5 ~]# cat anaconda-ks.cfg 
%packages 
@admin-tools 
@base 
@chinese-support 
@core 
@dialup 
@editors 
@gnome-desktop 
。。。。以下省略。。。

%pachages 后的部分记录系统安装时的软件包的安装情况,复制下来全部复制到ks.cfg文件后面

 
  
  1. [root@station5 ftp]# vim ks.cfg  
  2. #platform=x86, AMD64, or Intel EM64T  
  3. # System authorization information  
  4. auth  --useshadow  --enablemd5  
  5. # System bootloader configuration  
  6. bootloader --location=mbr  
  7. # Clear the Master Boot Record  
  8. zerombr  
  9. # Partition clearing information  
  10. clearpart --all --initlabel  
  11. # Use graphical install  
  12. graphical  
  13. # Firewall configuration  
  14. firewall --enabled    
  15. # Run the Setup Agent on first boot  
  16. firstboot --disable  
  17. key --skip                    #顺便增加这个,跳过序列号  
  18. # System keyboard  
  19. keyboard us  
  20. # System language  
  21. lang en_US  
  22. # Installation logging level  
  23. logging --level=info  
  24. # Use network installation  
  25. url --url=ftp://192.168.0.5/pub  
  26. # Network information  
  27. network --bootproto=dhcp --device=eth0 --onboot=on  
  28. # Reboot after installation  
  29. reboot  
  30. #Root password  
  31. rootpw --iscrypted $1$73hBcd2n$DoNPPPAFrOKrj10Cr.eRX0 
  32.  
  33. # SELinux configuration  
  34. selinux --enforcing  
  35. # System timezone  
  36. timezone  Asia/Shanghai  
  37. # Install OS instead of upgrade  
  38. install  
  39. # X Window System configuration information  
  40. xconfig  --defaultdesktop=GNOME --depth=32 --resolution=800x600 --startxonboot  
  41. # Disk partitioning information  
  42. part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100  
  43. part / --bytes-per-inode=4096 --fstype="ext3" --size=4096  
  44. part /home --bytes-per-inode=4096 --fstype="ext3" --size=2000  
  45. part swap --bytes-per-inode=4096 --fstype="swap" --size=512  
  46. part /usr --bytes-per-inode=4096 --fstype="ext3" --size=3000 
  47.  
  48. %packages  
  49. @dialup  
  50. @base  
  51. @gnome-desktop  
  52. @core  
  53. @admin-tools  
  54. @chinese-support  
  55. @printing  
  56. @base-x  
  57. @graphical-internet  
  58. @java  
  59. @text-internet  
  60. @system-tools  
  61. @legacy-software-support  
  62. @editors  
  63. kexec-tools  
  64. fipscheck  
  65. device-mapper-multipath  
  66. sgpio  
  67. emacs  
  68. festival  
  69. audit  
  70. xorg-x11-utils  
  71. xorg-x11-server-Xnest 

将复制的%pachages 部分信息放到最后

(7)复制配置文件模块

 
  
  1. [root@station5 ~]# cd /tftpboot/  
  2. [root@station5 tftpboot]# mkdir pxelinux.cfg  
  3. [root@station5 tftpboot]# cp /mnt/isolinux/isolinux.cfg pxelinux.cfg/default  
  4. [root@station5 tftpboot]# chmod u+w pxelinux.cfg/default          
  5. #由于defaults文件默认是只读的,所以增加写的权限 

(8)修改default文件,内容如下: 
 

 
  
  1. default linux        #用户不选择使用内容时默认使用哪 个标签  
  2. prompt 1         
  3. timeout 600        #等待用户选择时间 
  4.  
  5. label linux        #定义的标签,可以建立这个label指向不同的内核文件  
  6. kernel vmlinuz    #内核文件  
  7. append ks=ftp://192.168.0.5/ks.cfg initrdinitrd=initrd.img  
  8. #客户端下载启动文件用无人值守安装文件的地方,也就是上面配置的ks.cfg文件。 

(9)重启dhcpd、xinetd、vsftpd 服务

 
  
  1. [root@station5 ~]# /etc/init.d/dhcpd restart  
  2. [root@station5 ~]# /etc/init.d/xinetd restart  
  3. [root@station5 ~]# /etc/init.d/vsftpd restart 

(10)客户端安装(前提当然是支持PXE引导) 
开机后选择从网络引导,就可以看到以下信息,输入:linux 回车 
 p_w_picpath 

p_w_picpath

转载自http://liyaoyi.blog.51cto.com/442933/810858