#!/bin/bash
# Program:
# system_init_shell
# History:
# 2012/06/01 25061008@qq.com
# Release:
# 1.1
cat << EOF
+--------------------------------------------------------------+
| === Welcome to CentOS 6.x System init === |
+--------------------------------------------------------------+
+---------------------------by 元心科技--------------------------+
EOF
for i in `ls /etc/yum.repos.d/*`
do
mv ${i} ${i}_bak
done cp ./configs/local.repo /etc/yum.repos.d/
yum clean all
for i in gcc gcc-c++ glibc make autoconf libtool-ltdl-devel gd-devel freetype-devel libxml2-devel libjpeg-devel libpng-devel openssl-devel curl-devel bison patch unzip libmcrypt-devel libmhash-devel ncurses ncurses-devel sudo bzip2 mlocate flex lrzsz sysstat lsof setuptool system-config-network-tui system-config-firewall-tui ntp libaio-devel wget ntp createrepo yum-downloadonly iftop
do
yum -y install ${i} > /dev/null 2>&1
if [ $? -eq 0 ];
then
echo "${i} is installed"
else
echo "${i} is installed to error"
fi
done #set profile
\cp ./configs/profile /etc
source /etc/profile #set ntp
echo "*/5 * * * * /usr/sbin/ntpdate time.windows.com > /dev/null 2>&1" >> /var/spool/cron/root
service crond restart #set clock
hwclock --set --date="`date +%D\ %T`"
hwclock --hctosys #set ulimit
echo "ulimit -SHn 102400" >> /etc/rc.local
cat >> /etc/security/limits.conf << EOF
* soft nofile 102400
* hard nofile 102400
* soft nproc 102400
* hard nproc 102400
EOF #set max user processes
#sed -i 's/1024/102400/' /etc/security/limits.d/90-nproc.conf # turnoff the control-alt-delete
sed -i 's#exec /sbin/shutdown -r now#\#exec /sbin/shutdown -r now#' /etc/init/control-alt-delete.conf #close useless service
for i in `ls /etc/rc3.d/S*`
do
CURSRV=`echo $i|cut -c 15-`
echo $CURSRV
case $CURSRV in
crond | irqbalance | network | sshd | rsyslog | sysstat )
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 ssh
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
service sshd restart #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
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 1024 65535
EOF
/sbin/sysctl -p
echo "sysctl set OK!!" #disable ipv6
#echo "alias net-pf-10 off" >> /etc/modprobe.conf
#echo "alias ipv6 off" >> /etc/modprobe.conf
#/sbin/chkconfig ip6tables off
#echo "ipv6 is disabled!" #disable selinux
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0 #vim setting sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
echo 'syntax on' > /root/.vimrc cat << EOF
+--------------------------------------------------------------+
| ===System init over=== |
+--------------------------------------------------------------+
+---------------------------by 元心科技------------------------+
EOF
echo "###############################################################"

centos6.6系统初始化脚本的更多相关文章

  1. centos7 系统初始化脚本

    现在自己的本地虚拟机系统,直接安装的是centos7.2 mini版,安装完成发现好多东西都没有安装,所以写了一个简单的系统初始化脚本,让自己可以省一些力气,哈哈 人懒主要是. 下面贴出写的脚本,脚本 ...

  2. Centos7系统初始化脚本

    前言: 因公司业务增加,陆续新增服务器,时不时的来几台,手动地一台台对服务器初始化操作感觉太麻烦. 于是乎,根据初始化需求整合了一个初始化脚本,实现批量脚本初始化操作. 说明: 本脚本根据自身需求编写 ...

  3. centos6、7系统初始化脚本

    #!/bin/bash # #******************************************************************** #encoding -*-utf ...

  4. centos系统初始化脚本

    #!/bin/bash #检测是否为root用户 ];then echo "Must be root can do this." exit fi #检测网络 echo " ...

  5. 简单的 centos7&rhel7 系统初始化脚本

    #!/bin/bash #描述: 基于RHEL7&centos7的初始化配置 #读取用户输入的ip read -p "输入你当前Linux的IP地址:" LAST #截取网 ...

  6. LINUX 系统初始化脚本

    #!/bin/bash ######the system first start configuretion #####for install  ####copy right by donglei## ...

  7. Linux系统初始化脚本

    #查看centos的版本号 CentOS_version=`cut -d /etc/centos-release | cut -d` #改变PS3格式 PS3="Please enter t ...

  8. 给公司个别安装好的系统环境处理-相当half系统初始化脚本shell

    #!/bin/bash# Used for other system-environment update! echo -e '\n\033[35m~~请使用root权限运行此脚本~~\033[0m\ ...

  9. 分享我自己的一个最小化安装CentOS6的初始化脚本

    在自己的虚拟机上使用的基于CentOS6的系统初始化脚本 #!/bin/bash # #Filename:system_init.sh #Description:系统安装完成后,对系统进行一些配置,以 ...

随机推荐

  1. Python中pymysql模块详解

    安装 pip install pymysql 使用操作 执行SQL #!/usr/bin/env pytho # -*- coding:utf-8 -*- import pymysql # 创建连接 ...

  2. Django开发模式会加载两次settings文件导致RotatingFileHandlerError

    当使用RotatingFileHandler作为django的日志处理器的时候,会报: Traceback (most recent call last): File "C:\Python2 ...

  3. PHP的依赖管理工具----composer

    安装Composer 参考:https://getcomposer.org/doc/01-basic-usage.md composer 是PHP依赖管理工具 PHP最低版本要求5.3.2,需要允许o ...

  4. java 死锁产生原因及解锁(转)

    原文地址 进程死锁及解决办法 一.要点提示 (1) 掌握死锁的概念和产生死锁的根本原因. (2) 理解产生死锁的必要条件--以下四个条件同时具备:互斥条件.不可抢占条件.占有且申请条件.循环等待条件. ...

  5. 有关numpy.random下的API具体含义

    1.numpy.random.random(size=None) Return random floats in the half-open interval [0.0, 1.0). 返回size大小 ...

  6. php生成随机密码的自定义函数

    php生成随机密码的自定义函数 生成一个随机密码的函数,生成的密码为小写字母与数字的随机字符串,长度可自定义. 复制代码代码如下: <?php /*  * php自动生成新密码自定义函数(带实例 ...

  7. 第10条:尽量用enumerate取代range

    核心要点: (1)enumerate函数提供了一种精简的写法,可以在遍历迭代器时获知每个元素的索引. (2)尽量用enumerate来改写那种将range与下标访问相结合的序列遍历代码. (3)可以给 ...

  8. Kindeditor API

    根据map规则删除range中的element或attribute. cmd.remove({ span : '*', div : 'class,border' });   commonNode(ma ...

  9. 《DevExpress》记录之TreeList

    如这两幅图所示:如果要显示左边的竖线,需要设置 感谢 DoomGuards本节Dome下载地址:http://pan.baidu.com/s/1wBOJk 密码:vz4d

  10. 【leetcode刷题笔记】Search in Rotated Sorted Array II

    Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this ...