1,编辑光盘根目录下isolinux/isolinux.cfg文件加入要引导的选项
2,然后就是光盘根目录下ks.cfg文件的配置
3,boot:linux ks=cdrom:/ks.cfg 或 boot:ks 来引导
4,关于kickstart文件,可以利用system-config-kickstart工具生成,也可参照/root/anaconda-ks.cfg文件进行修改,
要注意的是如果是从光盘安装,kickstart的%post会运行于chroot模式,无法直接从光盘复制文件到目标系统,可在%post后添加--nochroot解决,详见下面链接
http://fedoraproject.org/wiki/Anaconda/Kickstart
#########################isolinux.cfg###########################
default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append initrd=initrd.img
label text
kernel vmlinuz
append initrd=initrd.img text
label j8
kernel vmlinuz
append initrd=initrd.img ks=cdrom:/ks.cfg
label local
localboot 1
label memtest86
kernel memtest
append -
#########################ks.cfg###########################
# Kickstart file automatically generated by anaconda.
install
cdrom
keyboard us
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 zh_CN.UTF-8
network --device eth0 --bootproto static --ip 192.168.1.119 --netmask 255.255.255.0 --gateway 192.168.1.254 --nameserver 202.96.209.133
text
key --skip
reboot
rootpw 123456
firewall --enabled --port=22:tcp --port=80:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda
# Partitioning
clearpart --linux --initlabel --drives=sda
part /boot --fstype ext3 --size=200 --ondisk=sda
part / --fstype ext3 --size=30000 --ondisk=sda
part swap --fstype swap --size=2048 --ondisk=sda
part pv.01 --size=0 --grow --ondisk=sda
volgroup vg_root pv.01
logvol /opt --fstype ext3 --name=LogVol00 --vgname=vg_root --size=1024 --grow
%packages
@ core
@ admin-tools
@ system-tools
@ text-internet
@ development-tools
gcc
e2fsprogs
grub
lvm2
net-snmp
sysstat
zlib
xinetd
lrzsz
%post
#set ulimit
echo "ulimit -SHn 65536" >> /etc/rc.local
cat >> /etc/security/limits.conf << EOF
* soft nofile 65536
* hard nofile 65536
EOF
# Remove some unneeded services
#--------------------------------------------------------------------------------
cat << EOF
+--------------------------------------------------------------+
| === Welcome to Tunoff services === |
+--------------------------------------------------------------+
EOF
#---------------------------------------------------------------------------------
for i in `ls /etc/rc3.d/S*`
do
CURSRV=`echo $i|cut -c 15-`
echo $CURSRV
case $CURSRV in
crond | irqbalance | microcode_ctl | network | random | sshd | syslog | lvm2-monitor | smartd | rawdevices | haldaemon | messagebus | smartd )
echo "Base services, Skip!"
;;
*)
echo "change $CURSRV to off"
chkconfig --level 235 $CURSRV off
service $CURSRV stop
;;
esac
done
echo 'ttyS0' >> /etc/securetty
# disable ipv6
echo "alias net-pf-10 off" >> /etc/modprobe.conf
perl -pi -e 's/NETWORKING_IPV6=yes/NETWORKING_IPV6=no/g' /etc/sysconfig/network
# motd text
echo 'This is a private network device. Activity is monitored. This system cannot be used or accessed without authorization.' > /etc/motd
# ssh config
echo 'ListenAddress 0.0.0.0
SyslogFacility AUTHPRIV
PasswordAuthentication yes
ChallengeResponseAuthentication no
UsePAM yes
AllowTcpForwarding no
UseDNS no
Subsystem sftp /usr/libexec/openssh/sftp-server
#AllowUsers *@192.*.*.*' > /etc/ssh/sshd_config
#set sysctl
cat >> /etc/sysctl.conf << EOF
net.ipv4.ip_local_port_range = 1024 65536
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.ipv4.tcp_fin_timeout = 3
net.ipv4.tcp_tw_recycle = 1
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_no_metrics_save=1
net.core.somaxconn = 262144
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_window_scaling = 0
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
fs.file-max = 65536
EOF
/sbin/sysctl -p
#close ctrl+alt+del
sed -i "s/ca::ctrlaltdel:\/sbin\/shutdown -t3 -r
now/#ca::ctrlaltdel:\/sbin\/shutdown -t3 -r now/" /etc/inittab