七、创建 ks.cfg 脚本
复制 /root/anaconda-ks.cfg /var/www/html/ks.cfg, 然后根据实际情况编辑。注意不要在此文件中包含中文字符。
# url --url=http://192.168.100.254/mnt/ #这个选项告诉安装程序:到服务器192.168.100.254 的HTTP根目录下的mnt 文件夹下寻找安装介质
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url=http://192.168.100.254/mnt/
# Root password
rootpw --iscrypted $6$060kt9rryFXbrlgx$WWWNQYLnpz0Es8dTlouy3LXqjTdHIRToojidbpYoZrd2ETOJ.JsNbgnMylQVbFRThPZwSdRKJcrAml7LQDdR00
# System authorization information
auth --useshadow --enablemd5
# Use graphical install
text
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone --utc Asia/Shanghai
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
key --skip
bootloader --append="rhgb quiet" --location=mbr --driveorder=sda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part / --fstype="ext4" --size=8192
part swap --fstype="swap" --size=1024
part /data --fstype="ext4" --size=2048
%packages
@core
%end
说明:key --skip 如果是红帽系统,此选项可以跳过输入序列号过程;如果是CentOS 系列,则可以不保留此项内容;
reboot 此选项必须存在,也必须文中设定位置,不然kickstart显示一条消息,并等待用户按任意键后才重新引导;
clearpart --all --initlabel 此条命令必须添加,不然系统会让用户手动选择是否清除所有数据,这就需要人为干预了,从而导致自动化过程失败;
默认安装完成后,root用户密码为:123456;
硬盘至少需要12G;
八、安装测试
自动化安装系统配置完毕,下面启动一台新的机器进行测试,创建虚拟机的过程就不讲了,网络连接模式 VMnet3。
启动虚拟机,快速按F2,修改BIOS, 选择从网卡启动,DHCP 服务器正在给客户机分配IP地址。




安装完成后,重启。自此, PXE+Kickstart 无人值守安装操作系统环境搭建完毕。
更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-04/115807.htm
