#!/bin/bash#gcc installyum install -y gcc#vim installyum install -y vim#development toolsyum groupinstall -y "Development libraries" "Development tools "# close iptablesyum -y install iptables/etc/init.d/iptables stop/ Sbin/iptables -fservice iptables save/etc/init.d/iptables stopchkconfig iptables off# disable ipv6echo "Alias net-pf-10 off" >> /etc/ modprobe.confecho "Alias ipv6 off" >> /etc/modprobe.conf/sbin/chkconfig -- level 35 ip6tables offecho "ipv6 is disabled!" #yum installyum install -y lrzszyum -y install xfsdumpyum -y install wgetyum -y install redhat-lsb#disable selinuxsed -i "s/SELINUX= enforcing/selinux=disabled/" /etc/selinux/configecho " selinux is disabled,you must reboot! " #modify timezoneecho ' y ' | cp /usr/share/zoneinfo/asia/shanghai /etc/localtime#sync timeyum install -y ntp/usr/sbin/ntpdate ntp.api.bz > /dev/null 2>&1echo "/usr/sbin/ntpdate ntp.api.bz > /dev/null 2>&1" >> /etc/rc.local echo "Modprobe ip_conntrack > /dev/null 2 >&1 " >> /etc/rc.local #tunoff servicesfor i in ' ls /etc/ rc3.d/s* ' do cursrv= ' echo $i | cut -c 15-' echo $CURSRVcase $CURSRV in crond | irqbalance | microcode_ctl | network | random | sendmail | sshd | syslog | local ) echo "base services,skip!" ;; *) echo "change $CURSRV to off" chkconfig --level 235 $CURSRV off service $CURSRV stop ;; esacdoneecho "ulimit -shn 65535" >> /etc/profileecho "* soft nofile 65536 " >> /etc/security/limits.confecho " * hard nofile 65536 " >> /etc/security/limits.confecho ' >/etc/sysctl.confcat >>/etc/sysctl.conf <<eofnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 1net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 68719476736kernel.shmall = 4294967296net.ipv4.tcp_max_tw_buckets = 60000net.ipv4.tcp_sack = 1net.ipv4.tcp_window_scaling = 1net.ipv4.tcp_rmem = 4096 87380 4194304net.ipv4.tcp_wmem = 4096 16384 4194304net.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.rmem_max = 16777216net.core.wmem_max = 16777216net.core.netdev_max_backlog = 262144net.core.somaxconn = 262144net.ipv4.tcp_max_orphans = 3276800net.ipv4.tcp_max_syn_backlog = 262144net.ipv4.tcp_ timestamps = 0net.ipv4.tcp_synack_retries = 1net.ipv4.tcp_syn_retries = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = 94500000 915000000 927000000net.ipv4.tcp_fin_timeout = 1net.ipv4.tcp_keepalive_time = 30net.ipv4.ip_local_port_range = 1024 65000fs.file-max = 102400net.ipv4.ip_conntrack_max = 1048576net.ipv4.netfilter.ip_conntrack_max = 131072net.ipv4.netfilter.ip_conntrack_tcp_timeout_ established = 216000eofmodprobe ip_conntracksysctl -p# Modify SSH Default DNS resolution sed -i '/ Addressfamily/ a\usedns no ' /etc/ssh/sshd_config# add default lib library file touch /etc/ld.so.conf.d/ default.confecho "/usr/lib" >> /etc/ld.so.conf.d/default.confecho "/usr/lib64" >> /etc/ld.so.conf.d/default.confecho "/usr/local/lib" >> /etc/ ld.so.conf.d/default.confecho "/usr/local/lib64" >> /etc/ld.so.conf.d/ default.confldconfigecho "Initialization system is not complete! "
This article is from the "Chengdu @ Ah-like" blog, please be sure to keep this source http://azhuang.blog.51cto.com/9176790/1550438
Linux System initialization scripts