一、测试环境
操作系统:RHEL6.3_X64
vmware下两台虚拟机
二、测试过程
1、DHCP服务器的搭建
[root@rhel6 ~]# yum �Cy install dhcp
[root@rhel6 ~]# rpm -ql dhcp
/etc/dhcp
/etc/dhcp/dhcpd.conf //配置文件,修改前要做好备份工作
/etc/dhcp/dhcpd6.conf
/etc/openldap/schema/dhcp.schema
/etc/portreserve/dhcpd
/etc/rc.d/init.d/dhcpd
/etc/rc.d/init.d/dhcpd6
/etc/rc.d/init.d/dhcrelay
/etc/sysconfig/dhcpd
/etc/sysconfig/dhcpd6
/etc/sysconfig/dhcrelay
/usr/bin/omshell
/usr/sbin/dhcpd
/usr/sbin/dhcrelay
/usr/share/doc/dhcp-4.1.1
/usr/share/doc/dhcp-4.1.1/3.0b1-lease-convert
/usr/share/doc/dhcp-4.1.1/IANA-arp-parameters
/usr/share/doc/dhcp-4.1.1/README.ldap
/usr/share/doc/dhcp-4.1.1/api+protocol
/usr/share/doc/dhcp-4.1.1/dhclient-tz-exithook.sh
/usr/share/doc/dhcp-4.1.1/dhcpd-conf-to-ldap
/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample //配置例子,一般我们参考它来进行配置
/usr/share/doc/dhcp-4.1.1/dhcpd6.conf.sample
/usr/share/doc/dhcp-4.1.1/draft-ietf-dhc-ldap-schema-01.txt
/usr/share/doc/dhcp-4.1.1/ms2isc
/usr/share/doc/dhcp-4.1.1/ms2isc/Registry.perlmodule
/usr/share/doc/dhcp-4.1.1/ms2isc/ms2isc.pl
/usr/share/doc/dhcp-4.1.1/ms2isc/readme.txt
/usr/share/doc/dhcp-4.1.1/sethostname.sh
/usr/share/doc/dhcp-4.1.1/solaris.init
/usr/share/man/man1/omshell.1.gz
/usr/share/man/man5/dhcpd.conf.5.gz
/usr/share/man/man5/dhcpd.leases.5.gz
/usr/share/man/man8/dhcpd.8.gz
/usr/share/man/man8/dhcrelay.8.gz
/var/lib/dhcpd
/var/lib/dhcpd/dhcpd.leases
/var/lib/dhcpd/dhcpd6.leases
[root@rhel6 ~]# vim /etc/dhcp/dhcpd.conf
简单的配置文件如下:
subnet 10.0.0.0 netmask 255.255.255.0 {
range dynamic-bootp 10.0.0.188 10.0.0.222; //指定dhcp范围
option routers 10.0.0.200;
next-server 10.0.0.100;
filename="pxelinux.0"; //也可以写在全局变量里面
}
2、FTP服务器的配置
[root@rhel6 ~]# yum -y install vsftpd
[root@rhel6 ~]# vim /etc/vsftpd/vsftpd.conf
anonymous_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
[root@rhel6 ~]# /etc/init.d/vsftpd restart
[root@rhel6 ~]# chmod 777 /var/ftp/pub
然后将光盘中的内容全部拷贝到/var/ftp/pub目录下
3、TFTP服务器
[root@rhel6 ~]# yum -y install tftp-server
[root@rhel6 ~]# 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 //启用tftp服务
per_source = 11
cps = 100 2
flags = IPv4
}
[root@rhel6 ~]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
4、配置PXE的支持
[root@rhel6 ftp]# mkdir -p /tftpboot/pxelinux.cfg
[root@rhel6 ftp]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/
[root@rhel6 ftp]# cp /media/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
[root@rhel6 ftp]# cp /media/images/pxeboot/initrd.img /tftpboot/
[root@rhel6 ftp]# cp /media/images/pxeboot/vmlinuz /tftpboot/
[root@rhel6 ftp]# chmod 644 /tftpboot/pxelinux.cfg/default
[root@rhel6 ~]# vim /tftpboot/pxelinux.cfg/default
修改下列行为:
append initrd=initrd.img ks=ftp://10.0.0.100/ks.cfg
5、Kickstart配置文件的设置
用yum工具自动安装Kickstart,同时配置system-config-kickstart。
a) 首先我们需要安装Kickstart这个工具包,在CentOS最小化安装系统时,此软件包并没有默认安装,yum安装命令如下所示:
[root@rhel6 ~]# yum �Cy install system-config-kickstart
b) 在gnome环境下配置Kickstart,命令如下所示:
[root@rhel6 ~]# system-config-kickstart
###############下面的配置文件是重点###################
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# System bootloader configuration
key --skip
# Install OS instead of upgrade
install
# Use network installation
url --url="ftp://10.0.0.100/pub"
# Root password
rootpw --iscrypted $1$FJgYYvFn$V3FLAATh6MiLnmtTrOlxp0
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# System timezone
timezone Asia/Shanghai
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
reboot
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr //这一项非常重要,不然系统会让用户手动选择是否清除所有数据,这就需要人为干预了
# Partition clearing information
clearpart --all
# Disk partitioning information
part /boot --fstype="ext4" --size=200
part /tmp --fstype="ext4" --size=2048
part swap --fstype="swap" --size=2048
part / --fstype="ext4" --size=10240
%packages
@additional-devel
@base
@basic-desktop
@chinese-support
@console-internet
@debugging
@desktop-platform-devel
@development
@dial-up
@directory-client
@eclipse
@fonts
@hardware-monitoring
@infiniband
@input-methods
@internet-browser
@java-platform
@large-systems
@legacy-unix
@mainframe-access
@network-file-system-client
@network-tools
@performance
@perl-runtime
@print-client
@ruby-runtime
@scientific
@security-tools
@server-platform-devel
@smart-card
@storage-client-fcoe
@storage-client-iscsi
@storage-client-multipath
@x11
ElectricFence
NetworkManager-openswan
PyQt4-devel
SDL-devel
aide
amtu
ant
arptables_jf
arpwatch
atlas
authd
babel
bitmap-fixed-fonts
bitmap-lucida-typewriter-fonts
bzr
cachefilesd
certmonger
chrpath
cjkuni-fonts-ghostscript
cjkuni-fonts-ghostscript
cmake
compat-dapl
compat-gcc-34
compat-gcc-34-c++
compat-gcc-34-g77
compat-openmpi
compat-openmpi-psm
cups-devel
cups-lpd
dejagnu
desktop-file-utils
dropwatch
dump
e2fsprogs-devel
ebtables
eclipse-mylyn-cdt
eclipse-mylyn-pde
eclipse-mylyn-trac
eclipse-mylyn-webtasks
eclipse-mylyn-wikitext
eclipse-pde
eclipse-subclipse-graph
edac-utils
edac-utils
efax
expat-devel
expect
fetchmail
fftw
fftw-devel
fftw-static
finger
finger-server
flightrecorder
freeglut-devel
ftp
fuse-devel
gcc-gnat
gcc-java
gcc-objc
gcc-objc++
gdb-gdbserver
glade3
glibc-utils
gmp-devel
gnome-common
gnome-devel-docs
gnutls-devel
gsl
gsl-devel
gsl-static
gstreamer-plugins-base-devel
gtk2-devel-docs
hesinfo
hmaccalc
hplip
hplip-gui
httpd-devel
hunspell-devel
i2c-tools
icedtea-web
imake
infiniband-diags
ipset
iptables-devel
iptraf
iptstate
irssi
isdn4k-utils
jpackage-utils
junit
jwhois
kdebase-devel
kdebase-workspace-devel
kdegraphics-devel
kdelibs-apidocs
kdelibs-devel
kdemultimedia-devel
kdenetwork-devel
kdepim-devel
kdepimlibs-devel
kdesdk
kdesdk-devel
kdewebdev
krb5-appl-clients
krb5-appl-servers
krb5-pkinit-openssl
krb5-workstation
ksh
lapack
ldapjdk
lftp
libXau-devel
libXaw-devel
libXinerama-devel
libXmu-devel
libXpm-devel
libXrandr-devel
libaio-devel
libblkid-devel
libbonobo-devel
libcap-devel
libdrm-devel
libgcrypt-devel
libglade2-devel
libgnomeui-devel
libgudev1-devel
libhugetlbfs-devel
libibcommon
libibverbs-devel
libnl-devel
libstdc++-docs
libtiff-devel
libtopology-devel
libudev-devel
libusb-devel
libuuid-devel
libxslt-devel
lksctp-tools
lm_sensors
lslk
memtest86+
mercurial
mipv6-daemon
mksh
mod_dav_svn
mpich2
mpitests-mvapich
mpitests-mvapich2
mpitests-openmpi
mrtg
mstflint
mutt
mvapich
mvapich-psm-devel
mvapich-psm-static
mvapich2
mvapich2-psm-devel
nasm
ncompress
net-snmp-devel
netlabel_tools
nmap
nscd
nss-pam-ldapd
numactl-devel
numpy
opencryptoki
openldap-clients
openmotif-devel
openmpi
openmpi-devel
openscap
openscap-utils
opensm
oprofile-jit
pam_krb5
pam_ldap
papi
papi-devel
pcre-devel
perftest
perl-DBD-SQLite
perl-Date-Calc
perl-Date-Manip
perl-Frontier-RPC
perl-LDAP
perl-Mozilla-LDAP
perl-Test-Pod
perl-Test-Pod-Coverage
perl-suidperl
perltidy
popt-devel
pptp
python-docs
qperf
qt-doc
rp-pppoe
rpmdevtools
rpmlint
rsh
rsh-server
ruby-irb
rusers
rusers-server
rwho
sabayon-apply
samba-winbind
sane-backends-devel
sdparm
sg3_utils
srptools
startup-notification-devel
stunnel
systemtap-client
systemtap-initscript
systemtap-sdt-devel
systemtap-server
talk
talk-server
tcl-devel
tcp_wrappers
tcp_wrappers-devel
telnet
telnet-server
tftp
tigervnc-server
tk-devel
tpm-tools
trousers
tuned
tuned-utils
unique-devel
unixODBC-devel
wireshark
x3270-text
xguest
xorg-x11-proto-devel
xz-devel
%end
###############上面的配置文件是重点###################
下面是rhel5.8_x64的一个ks.cfg文件
--
#platform=x86, AMD64, or Intel EM64T
#System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
key --skip
bootloader --location=mbr
# Partition clearing information
clearpart --none
# Use graphical install
graphical
# 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 network installation
url --url=http://192.168.11.29/
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
reboot
#Root password
rootpw --iscrypted $1$biw2UUzu$/ZrtUhG9gGGGJn6edgUIQ1
# SELinux configuration
selinux --disabled
# System timezone
timezone --isUtc Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=8 --resolution=640x480
# Disk partitioning information
bootloader --location=mbr --driveorder=sda
clearpart --all --initlabel
part / --bytes-per-inode=4096 --fstype="ext3" --size=5120
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=128
part swap --bytes-per-inode=4096 --fstype="swap" --size=500
part /data --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%packages
@base
@development-libs
@development-tools
--
三、注意事项
a、--grow --size=1参数来将其余的剩余空间全部分配给/data分区;
b、key --skip如果是红帽系统,此选项可以跳过输入序列号过程;如果是CentOS 5.x系列,则可以不保留此项内容;
c、reboot 此选项必须存在,也必须文中设定位置,不然kickstart显示一条消息,并等待用户按任意键后才重新引导。
这里只测试了最基本的无人职守功能,还有很多地方需要进一步进行测试与完善