(6)用yum工具自动安装Kickstart,同时配置system-config-kickstart。
a) 首先我们需要安装Kickstart这个工具包,在CentOS最小化安装系统时,此软件包并没有默认安装,yum安装命令如下所示:
yum –y install system-config-kickstart
b) 在gnome环境下配置Kickstart,命令如下所示:
system-config-Kickstart
运行上面的命令后可以对系统的一些基本配置进行设置,例如选择时区、设置root的密码等。
c) 接下来便要进行安装了,建议选择httpd安装,切记不要输入任何账号,而是采用匿名安装。
在安装过程中,根据引导选择安装选项,不需要做更改。
d) Kickstart会让我们选择需要批量安装的CentOS5.8分区信息,按照上一节所介绍的CentOS5.5 x86_64的安装方法,我们创建四个分区,即/、/boot、/data和swap分区。
e) 在进行网络配置时,我使用的静态分配地址(动态同样如此),这里跟前面进行光盘安装是一样的。
f) 设置显示配置时可以按照我们的习惯选择。
g) 关于软件包的选择,大家可以根据实际的工作需求来选择自己需要的软件包,由于服务器安装后用途都是不一样的,建议大家这里选择最小化安装。
h) 其他都选择默认设置,不需要修改。
i) 最后将生成的文件ks.cfg保存到/var/www/html下,此为自动化无人值守安装的重难点,此文件稍有配置不当的话就会需要人为干预了,如果大家遇到问题,建议参考我下面的ks.cfg配置文件。
(7)修改/tftpboot/pxelinux.cfg/default文件,指定读取ks.cfg的方法,即修改文件第一行内容,改动后文件第一行内容如下所示:
default text ks=http://192.168.11.29/ks.cfg
另外,也建议将timeout时间由原先的600改为1,timeout时间是引导时等待用户手动选择的时间,设为“1”可直接引导。
(8)/var/www/html/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