1.配置DHCP服务器
[root@simp /]# yum install dhcp
[root@simp /]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
[root@simp /]# vi /etc/dhcpd.conf
 
rhel5.3通过kickstart构建无人值守安装服务器_职场
[root@simp ~]# /etc/init.d/dhcpd start
[root@simp ~]# chkconfig --level 345 dhcpd on
dhcp的设置和平常一样,就是注意在添加两条记录,next-server 和filename,next-server的意思是tftp服务器IP,filename指的是tftf服务器中pxelinx.0这个文件的位置,这里是相对位置,他的主目录就是/tftp。
 
2.配置TFTP服务器
[root@simp /]# yum install tftp
[root@simp /]# yum install tftp-server
[root@simp /]# yum install xinetd
[root@simp /]# vi /etc/xinetd.d/tftp
将disable   = yes 改为 disable = no(tftp服务器之需要修改这里就可以了)
rhel5.3通过kickstart构建无人值守安装服务器_休闲_02
[root@simp /]# cp /usr/lib/syslinux/pxelinux.0  /tftpboot/
(如果pxelinux.0这个文件不存在则安装syslinux-3.11-4.i386.rpm)
[root@simp /]# mount /dev/cdrom /mnt/
[root@simp /]# cp /mnt/isolinux/* /tftpboot/
[root@simp /]# cd /tftpboot/
[root@simp tftpboot]# mkdir pxelinux.cfg
[root@simp tftpboot]# mv isolinux.cfg ./pxelinux.cfg/default
 
3.配置FTP服务器(HTTP.CD-ROM,NFS均可以)
[root@simp ~]# yum install vsftpd
[root@simp ~]# /etc/init.d/vsftpd start
[root@simp ~]# chkconfig --level 345 vsftpd on
[root@simp ~]# mkdir -p /var/ftp/iso/i386
[root@simp ~]# dd if=/dev/cdrom of=/var/ftp/iso/i386/rhel-5.3.iso
或者
[root@simp ~]# cp –avr /mnt/* /var/ftp/iso/i386
 
至此安装服务器已经可以用了,但还是需要我们手动去装,做完下面的步骤就可以真正实现无人值守了。
生成无人值守所需要的ks.cfg文件,生成方法可以通过修改/root/anaconda-ks.cfg来实现,或是在桌面下通过使用system-config-kickstart 来实现(需要安装pykickstart,system-config-kickstart软件包,个人推荐使用这个,简单强大)。
 
将生成的ks.cfg文件拷贝的/var/ftp/pub/下
 
[root@ks-serv ks]# cat /tftpboot/pxelinux.cfg/default
default
prompt 1
timeout 600
display pxelinux.cfg/list
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
#label 1 is auto install rhel-5.3-i386 operating system
label 1
  kernel ./vmlinuz-dir/vmlinuz-5.3-i386
  append ks=nfs:192.168.0.249:/var/ftp/ks/rhel-5.3-auto.cfg initrd=./initrd/initrd-5.3-i386.img
#label 2 is manual install rhel-5.3-i386 operating system
label 2
  kernel ./vmlinuz-dir/vmlinuz-5.3-i386
  append ks=nfs:192.168.0.249:/var/ftp/ks/rhel-5.3-manual.cfg initd=./initrd/initrd-5.3-i386.img
#label 3 is manual install fedora-11-64 operating system
label 3
  kernel ./vmlinuz-dir/vmlinuz-fedora-11-x86_64
  append ./initrd/initrd-fedora-11-x86_64.img
#label 4 is auto install fedora-11-32 operating system
label 4
  kernel ./vmlinuz-dir/vmlinuz-fedora-11-x86_64
  append ./initrd/initrd-fedora-11-x86_64.img
 
我的list文件
choose one id of the following linux distribution for your installation
Id      Name               Install type          Install location
1      rhel-5.3-32        auto   install           /var/ftp/linuxos/i386/rhel5.3/
2      rhel-5.3-32        manual install        /var/ftp/linuxos/i386/rhel5.3/
3      fedora-11-64    auto   install           /var/ftp/linuxos/x86_64/fedora11/
4      fedora-11-64    manual install        /var/ftp/linuxos/x86_64/fedora11/
 
 
 
我的KS文件
 
 

[root@ks-serv ks]# cat rhel-5.3-auto.cfg
#platform=x86, AMD64, »ò Intel EM64T
network --bootproto=dhcp  --device=eth0
# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
key --skip
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
graphical
#text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.0.249 --dir=/var/ftp/linuxos/i386/rhel5.3/
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
#network --bootproto=dhcp --device=eth1 --onboot=on
#Root password
rootpw --iscrypted $1$t7h0t0Kl$jKXN56yAhrDUn84XbWFZz.
# SELinux configuration
selinux --disabled
# System timezone
timezone  Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig  --defaultdesktop=GNOME --depth=24 --resolution=1024x768 --startxonboot
# Disk partitioning information
#part / --bytes-per-inode=4096 --fstype="ext3" --size=40000
#part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
#part swap --bytes-per-inode=4096 --fstype="swap" --size=2000
%packages
@development-libs
@gnome-software-development
@x-software-development
@chinese-support
@development-tools
@gnome-desktop
@base-x
@kde-desktop
@legacy-software-development
@kde-software-development
@legacy-software-support
@java-development
@editors
@ruby