##关闭selinux
  sed -i 's/enforcing/disabled/'  /etc/selinux/config
  setenforce 0
/usr/bin/systemctl  stop  firewalld.service    #关闭防火墙
/usr/bin/systemctl   disable  firewalld.service  #禁止开机启动
##安装一些必备软件
yum -y install gcc gcc-c++  lrzsz  vim  wget  zlib  curl  ntpdate
 ##同步时间
ntpdate  time.windows.com
cat >> /etc/crontab <<EOF
> 00 10 * * * /udr/sbin/ntpdate  time.windows.com; /usr/sbin/hwclock -w > /dev/null 2>&
EOF
#打开文件数设置
ulimit -SHn 65530
echo    “ *                soft nofile 65535'   >>/etc/sysctl.conf
echo      " *               hard nofile 65535"  >>/etc/sysctl.conf
echo       "*               hard nproc 1204000" >> /etc/security/limits.conf
echo       "*                soft nproc 1204000" >> /etc/security/limits.conf
##修改默认字体为UTF-8
sed -i 's@LANG=.*$@LANG=\"en_US.UTF-8\"@g' /etc/sysconfig/i18n
##优化内核;
cat >> /etc/sysctl.conf << EOF
#michaelkang add 120724
net.ipv4.tcp_abort_on_overflow = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 20
net.ipv4.tcp_retries1 = 2
net.ipv4.tcp_retries2 = 5
net.ipv4.tcp_max_orphans = 2000
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_synack_retries = 3
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
EOF
sysctl -p
##锁定日志文件
chattr  +a   /var/log/messages