Initialization scripts for Centos 5.X

Source: Internet
Author: User
Tags i18n centos

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.