RHEL6.x的kickstart配置文件ks.cfg
install
#upgrade
url –url ftp://10.24.1.5/tftpd_v6/OS_iso
#nfs –server=192.168.9.20 –dir=/media/cdrom
# skip keynumber input.
key –skip
lang en_US
#langsupport en_US zh_CN –default=en_US
keyboard us
#mouse
timezone Asia/Shanghai
#auth –useshadow –enablemd5
authconfig –enableshadow –passalgo=sha512 –enablefingerprint
rootpw borqs123
clearpart –all
bootloader –location=mbr
#skipx
zerombr yes
# <<<<<<<<<<< if you use U disk to boot, you must plugout U disk before partition. >>>>>>>>>>>>
part swap –recommended –asprimary –ondisk sda
part /boot –fstype ext4 –size 128 –asprimary –ondisk sda
part / –fstype ext4 –size 102400 –asprimary –ondisk sda
# others should be non-asprimary partition.
#part /d –fstype ext4 –size 819200 –ondisk sda
part /data1 –fstype ext4 –size 1 –grow –ondisk sda
# <<<<<<<< modify IP and HOSTNAME >>>>>>>>
network –device=eth0 –onboot yes –bootproto=static –ip=10.24.1.240 –netmask=255.255.255.0 –gateway=10.24.1.1 –hostname=nd0-rack2-cloud –nameserver=211.162.78.1
firewall –disabled
reboot
####################################################################################
##################################### packages #####################################
####################################################################################
repo –name=”Red Hat Enterprise Linux” –baseurl=ftp://10.24.1.5/tftpd_v6/OS_iso/
# @ means group id, other means package id
%packages –resolvedeps
@base
@console-internet
@core
@debugging
@directory-client
@hardware-monitoring
@java-platform
@large-systems
@network-file-system-client
@performance
@perl-runtime
@server-platform
@server-policy
@development
@java-platform
pax
python-dmidecode
oddjob
sgpio
certmonger
pam_krb5
krb5-workstation
nscd
pam_ldap
nss-pam-ldapd
perl-DBD-SQLite
%end
####################################################################################
##################################### POST –nochroot ##############################
####################################################################################
%post –nochroot
#!/bin/bash
# Uncomment the next line if you want to see what’s happening behind the scenes, or use Ctrl+Alt+F1/F2/F3/F4/F5/F6 to check.
#chvt 3
ls /mnt/sysimage
mkdir /mnt/sysimage/root/ganglia
cd /mnt/sysimage/ganglia/
wget -r ftp://10.24.1.5/ganglia/*
ls /mnt/sysimage/ganglia
mkdir /mnt/sysimage/root/linux_tools
cd /mnt/sysimage/linux_tools/
wget -r ftp://10.24.1.5/linux_tools/*
ls /mnt/sysimage/linux_tools
mkdir /mnt/sysimage/LINUX_DVD
cd /mnt/sysimage/LINUX_DVD/
wget -r ftp://10.24.1.5/tftpd_v6/OS_iso/*
ls /mnt/sysimage/LINUX_DVD
####################################################################################
##################################### POST #########################################
####################################################################################
%post
#!/bin/bash
cat /proc/cmdline
ls /
echo ls /mnt/
echo ls /media/
# For testing, comment out the next section to save time.
# For production, uncomment the section to ensure all updates are installed.
# If you uncomment this section, make sure you uncomment
# chvt 3 (above) and chvt 7 (below) so that you can see what’s going on.
# If you are behind an HTTP proxy, uncomment and adjust the http_proxy line.
#export http_proxy=http://your_proxy_username:your_proxy_password@your_proxy_hostname:your_proxy_port
#yum -y update
chkconfig sendmail off
chkconfig iptables off
chkconfig ip6tables off
chkconfig ntpd on
echo “session required pam_limits.so” >> /etc/pam.d/login
echo “* soft nproc 1000000” >> /etc/security/limits.conf
echo “* hard nproc 1000000” >> /etc/security/limits.conf
echo “* soft nofile 1000000” >> /etc/security/limits.conf
echo “* hard nofile 1000000” >> /etc/security/limits.conf
echo “* soft core 1024000” >> /etc/security/limits.conf
echo “* hard core 1024000” >> /etc/security/limits.conf
echo “* soft memlock 32000” >> /etc/security/limits.conf
echo “* hard memlock 32000” >> /etc/security/limits.conf
echo “* soft stack 102400” >> /etc/security/limits.conf
echo “* hard memlock 32000” >> /etc/security/limits.conf
echo “* hard stack 102400” >> /etc/security/limits.conf
echo “* soft msgqueue 8192000” >> /etc/security/limits.conf
echo “* hard msgqueue 8192000” >> /etc/security/limits.conf
############ Modify ntp.conf #################
cat << EOF >> /etc/ntp.conf
# —————————————————————–
# Modified /etc/ntp.conf by kickStart.
# —————————————————————–
server ntp.fudan.edu.cn prefer
EOF
############ Modify rc.local for normal running #################
cat << EOF >> /etc/rc.local
echo
echo —————————————————————–
echo Modified /etc/rc.d/rc.local by kickStart.
echo —————————————————————–
# do anything you want to do for normal running.
EOF
############ Modify rc.local for first time running#################
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.orig
cat << EOF >> /etc/rc.local
# do anything you want to do for first time running.
echo
echo —————————————————————–
echo Fixing /etc/rc.d/rc.local.
echo —————————————————————–
rm -f /etc/rc.d/rc.local
cp /etc/rc.d/rc.local.orig /etc/rc.d/rc.local
EOF
# Uncomment the next section if you uncommented the
# chvt 3 line near the top of this file
sleep 10s
#chvt 7
%end