##關閉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