Kickstart制作

6500 ワード

1.ミラーガイドファイルの編集
isolinux.cfg
最初の行:  default linux ks=cdrom:/ks.cfg
2.パッケージ構成ファイルを編集するks.cfg
#         
install


#          
cdrom
lang en_US.UTF-8
keyboard us
network --device eth0 --onboot yes --bootproto dhcp

#root passwd      $     
rootpw --iscrypted $        
# System authorization information
auth  --useshadow  --passalgo=sha512

#    
text
#     
firewall --disable
selinux --disable

#firewall --enabled --port=23:tcp
#authconfig --enableshadow --enablemd5
#selinux --enforcing
#        ,   cdrom
reboot --eject
#      
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda
#clear the master boot Record
zerombr

clearpart --all
# install linux
#     
part /boot --fstype ext3 --size=100
part swap --size=8000
part / --fstype ext4 --size=20000 
part /usr --fstype ext4 --size=20000
part /tmp --fstype ext4 --size=11000
part /var --fstype ext4 --size=16000
part /opt --fstype ext4 --size=1 --ondisk=sda  --grow

#            rpm  
%packages
@base
@core
@chinese-support
@client-mgmt-tools
@development
@server-platform
@infiniband
@large-systems
@legacy-unix
@java-platform
@performance
@perl-runtime
@ruby-runtime
@network-tools
@system-management
@virtualization
@virtualization-client
@virtualization-platform
@virtualization-tools
postgresql92-libs
postgresql92-test
postgresql92-server
postgresql92
postgresql92-devel
postgresql92-contrib
postgresql92-plpython
genisoimage
# list packages below donot known
libXinerama-devel
openmotif-devel
libXmu-devel
xorg-x11-proto-devel
startup-notification-devel
libgnomeui-devel
libbonobo-devel
libXau-devel
libgcrypt-devel
popt-devel
libdrm-devel
libXrandr-devel
libxslt-devel
libglade2-devel
gnutls-devel
# mtools #  windows DOS   
sgpio
genisoimage
desktop-file-utils
jpackage-utils
tcp_wrappers
ebtables
perl-DBD-SQLite
libvirt-java
puppet
%end

%post  --nochroot

cp -r /mnt/source/update/* /mnt/sysimage/mnt/

%post

true > /etc/redhat-release
cat >> /etc/read-hat-release << EOF
CentOS_6.4 x86_64 For Lambda
Welcom to CentOS X
EOF

true > /etc/issue
cat >> /etc/issue << EOF
CentOS X 6.4 x86_64 For Lambda
**** Self Build****
EOF

sed -i 's/timeout=5/timeout=2/g' /boot/grub/grub.conf
sed -i 's/rhgb/ /g' /boot/grub/grub.conf
sed -i 's/splashimage/#splashimage/g' /boot/grub/grub.conf

mkdir /media/iso
/bin/echo 'mount -a'>> /etc/rc.d/rc.local
mkdir /media/CentOS


mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Media.repo

cd /mnt
tar -xvf htop-1.0.2.tar.gz
tar -xvf Python-2.7.5.tar.bz2
tar -xvf ntfs-3g_2013.1.13.tar.gz
tar -xvf setuptools-1.0.tar.gz
tar -xvf psycopg2.tar.gz
tar -xvf webpy-0.37.tar
#/bin/echo "cd /mnt/htop-1.0.2 && make install" >> /etc/rc.d/rc.local
/bin/echo "cp /mnt/htop /usr/bin/" >> /etc/rc.d/rc.local
/bin/echo "cd /mnt/ntfs-3g_2013.1.13 && make install" >> /etc/rc.d/rc.local
/bin/echo "cd /mnt/Python-2.7.5 &&  ./configure && make && make install " >> /etc/rc.d/rc.local
/bin/echo "cd /mnt/setuptools-1.0 && /usr/local/bin/python2.7 setup.py install" >> /etc/rc.d/rc.local
/bin/echo "cd /mnt/webpy-0.37 && /usr/local/bin/python2.7 setup.py install"  >> /etc/rc.d/rc.local
/bin/echo "echo  'pg_config=/opt/pgsql/9.2/bin/pg_config' >> /mnt/psycopg2/setup.cfg " >>/etc/rc.d/rc.local
/bin/echo "cd  /mnt/psycopg2 &&  /usr/local/bin/python2.7 setup.py build" >> /etc/rc.d/rc.local
/bin/echo "cd  /mnt/psycopg2 &&  /usr/local/bin/python2.7 setup.py install" >> /etc/rc.d/rc.local


#/bin/echo "rm -rf /mnt/*" >> /etc/rc.d/rc.local
#/bin/echo "cd /root && rm -rf /root/*" >> /etc/rc.d/rc.local

/bin/echo "/bin/echo 'touch /var/lock/subsys/local'> /etc/rc.d/rc.local">> /etc/rc.d/rc.local


chkconfig --level 345 iscsi off
chkconfig --level 345 iscsid off
chkconfig --level 345 iptables off

ulimit -HSn 65535

echo -ne "
* soft nofile 65536
* hard nofile 65536
" >>/etc/security/limits.conf

##    
true > /etc/sysctl.conf   
cat >> /etc/sysctl.conf << EOF  
net.ipv4.ip_forward = 0   
net.ipv4.conf.default.rp_filter = 1   
net.ipv4.conf.default.accept_source_route = 0   
kernel.sysrq = 0   
kernel.core_uses_pid = 1   
net.ipv4.tcp_syncookies = 1   
kernel.msgmnb = 65536   
kernel.msgmax = 65536   
kernel.shmmax = 68719476736   
kernel.shmall = 4294967296   
net.ipv4.tcp_max_tw_buckets = 6000   
net.ipv4.tcp_sack = 1   
net.ipv4.tcp_window_scaling = 1   
net.ipv4.tcp_rmem = 4096 87380 4194304   
net.ipv4.tcp_wmem = 4096 16384 4194304   
net.core.wmem_default = 8388608   
net.core.rmem_default = 8388608   
net.core.rmem_max = 16777216   
net.core.wmem_max = 16777216   
net.core.netdev_max_backlog = 262144   
net.core.somaxconn = 262144   
net.ipv4.tcp_max_orphans = 3276800   
net.ipv4.tcp_max_syn_backlog = 262144   
net.ipv4.tcp_timestamps = 0   
net.ipv4.tcp_synack_retries = 1   
net.ipv4.tcp_syn_retries = 1   
net.ipv4.tcp_tw_recycle = 1   
net.ipv4.tcp_tw_reuse = 1   
net.ipv4.tcp_mem = 94500000 915000000 927000000   
net.ipv4.tcp_fin_timeout = 1   
net.ipv4.tcp_keepalive_time = 1200   
net.ipv4.ip_local_port_range = 1024 65535   
EOF

/sbin/sysctl -p
%end