转载linuxtone论坛的netseek写的脚本,然后根据自己的情况修改了下!
 
#!/bin/bash
#welcome
cat << EOF
+--------------------------------------------------------------+
|         === Welcome to Centos System init ===                |
+--------------------------------------------------------------+
+----------------------Author:NetSeek--------------------------+
EOF

cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
wget [url]http://autosetup1.googlecode.com/files/CentOS-Base.repo[/url]
rpm --import [url]http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5[/url]
#yum install screen -y
 
#disable ipv6
cat << EOF
+--------------------------------------------------------------+
|         === Welcome to Disable IPV6 ===                      |
+--------------------------------------------------------------+
EOF
echo "alias net-pf-10 off" >> /etc/modprobe.conf
echo "alias ipv6 off" >> /etc/modprobe.conf
/sbin/chkconfig --level 35 ip6tables off
echo "ipv6 is disabled!"
#disable selinux
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0
echo "selinux is disabled!!!"
#vim
yum install  vim-enhanced  vim-common
sed -i '2,3 s/^/#/' /etc/profile.d/vim.sh
source /etc/profile.d/vim.sh
#sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
#echo 'syntax on' > /root/.vimrc
#zh_cn
#sed -i -e 's/^LANG=.*/LANG="en"/'   /etc/sysconfig/i18n
#init_ssh
ssh_cf="/etc/ssh/sshd_config"
sed -i -e '74 s/^/#/' -i -e '76 s/^/#/' $ssh_cf
sed -i "s/#UseDNS yes/UseDNS no/" $ssh_cf
#client
#sed -i -e '44 s/^/#/' -i -e '48 s/^/#/' $ssh_cf
echo "ssh is init is ok.............."
#chkser
#tunoff 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 | sendmail | sshd | syslog | local | mysqld )
#这个地方根据自己个人情况来定义,别把你本来需要的服务关闭了
     echo "Base services, Skip!"
     ;;
     *)
         echo "change $CURSRV to off"
         chkconfig --level 235 $CURSRV off
         service $CURSRV stop
     ;;
esac
done