加入收藏 | 设为首页 | 会员中心 | 我要投稿 云计算网_泰州站长网 (http://www.0523zz.com/)- 视觉智能、AI应用、CDN、行业物联网、智能数字人!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Centos 5.X的初始化脚本

发布时间:2016-01-21 03:27:25 所属栏目:Linux 来源:网络整理
导读:#!/bin/bash # Program: # system_init_shell # History: # 2012/04/1 25061008@qq.com # Release: # 1.1 cat EOF +-----------------------------------------

#!/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

(编辑:云计算网_泰州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读