CentOS 6.x kickstart 配置示例
启动一个HTTP服务,把操作系统镜像解压后放到HTTP服务的数据目录下:/var/www/html/centos65/
并把ks.cfg放到/var/www/html/ks.cfg
####/var/www/html/ks.cfg####
#文本模式安装
text
# 键盘
keyboard us
语言
lang en_US
#langsupport --default en_US zh_CN
#网口
network --device eth0 --bootproto dhcp
#network --device eth1 --bootproto dhcp
# OS ISO挂载后的文件会复制到这里
url --url http://192.168.1.2/data/
# 时区
timezone Asia/Shanghai
# 用户密码
rootpw YOUR_PASSWORD
#禁用防火墙
firewall --disabled
#认证方式
authconfig --enableshadow --enablemd5
#禁用selinux
selinux --disabled
#跳过安装过程中的图形窗口
skipx
# 安装bootloader
bootloader
#重启OS
reboot
# 清空MBR
zerombr yes
# 删除磁盘所有分区
clearpart --all
# 分区。大小单位Mb;--grow表示使用剩余所有磁盘空间,显然只能放最后。
part /boot --fstype ext4 --size=500
part swap --size=2048
part / --fstype ext4 --size=2048
part /opt --fstype ext4 --size=200 --grow
#安装软件包。硬件相关的监控和时间同步服务必不可少。@base 表示安装base包组。
%packages
lm_sensors
ntp
@base
%pre
%post
####/tftpboot/pxelinux.cfg/default####
default vesamenu.c32
prompt 0
timeout 300
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.5!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label linux
menu label ^Install or upgrade an existing system
kernel vmlinuz
append initrd=initrd.img text ks=http://192.168.56.102/ks.cfg ksdevice=eth0
label local
menu lable ^Boot from local disk
menu default
localboot 0
####/tftpboot/boot.msg####
可以从相关目录中拷贝一个,也可以自定义
####/etc/dhcp/dhcpd.conf####
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
#
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.56.0 netmask 255.255.255.0 {
option routers 192.168.56.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.56.1;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.56.100 192.168.56.120;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.56.102;
filename "pxelinux.0";
}