一、测试环境操作系统:RHEL6.3_X64
vmware下两台虚拟机
二、测试过程
1、DHCP服务器的搭建[root@rhel6 ~]# yum –y 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=YESanon_upload_enable=YESanon_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/tftpservice 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 restartStopping 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/p_w_picpaths/pxeboot/initrd.img /tftpboot/[root@rhel6 ftp]# cp /media/p_w_picpaths/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.cfg5、Kickstart配置文件的设置用yum工具自动安装Kickstart,同时配置system-config-kickstart。
a) 首先我们需要安装Kickstart这个工具包,在CentOS最小化安装系统时,此软件包并没有默认安装,yum安装命令如下所示:[root@rhel6 ~]# yum –y install system-config-kickstart
b) 在gnome环境下配置Kickstart,命令如下所示:[root@rhel6 ~]# system-config-kickstart ###############下面的配置文件是重点####################platform=x86, AMD64, or Intel EM64T#version=DEVEL# Firewall configurationfirewall --disabled# System bootloader configurationkey --skip# Install OS instead of upgradeinstall# Use network installationurl --url=""# Root passwordrootpw --iscrypted $1$FJgYYvFn$V3FLAATh6MiLnmtTrOlxp0# System authorization informationauth --useshadow --passalgo=sha512# Use graphical installgraphicalfirstboot --disable# System keyboardkeyboard us# System languagelang zh_CN# SELinux configurationselinux --disabled# Installation logging levellogging --level=info
# System timezonetimezone Asia/Shanghai# Network informationnetwork --bootproto=dhcp --device=eth0 --onboot=onreboot# System bootloader configurationbootloader --location=mbr# Clear the Master Boot Record zerombr //这一项非常重要,不然系统会让用户手动选择是否清除所有数据,这就需要人为干预了# Partition clearing informationclearpart --all # Disk partitioning informationpart /boot --fstype="ext4" --size=200part /tmp --fstype="ext4" --size=2048part swap --fstype="swap" --size=2048part / --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@x11ElectricFenceNetworkManager-openswanPyQt4-develSDL-develaideamtuantarptables_jfarpwatchatlasauthdbabelbitmap-fixed-fontsbitmap-lucida-typewriter-fontsbzrcachefilesdcertmongerchrpathcjkuni-fonts-ghostscriptcjkuni-fonts-ghostscriptcmakecompat-daplcompat-gcc-34compat-gcc-34-c++compat-gcc-34-g77compat-openmpicompat-openmpi-psmcups-develcups-lpddejagnudesktop-file-utilsdropwatchdumpe2fsprogs-develebtableseclipse-mylyn-cdteclipse-mylyn-pdeeclipse-mylyn-traceclipse-mylyn-webtaskseclipse-mylyn-wikitexteclipse-pdeeclipse-subclipse-graphedac-utilsedac-utilsefaxexpat-develexpectfetchmailfftwfftw-develfftw-staticfingerfinger-serverflightrecorderfreeglut-develftpfuse-develgcc-gnatgcc-javagcc-objcgcc-objc++gdb-gdbserverglade3glibc-utilsgmp-develgnome-commongnome-devel-docsgnutls-develgslgsl-develgsl-staticgstreamer-plugins-base-develgtk2-devel-docshesinfohmaccalchpliphplip-guihttpd-develhunspell-develi2c-toolsicedtea-webimakeinfiniband-diagsipsetiptables-develiptrafiptstateirssiisdn4k-utilsjpackage-utilsjunitjwhoiskdebase-develkdebase-workspace-develkdegraphics-develkdelibs-apidocskdelibs-develkdemultimedia-develkdenetwork-develkdepim-develkdepimlibs-develkdesdkkdesdk-develkdewebdevkrb5-appl-clientskrb5-appl-serverskrb5-pkinit-opensslkrb5-workstationkshlapackldapjdklftplibXau-devellibXaw-devellibXinerama-devellibXmu-devellibXpm-devellibXrandr-devellibaio-devellibblkid-devellibbonobo-devellibcap-devellibdrm-devellibgcrypt-devellibglade2-devellibgnomeui-devellibgudev1-devellibhugetlbfs-devellibibcommonlibibverbs-devellibnl-devellibstdc++-docslibtiff-devellibtopology-devellibudev-devellibusb-devellibuuid-devellibxslt-devellksctp-toolslm_sensorslslkmemtest86+mercurialmipv6-daemonmkshmod_dav_svnmpich2mpitests-mvapichmpitests-mvapich2mpitests-openmpimrtgmstflintmuttmvapichmvapich-psm-develmvapich-psm-staticmvapich2mvapich2-psm-develnasmncompressnet-snmp-develnetlabel_toolsnmapnscdnss-pam-ldapdnumactl-develnumpyopencryptokiopenldap-clientsopenmotif-developenmpiopenmpi-developenscapopenscap-utilsopensmoprofile-jitpam_krb5pam_ldappapipapi-develpcre-develperftestperl-DBD-SQLiteperl-Date-Calcperl-Date-Manipperl-Frontier-RPCperl-LDAPperl-Mozilla-LDAPperl-Test-Podperl-Test-Pod-Coverageperl-suidperlperltidypopt-develpptppython-docsqperfqt-docrp-pppoerpmdevtoolsrpmlintrshrsh-serverruby-irbrusersrusers-serverrwhosabayon-applysamba-winbindsane-backends-develsdparmsg3_utilssrptoolsstartup-notification-develstunnelsystemtap-clientsystemtap-initscriptsystemtap-sdt-develsystemtap-servertalktalk-servertcl-develtcp_wrapperstcp_wrappers-develtelnettelnet-servertftptigervnc-servertk-develtpm-toolstrouserstunedtuned-utilsunique-develunixODBC-develwiresharkx3270-textxguestxorg-x11-proto-develxz-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显示一条消息,并等待用户按任意键后才重新引导。
这里只测试了最基本的无人职守功能,还有很多地方需要进一步进行测试与完善