#!/bin/bashif [["$ (whoami)"! = "root"]]; Then echo ">&2 exit 1fiecho"-------system init---------"echo"-------epel---- ---"cd/etc/yum.repos.d/if [-F Centos-base.repo];then MV Centos-base.repo{,.bak}else MV Rhel-source.repo{,.bak}ficurl -i-s http://172.16.4.250|grep "OK" &>/dev/nullif [[$?-eq 0]];then wget Http://172.16.4.250/base.repo &&G T /dev/null Sleep 3else exit 4fiecho "------Close firewall and selinux---" cp/etc/selinux/config/etc/selinux/config.baks Ed-i ' s/selinux=enforcing/selinux=disabled/'/etc/selinux/configsetenforce 0/etc/init.d/iptables stop &>/dev /nullchkconfig iptables offsleep 3echo "-------NTP---------" echo "* * * * */usr/sbin/ntpdate 172.16.0.213 &>/d Ev/null ">>/var/spool/cron/root/usr/sbin/ntpdate 172.16.0.213 &>/dev/null/etc/init.d/crond Restart &>/dev/nullsleep 3read-p ' PLZ input a name: ' Namesed-i ' s/hostname=localhost/hostname= $name/'/etc/syscoNfig/network/bin/hostname $nameecho "-----Limits-----" Cat >>/etc/security/limits.conf << eof* Soft Nofile 65535* hard Nofile 65535eofulimit-hsn 65535echo "-----sysctl (System kernel)--------"/bin/cp/etc/sysctl.conf/etc/ sysctl.conf. ' Date +%F ' Cat>>/etc/sysctl.conf<<eofnet.ipv4.tcp_timestamps = 0net.ipv4.tcp_synack_ Retries = 2net.ipv4.tcp_syn_retries = 2net.ipv4.tcp_mem = 94500000 915000000 927000000net.ipv4.tcp_max_orphans = 3276800net.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.rmem_max = 16777216net.core.wmem_max = 16777216net.ipv4.tcp_rmem = 4096 87380 16777216net.ipv4.tcp_wmem = 4096 87380 16777216net.core.netdev_max_backlog = 32768net.core.somaxconn = 32768net.ipv4.tcp_syncookies = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_fin_timeout = 1net.ipv4.tcp_keepalive_time = 600net.ipv4.tcp_max_syn_backlog = 65535net.ipv4.ip_local_ Port_range = 1024x768 65535eof/sbin/sysctl-p &>/dev/nullecho "------init Finish------"
This article from "It Big strong-carlton" blog, reproduced please contact the author!
Linux command Daquan detailed