Linux系統初始化指令碼

來源:互聯網
上載者:User

標籤:linux系統初始化指令碼

#!/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#修改ssh預設dns解析sed -i ‘/AddressFamily/ a\UseDNS no‘ /etc/ssh/sshd_config#添加預設lib庫檔案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 "初始化系統沒有完成!"


本文出自 “成都@阿狀” 部落格,請務必保留此出處http://azhuang.blog.51cto.com/9176790/1550438

Linux系統初始化指令碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.