Centos 5.X的初始化指令碼

來源:互聯網
上載者:User

#!/bin/bash

# Program:

#       system_init_shell

# History:

#       2012/04/1 25061008@qq.com

# Release:

#       1.1

cat << EOF

+--------------------------------------------------------------+

|          === Welcome to Centos 5.x System init ===           |

+--------------------------------------------------------------+

+---------------------------by opsren--------------------------+

EOF

#CHANGE yum

cd /etc/yum.repos.d

mv CentOS-Base.repo CentOS-Base.repo.bak

wget http://mirrors.163.com/.help/CentOS-Base-163.repo

mv CentOS-Base-163.repo  CentOS-Base.repo

yum clean metadata  #清除以前的緩衝

yum makecache  #重建立立緩衝

#update gcc

yum -y install gcc gcc-c++ bison patch unzip mlocate flex lrzsz sysstat

#set ntp

/usr/sbin/ntpdate ntp.api.bz

echo "*/5 * * * * /usr/sbin/ntpdate ntp.api.bz > /dev/null 2>&1" >> /var/spool/cron/root

service crond restart

#set clock

hwclock --set --date="`date +%D\ %T`"

hwclock --hctosys

cat >> /etc/security/limits.conf << EOF

*           soft   nofile       102400

*           hard   nofile       102400

EOF

#close useless service

for i in `ls /etc/rc3.d/S*`

do

   CURSRV=`echo $i|cut -c 15-`

   echo $CURSRV

case $CURSRV in

   cpuspeed | crond | irqbalance | network | sshd | syslog | local )

   echo "Base services, Skip!"

   ;;

   *)

   echo "change $CURSRV to off"

   chkconfig --level 2345 $CURSRV off

   service $CURSRV stop

   ;;

esac

done

echo "service is init is ok.............."

#set LANG

:> /etc/sysconfig/i18n

cat >> /etc/sysconfig/i18n << EOF

LANG="en_US.UTF-8"

EOF

#set sysctl

true > /etc/sysctl.conf

cat >> /etc/sysctl.conf << EOF

net.ipv4.ip_forward = 0

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.default.accept_source_route = 0

kernel.sysrq = 0

kernel.core_uses_pid = 1

net.ipv4.tcp_syncookies = 1

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.shmmax = 68719476736

kernel.shmall = 4294967296

net.ipv4.tcp_max_tw_buckets = 6000

net.ipv4.tcp_sack = 1

net.ipv4.tcp_window_scaling = 1

net.ipv4.tcp_rmem = 4096 87380 4194304

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.