#!/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* '
Todo
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
The 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